PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Removing the S2member meta-box from Post editor page

s2Member Plugin. A Membership plugin for WordPress®.

Removing the S2member meta-box from Post editor page

Postby dwdutch » February 15th, 2011, 8:14 pm

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?
User avatar
dwdutch
Registered User
Registered User
 
Posts: 24
Joined: January 16, 2011

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

Postby dwdutch » February 17th, 2011, 6:35 pm

anyone?
User avatar
dwdutch
Registered User
Registered User
 
Posts: 24
Joined: January 16, 2011

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

Postby dwdutch » February 17th, 2011, 8:11 pm

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?
User avatar
dwdutch
Registered User
Registered User
 
Posts: 24
Joined: January 16, 2011

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

Postby Jason Caldwell » March 14th, 2011, 10:41 pm

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.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

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

Postby doctorproctor » June 24th, 2011, 3:24 pm

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
User avatar
doctorproctor
Registered User
Registered User
 
Posts: 37
Joined: May 18, 2011

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

Postby Cristián Lávaque » June 24th, 2011, 5:44 pm

It goes in the /wp-content/mu-plugins/ directory (mu: must use), just create it if it doesn't exist yet.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

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

Postby doctorproctor » June 24th, 2011, 9:38 pm

Thank you!

Jim
User avatar
doctorproctor
Registered User
Registered User
 
Posts: 37
Joined: May 18, 2011

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

Postby Cristián Lávaque » June 24th, 2011, 11:26 pm

You're welcome. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: No registered users and 1 guest

cron