Page 1 of 1

Code To Remove For Post Restriction Box

PostPosted: July 4th, 2011, 8:48 pm
by Vinnyo
Hey Guys,

Looking for the code I need to remove to get rid of the post restriction box that is located in the ADD NEW post area. The box is located on the right side at the top of the column

Post Level Restriction?
Add Level Restriction?
* see: General Options -> Post Level Access

Require Custom Capabilities?
Custom Capabilities?
* see: API Scripting -> Custom Capabilities

Sorry I am too lazy to take a picture of it but the above info is in the box with the fields left empty of adjusting.

Hope that makes sense. I just want to remove this box so my users don't see it.

All the best
Vince

Re: Code To Remove For Post Restriction Box

PostPosted: July 4th, 2011, 9:23 pm
by Vinnyo
OK I found this topic

viewtopic.php?f=4&t=2313&p=6855&hilit=remove+meta+box#p6855

its exactly what I am trying to do. I created and mu-plugins folder, created a s2-hacks.php file, and inserted the code


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");
                }
        }
    ?>



hit update and the meta box is still there. Any ideas of what I might be doing wrong?

Re: Code To Remove For Post Restriction Box

PostPosted: July 5th, 2011, 12:33 am
by Cristián Lávaque
The condition there checks for Level 2 users only. If you no one but you to see it, try this

Code: Select all
<?php

add_action 
("plugins_loaded", "my_function");
function my_function ()
{
    if (!is_admin())
        remove_action ("add_meta_boxes", "c_ws_plugin__s2member_meta_boxes::add_meta_boxes");
}

?>