Support » Plugin: BP Activity Share » Admin only share

  • Hi,

    Is there a way to set user capabilities with this plugin? I want the share option only available to Admin users.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Perhaps there’s a way to integrate this with the capabilities manager plugin? Then the role permissions for this plugin could be controlled via the capabilities manager plugin.

    Another thought, instead of hooking into the capabilities manager plugin, can we add a function to the functions.php file of a child template to hide or disable this plugin for all user roles except Admin.

    I assume that way the share option won’t show to user’s who don’t have an Admin user role.

    perhaps something like this:
    https://wordpress.stackexchange.com/questions/246704/disable-plugins-for-a-specific-user-role

    If this helps anyone else looking for this, I used the code below:

        /**disable the BP Activity share for all except admin**/
        add_action('admin_init', 'my_filter_the_plugins');    
        function my_filter_the_plugins()
        {
            global $current_user;
        if ( in_array('participant', $current_user->roles) || in_array('subscriber', 
        $current_user->roles) ) {
                deactivate_plugins( // deactivate for participant and subscriber
                    array(
                        '/bp-activity-share/bp-activity-share.php'
                    ),
                    true // silent mode (no activation hooks fired)
               );
            } else { // activate for those than can use it
                activate_plugins(
                    array(
                        '/bp-activity-share/bp-activity-share.php'
                    ),
                    '', // redirect url, does not matter (default is '')
                    false // network wide)
                );
            }
        }

    The above ‘Solution’ doesn’t seem to work as expected. It seemed to work on my test site but didn’t work on the live site for some reason.

    It would be great to get some input/feedback from the developers of this module.

    Thanks

    Plugin Author Sanket Parmar

    (@sanketparmar)

    Hi @nakes,

    Sorry for the delayed follow-up. I hope you are doing great. 🙂

    We’ll definitely try to find the proper solution to your query and get back to you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Admin only share’ is closed to new replies.