BuddyDev

Search

[Resolved] How can i deactivate “Create album” at the media for normal user?

  • Participant
    Level: Initiated
    Posts: 13
    Benny on #52384

    Hi support team,

    i need urgently help for mediapress. I only want to delete the “Create album” feature/button at the groups / media section. Only the admin should be able to create an album there, but no other normal user.

    How can i do that? I searched the whole web and buddydev too, but i found no way how to deactivate “Create Album”.

    Please help.

    Many thanks
    Benny

  • Keymaster
    (BuddyDev Team)
    Posts: 24611
    Brajesh Singh on #52389

    Hi Benny,
    Welcome to BuddyDev.

    I am sorry, the plugin does not have an option for it.

    you will need to use the following snippet

    
    
    // Limits MediaPress group gallery creation to site admin and group admin.
    add_filter( 'mpp_user_can_create_gallery', function ( $can_do, $component, $component_id ) {
    	if ( 'groups' !== $component ) {
    		return $can_do;
    	}
    
    	if ( ! is_super_admin() && ! groups_is_user_admin( bbp_get_current_user_id(), $component_id ) ) {
    		$can_do = false;
    	}
    
    	return $can_do;
    }, 10, 3 );
    
    

    If you are using any code snippet manager, please add it it them. Otherwise, Please put it in your theme’s functions.php.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 13
    Benny on #52399

    Many thanks Brajesh, i am very happy!

    It works.

    Kind regards
    Benny

  • Keymaster
    (BuddyDev Team)
    Posts: 24611
    Brajesh Singh on #52411

    Hi Benny,
    I am glad it worked.

    Regards
    Brajesh

The topic ‘ [Resolved] How can i deactivate “Create album” at the media for normal user?’ is closed to new replies.

This topic is: resolved