Forums

[resolved] [Plugin: User Community] Gallery outside dashboard? (5 posts)

  1. acub
    Member
    Posted 2 years ago #

    Is there a way to move the gallery out of the dashboard, in a separate page of the community?
    I'm not very good with code, but I've had my share of outdoing myself in this matter.
    Just head me in the right direction.

    Thank you.

    http://wordpress.org/extend/plugins/alkivia/

  2. Txanny
    Member
    Posted 2 years ago #

    First, I would recommend you to wait some days, as this weekend I will release the 0.8 version and how to do it will change on that.

    Instructions are for the coming 0.8 version, you can get the development version at http://wordpress.org/extend/plugins/alkivia/download/

    You need two things:

    1) The user ID you want the gallery of.
    2) Call the function aoc_get_user_gallery() passing as the first parameter the user ID.

    The function will return an array with all needed data for user gallery. Each array element is a gallery item. In this item, you need the IMG key which is the HTML source to the image thumbnail.

    I'm replacing just now the system that outputs the user gallery and will be done this weekend. When finished, all will be easiest, as will exists a function like: aoc_get_gallery_output($user_id); With this function, you only will need to call it with the user ID and you will get the formated gallery content to output it anywhere you want. Also, this will allow to code new gallery templates.

    Stay connected as I will post here as soon as this is done and available.

  3. Txanny
    Member
    Posted 2 years ago #

    Just released 0.8 this includes a function: aoc_gallery_content() that can be used for what you want.

    Call this function this way:

    <?php
    if ( aoc_is_component('gallery') {
        echo aoc_gallery_content($user_login_or_id);
    }

    Look I'm checking first that the gallery component is active to not broke anything if the component is disabled. If you will use outside the plugin, check that function exists:

    <?php
    if ( function_exists('aoc_gallery_content') {
        echo aoc_gallery_content($user_login_or_id);
    }

    The only parameter the function needs is self-explanatory. Pass the user ID or the user login. You will get the HTML gallery code if the user has images, if not, the function returns false.

    The gallery output comes from the selected gallery template (on the settings page). Templates are located in the 'templates' directory, and those for gallery are prefixed 'gallery-'. If you create your own template, upload it to this folder and select it on the settings page, you template output will be returned.

  4. acub
    Member
    Posted 2 years ago #

    i'm back.
    just upgraded the plugin to 0.8 and I think it's great.
    i specifically like that you've made styling the list very easy.
    I'll try what you recommended tomorrow and will post again.

    thank your for the quick response and support.

  5. garynamie
    Member
    Posted 2 years ago #

    hi, I figured it would be best to move the discussion here. Still having a minor problem with implementing the code. I looked through the files that make up the Alkivia plugin; also through forum posts to see if I could find the information I need. Sorry if I'm asking a question you've already answered.

    Here's the problem:

    I'm attempting to use your 2nd code example, to call up the image gallery from another page outside of the plugin. How can I access the user metadata outside the plugin? I think the necessary variables are not in the proper scope and I would need to require a library file from the Alkivia plugin. Is that right? Thanks for your time!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags