Page 1 of 1

Removing the S2member meta-box from Post editor page

PostPosted: February 15th, 2011, 8:14 pm
by dwdutch
I would like to direct my users to the back-end to Add New Post; however, i don't want them to see/access the S2member security meta-box that appears on Post editor page (i.e. the box in which the user can specify restricted levels that can access the post). in my case, this box won't make any sense to my users.

Any suggestions?

Re: Removing the S2member meta-box from Post editor page

PostPosted: February 17th, 2011, 6:35 pm
by dwdutch
anyone?

Re: Removing the S2member meta-box from Post editor page

PostPosted: February 17th, 2011, 8:11 pm
by dwdutch
okay, i made some progress... i found a way to remove the box by adding a the following line in my functions.php:
Code: Select all
   remove_action ("admin_menu", "ws_plugin__s2member_add_meta_boxes");


Next, I tried to nest it in a conditional but it seems the value is not set at the time that functions.php executes.

Code: Select all
if (S2MEMBER_CURRENT_USER_ACCESS_LEVEL > 2){
   remove_action ("admin_menu", "ws_plugin__s2member_add_meta_boxes");
}


Can anyone suggest an alternative?

Re: Removing the S2member meta-box from Post editor page

PostPosted: March 14th, 2011, 10:41 pm
by Jason Caldwell
Thanks for the excellent question.

With s2Member v3.5.3+, create this directory and file:
/wp-content/mu-plugins/s2-hacks.php

Inside the file, do something like this:
Code: Select all
<?php
add_action 
("plugins_loaded", "my_function");
function my_function ()
    {
        if (current_user_can ("access_s2member_level2"))
            {
                remove_action ("add_meta_boxes", "c_ws_plugin__s2member_meta_boxes::add_meta_boxes");
            }
    }
?>

* This code is untested, please use with caution.

Re: Removing the S2member meta-box from Post editor page

PostPosted: June 24th, 2011, 3:24 pm
by doctorproctor
I'd like to do the same thing. I'm confused, however: is this code for a new plugin, s2-hacks.php, that's located in the plugins folder but not inside its own enclosing folder? There must be something I'm missing here.

Thanks,

Jim

Re: Removing the S2member meta-box from Post editor page

PostPosted: June 24th, 2011, 5:44 pm
by Cristián Lávaque
It goes in the /wp-content/mu-plugins/ directory (mu: must use), just create it if it doesn't exist yet.

Re: Removing the S2member meta-box from Post editor page

PostPosted: June 24th, 2011, 9:38 pm
by doctorproctor
Thank you!

Jim

Re: Removing the S2member meta-box from Post editor page

PostPosted: June 24th, 2011, 11:26 pm
by Cristián Lávaque
You're welcome. :)