latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Blocking access to dashboard for users

Home Forums Community Forum Blocking access to dashboard for users

This topic contains 2 replies, has 3 voices. Last updated by  Erik Kampe 4 years, 6 months ago.

Topic Author Topic
Posted: Thursday Jun 21st, 2012 at 6:23 am #17081

In all your pre-sales literature I did not see anything stating that S2Manager would block all access to the dashboard for everyone except administrators. I found a support thread that mentioned role editor, and I tried it but that does not fix it because you block everyone except admin.

What file do I need to hack to allow access back to the dashboard? I like everything else about your software but my users need to access a plugin, that was the only content I needed to regulate membership access to. If there is no way to get around the dashboard block, I would kindly ask for a refund as it would not be possible for me to operate with it.

List Of Topic Replies

Viewing 2 replies - 1 through 2 (of 2 total)
Author Replies
Author Replies
Posted: Thursday Jun 21st, 2012 at 8:27 am #17119

Hi Tony.

s2Member doesn’t manage access to the admin side at all. Your users, when given an s2Member Level, get a WP role for that s2Member level. Even without s2Member, a regular user would not get access to the plugins in the admin side, that’s the default behavior.

Sometimes plugins give access to their settings page if the user has a certain WP capability. I don’t know if that’s the case with that plugin you’re using, but if it is, you could add that capability to the s2Member role the users get. http://wordpress.org/extend/plugins/user-role-editor/

I hope that helps. :)

Posted: Thursday Jun 21st, 2012 at 9:53 am #17126
Erik Kampe
Username: kampester

Hi Tony,

I had a similar need in controlling the WP-Admin bar…. in my case I wanted to hide elements in the admin-toolbar…. but you can use the same logic using the WP function add_node () and remove_node() to gain control over what to users can see.

I used the following code in my custom functions file located in the mu-plugin folder:

////////////////////////////////////////////////////////////////////////////////
//Kampester Custom function Adapted For MU Buddypress Newtwork  - New function
////////////////////////////////////////////////////////////////////////////////


function admin_bar_remove_this(){
     global $wp_admin_bar;
    if(!is_super_admin()){
     $wp_admin_bar->remove_node('blogs-menu');
    $wp_admin_bar->remove_node('account-menu');
    $wp_admin_bar->remove_node('new-content');
    $wp_admin_bar->remove_node('my-sites');
       }
        $wp_admin_bar->remove_node('wp-logo');
           }
        add_action('wp_before_admin_bar_render','admin_bar_remove_this');

To start I used this function to get a entire list of all the nodes available in my install – this code will place menu item in your admin-bar that you can use to identify the elements naming convention. I got the code from the WP codex….

Hope this helps.

add_action( 'wp_before_admin_bar_render', 'add_all_node_ids_to_toolbar');
 
 function add_all_node_ids_to_toolbar() {
 
   global $wp_admin_bar;
   $all_toolbar_nodes = $wp_admin_bar->get_nodes();
       
   if($all_toolbar_nodes){
   
     // add a top-level Toolbar item called "Node Id's" to the Toolbar
     $args = array('id' => 'node_ids', 'title' => 'Node ID\'s');
     $wp_admin_bar->add_node($args);
     
     // add all current parent node id's to the top-level node.
     foreach ( $all_toolbar_nodes as $node  ) {
       if(isset($node->parent) && $node->parent){
       
         $args = array(
           'id' => 'node_id_'.$node->id, // prefix id with "node_id_" to make it a unique id
           'title' => $node->id,
           'parent' => 'node_ids'
           // 'href' => $node->href,
         );
         // add parent node to node "node_ids"
         $wp_admin_bar->add_node($args);
       }
     }
     
     // add all current Toolbar items to their parent node or to the top-level node
     foreach ( $all_toolbar_nodes as $node  ) {
     
       $args = array(
         'id' => 'node_id_'.$node->id, // prefix id with "node_id_" to make it a unique id
         'title' => $node->id,
         // 'href' => $node->href,
       );
       
       if(isset($node->parent) && $node->parent){
         $args['parent'] = 'node_id_'.$node->parent;
       } else {
         $args['parent'] = 'node_ids';
       }
       
       $wp_admin_bar->add_node($args);
     }
   }
 }
Viewing 2 replies - 1 through 2 (of 2 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.