BuddyDev

Search

limit gallery link on members profiles

  • Participant
    Level: Initiated
    Posts: 14
    Patti Muldoon on #10160

    Hi Brajesh, I placed your code into the child functions.php and it took the site down.

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #10161

    Hi,
    It most probably caused a fatal error due to syntax.

    Please remove it and post the complete functions.php on https://pastebin.com/

    I will update it for you to avoid any syntax issue.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 14
    Patti Muldoon on #10162

    I have fixed the error and have the site up again, but it still doesn’t limit the friends from having a gallery. Everyone still has a gallery link and the galleries dont post to the page designated as the gallery page.

  • Participant
    Level: Initiated
    Posts: 14
    Patti Muldoon on #10163

    I have just added the code to the pastebin.com site.

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #10164

    Please link me to the code.

  • Participant
    Level: Initiated
    Posts: 14
    Patti Muldoon on #10165

    How? Sorry, but I am not familiar with it, so do I have to create an account and how do I send it to you?

  • Participant
    Level: Initiated
    Posts: 14
    Patti Muldoon on #10167

    Is this what you need: https://pastebin.com/YRkJYhrs

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #10174

    You have it correctly there.

    I need to check if it works in functions.php or we will need bp-custom.php

    Will post back later today.

  • Participant
    Level: Initiated
    Posts: 14
    Patti Muldoon on #10179

    Thank you Brajesh.

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #10217

    Hi Patti,
    I hope I am not too late.
    There was an issue in how I used the s2members function.

    Here is the updated code

    
    
    /**
     * Example: Disable MediaPress gallery for S2 members level 0
     *
     * @param bool   $is_active is MediaPress active.
     * @param string $component component name(members, groups,sitewide etc).
     * @param int    $component_id context items id(user id, group id etc).
     *
     * @return bool
     */
    function mpp_custom_disable_for_users( $is_active, $component, $component_id ) {
    	// only for members component.
    	if ( 'members' !== $component ) {
    		return $is_active;
    	}
    
    	// do not allow zero level to have the gallery.
    	if ( function_exists('current_user_is' ) && current_user_is('s2member_level0' ) ) {
    		return false;
    	}
    	return $is_active;
    }
    add_filter( 'mpp_is_enabled', 'mpp_custom_disable_for_users', 10, 3 );
    
    

    The current_user_is only takes role not the user id. I installed and tested with s2members today.

    Hope it helps.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved