BuddyDev

Search

[Resolved] User Gallery in Profile for That Specific Profile and User

  • Participant
    Level: Initiated
    Posts: 18
    Jemma Tates on #2741

    Hi !

    Using the shortcode:

    [mpp-media type=”photo” max=”10″ component=”members”]

    I have inserted a user gallery exactly as I want it inside the profile loop, so for example :

    http://coparenting.org.uk/members/joebloggs/

    (under the avatar top profile photo)

    I donโ€™t want to use the gallery menu link I want a gallery for the user inside the profile as seen in the link I provided.

    The problem I have now, is that this gallery is only showing the gallery of the logged in user, not the gallery of the selected user you have arrived at on the link, for example, joebloggs (the example i provided) his profile is showing the gallery of the logged in user jemma tates (me, the admin)

    I have used the code in a previous forum post in bp-custom for : stop user gallery creation, and to create one main gallery, defined by me. And this is great and working fine.

    Now I need the code (if possible)?! ๐Ÿ™‚ To have these gallery shortcodes (or php code and / or function code for the bp-custom file) to show the users profile gallery inside the profile your viewing instead of just seeing your own gallery images in every other personโ€™s profile.

    I hope this makes sense and you can help. I have read pages and pages of support and you guys are brilliant but I canโ€™t find exactly what I need. Also, I am not a php coder, I am only a front end web developer, css etc so my php knowledge is cut and paste and tweak level!! ๐Ÿ™‚

    Please help?

    ๐Ÿ™‚

    Thanks Jem

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #2742

    Hi Jem,

    Welcome to BuddyDev and thank you for asking.

    Please use the following php code and it will only list media for displayed users.

    
    
    <?php
    $displayed_user_id = bp_displayed_user_id();
    //run the shortcode
    echo do_shortcode( "[mpp-media type='photo' max='10; component='members' component_id={$displayed_user_id}]");
    
    ?>
    

    PS: We will add an option in the shortcode t make it even easier. Please do let me know if that works for you or not?

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 18
    Jemma Tates on #2743

    Omg that’s amazing thank you for your quick response!

    Yes it works perfectly! ๐Ÿ™‚

    Can you help me with one last thing?

    Underneath this gallery I would like to add a link that shows only on the logged in users profile that goes to their mediapress gallery / upload page, is that possible?

    Thanks Jem

  • Participant
    Level: Initiated
    Posts: 18
    Jemma Tates on #2744

    Hi, I was just thinking, a better solution would be to have the upload function after the gallery for the logged in user on their profile.

    I know how to show a div using the CSS for a user in their account and hide it in the other profiles, but the problem is when I use this shortcode:

    [mpp-uploader]

    The uploader is inserted in the top of the page and I can’t edit it in the CSS to hide it etc to get it to do what I want. I have wrapped it in a div to try control it but it doesn’t work.

    Can you help at all?

    Thanks Jem

  • Participant
    Level: Initiated
    Posts: 18
    Jemma Tates on #2745

    Oh! I worked it out! Yay ! Ha sorry for being php thick – I used your code and did this:

    <?php
    $displayed_user_id = bp_displayed_user_id();
    //run the shortcode
    echo do_shortcode( “[mpp-uploader]”);

    ?>

    And it works fine now and then I have hidden it on other profiles using the CSS. ๐Ÿ™‚

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #2746

    Hi Jem,
    Thank you. I am sorry for the delayed reply.

    Here is what you may use and you will not need to hide using css.

    
    
    <?php if ( bp_is_my_profile() ):?>
    
    <?php echo do_shortcode( "[mpp-uploader]" ); ?>
    
    <?php endif; ?>
    
    

    Hope that helps.

    • This reply was modified 8 years, 2 months ago by Brajesh Singh. Reason: Correct the typo in code
  • Participant
    Level: Initiated
    Posts: 18
    Jemma Tates on #2749

    Hi thanks, this code didn’t work but I changed:

    bp_is_myprofile

    to:

    bp_is_my_profile

    and now it works:

    <?php if(bp_is_my_profile()):?>

    <?php echo do_shortcode( “[mpp-uploader]”); ?>

    <?php endif;?>

    Thanks again great help! ๐Ÿ™‚

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #2753

    Hi Jem,
    Thank you. Yes, I made a mistake there while typing. It is good to know that you fixed it and it is working for you ๐Ÿ™‚

    Marking this topic as resolved.

The topic ‘ [Resolved] User Gallery in Profile for That Specific Profile and User’ is closed to new replies.

This topic is: resolved