BuddyDev

Search

MediaPress Gallery in BP User Profile

  • Participant
    Level: Initiated
    Posts: 6
    Matteo on #32958

    Hi,

    I am creating a Buddypress Site but I am trying to get rid of the user nav and display every part on the contect on their own from the front page.

    So I have mediapress and it work very good when I have the user navigation but is there any get call or anything I can use to have the users Mediapress content and fore example place it in its own div?

    For example for the basic profile I use bp_get_template_part( ‘members/single/profile’); is there any call like this? Or which template file can I use to display the user media content?

    Thank you very Much!

  • Keymaster
    (BuddyDev Team)
    Posts: 24212
    Brajesh Singh on #32974

    Hi Matteo,

    Thank you for using the plugin.

    Using the code

    
    mpp_get_template('gallery/loop-gallery');
    

    may work. We haven’t tried it though.

    Your bets bet is to either use the shortcode or the MPP_Gallery_Query to create custom list

    https://buddydev.com/mediapress/shortcodes/mediapress-gallery-listing-shortcodes/

    https://buddydev.com/mediapress/core/mpp_gallery_query/

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 6
    Matteo on #33032

    Hi Brajesh

    Thank you very much.

    So with the shortcode it works good, i have used this code in my profile page template.

    echo do_shortcode( '[mpp-list-gallery component=members user_id="1" show_creator=1 before_creator="By: " ]' );
    echo do_shortcode( '[mpp-uploader]');

    With the second method I have used it like this :

     // the query
    $the_gallery_query = new MPP_Gallery_Query( array( 'user_id' => 1 )); ?>
    
    <?php //if ( $the_gallery_query->have_galleries() ) : ?>
     
        
         <!-- the loop -->
    <?php while ( $the_gallery_query->have_galleries() ) : $the_gallery_query->the_gallery(); ?>
    <h2><?php mpp_get_gallery_title(); ?></h2>
    <?php endwhile; ?>
    <!-- end of the loop -->
     
    <?php mpp_reset_gallery_data(); ?>
     
    <?php else : ?>
    <p><?php _e( 'Sorry, no gallery found.' ); ?></p>
    <?php endif; ?>

    In this second case, the else statement works when the query is left empty but does not display anything when I put the user (for now I am testing and user 1 has one gallery).

    Now with the shortcode method I am missing the option to create a gallery (after I will implement a conditional that that options only appears if user is logged in).
    Any ways to add that last part? I would like to have the full options possibilities that appear when opening the tab in the user profile navigation, but without displaying the user profile navigation.

    Thanks again.

You must be logged in to reply to this topic.

This topic is: not resolved