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
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.
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
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
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
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