• Resolved rothaar

    (@rothaar)


    Hi
    thank you for this plugin. πŸ™‚

    Is it possible to hide the gallery in the profile of specific users? I’m not a programmer so go easy on me here. πŸ™‚

    I would like only one group of users to be able to create galleries. The other group should be able to view the galleries (based on the privacy settings of course), but I would like to hide the Gallery from their BuddyPress profile menu so they are not able to create a gallery.

    Thank you for your help.

    https://ww.wp.xz.cn/plugins/mediapress/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Brajesh Singh

    (@sbrajesh)

    Hi,
    Thank you for asking.

    Currently, It is easily possible to disallow a user to create gallery using the filter as shown below.

    //stop gallery creation, only superadmin can
    function mpp_custom_check_gallery_create_permission( $can_do, $component,  $user_id ) {
    
    	if ( is_super_admin() ) {
    		$can_do = true; //ok super admin can create it
    	} else {
    		$can_do = false;//no one else can
    	}
    
    	return $can_do;
    }
    
    add_filter( 'mpp_user_can_create_gallery', 'mpp_custom_check_gallery_create_permission', 10, 3 );

    Instead of is_super_admin you can use current_user_can to check for specific ability.

    Currently, it won’t hide the gallery tab but will not allow creating.
    In next 2-3 days, I will be pushing another update, that will allow you to hide the gallery tabs too.

    Thank you
    Brajesh

    Thread Starter rothaar

    (@rothaar)

    Hi Brajesh,

    thank you for your quick reply! That would be great if this could be done via the admins panel! Thank you! πŸ™‚

    As I said I’m not a programmer so I just want to make sure that I understand the code right. I’ve created a user role that is called teacher, which is the one that I want to be able to see the the gallery tab and also create galleries. So I just need to replace is_super_admin with is_teacher and put the code in bp-custom.php, right? Would the super-admin or the admin still have access?

    Thank you again!
    K.

    Plugin Author Brajesh Singh

    (@sbrajesh)

    Hi K,
    No problem. Sorry about the above. I will rather put the options in admin panel. No, Please do not put the code by modifying. There does not exists any function name like is_teacher.

    In WordPress it is not recommended to do checks based on roles, instead the capability is considered the right thing to check.

    What are the capability differences between teacher and students?
    Here is the codex page to understand capability.
    https://codex.ww.wp.xz.cn/Roles_and_Capabilities

    Plugin Author Brajesh Singh

    (@sbrajesh)

    Hi K,
    I have added better support for disabling MediaPress for specific users/user groups.

    Can you please tell me if there is a way to differentiate between your roles or how you created the roles. I can provide some ready to use code then.

    Thank you
    Brajesh

    Plugin Author Brajesh Singh

    (@sbrajesh)

    Hi K,
    Hope you are doing well.

    If you have time, please do let me know if I can be helpful in anyway.
    You may also want to take a look at this post to see how to disable MediaPress for specific roles.
    http://buddydev.com/mediapress-development/mediapress-1-0-1-is-available-now/

    Thank you
    Brajesh

    Plugin Author Brajesh Singh

    (@sbrajesh)

    Hi,
    I am marking it as resolved due to lack of activity. Please feel free to reopen it or create a new topic if you need any assistance.

    Thank you
    Brajesh

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Hide the gallery from specific users (BuddyPress profile)’ is closed to new replies.