Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using the latest wordpress 3.2.1. I would like to let create a new admin to do ONLY this: 1) Manage order to change the order status to (e.g. approve..reject). 2) Able to view user only without the ability to Edit or Delete. 3) Accept email notification on new registered user and new order.

This would meant that when this new admin login, he is able to view only these 3 menu and All other menu will be invisible. Could anyone advice? I have tried many like the Adminimize, Admin Menu Editor, hide-admin-panels.. But all don works as it is a role based instead of user based.

Should i create a new admin for these features above? or should i create an editor instead ? Then change the menu for editor.. I need your advice. thanks

share|improve this question
add comment

2 Answers

you can create a new role and set the manage-posts to it so he could approve/reject posts then you can remove menu features as you like with this function:

function remove_menus () {
global $menu;
$user = wp_get_current_user();
    if ($user->ID == 2) { // change user ID,

        $restricted = array(__('Dashboard'), __('Posts'), __('Media'), __('Links'), __('Pages'), __('Appearance'), __('Tools'), __('Users'), __('Settings'), __('Comments'), __('Plugins'));
        end ($menu);
        while (prev($menu)){
            $value = explode(' ',$menu[key($menu)][0]);
            if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
        }
    }
}
add_action('admin_menu', 'remove_menus');

and for him to receive email notification on new registered user you can overwrite the wp_new_user_notification() function:

if ( !function_exists('wp_new_user_notification') ) {
    function wp_new_user_notification($user_id, $plaintext_pass = '') {

            $user = new WP_User($user_id);

            $user_login = stripslashes($user->user_login);
            $user_email = stripslashes($user->user_email);

            // The blogname option is escaped with esc_html on the way into the database in sanitize_option
            // we want to reverse this for the plain text arena of emails.
            $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);

            $message  = sprintf(__('New user registration on your blog %s:'), $blogname) . "\r\n\r\n";
            $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
            $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";

            //email admin
            @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);

            //email new editor
            @wp_mail('USER_EMAIL_HERE', sprintf(__('[%s] New User Registration'), $blogname), $message);
            if ( empty($plaintext_pass) )
                    return;

            $message  = sprintf(__('Username: %s'), $user_login) . "\r\n";
            $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
            $message .= wp_login_url() . "\r\n";

            wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message);
    }
}

change USER_EMAIL_HERE to his email

share|improve this answer
    
Thanks so much for the reply. The "manage order" i mentioned above is referring to the Ecommerce new product order. May i know where should i put the @wp_mail.. code to let the new admin to receive the new order alert? Also, your code $restricted = array(__('Dashboard'),... is great, but i think it would hide the whole dashboard including the manage order page? The manage order page i referred to is the page where admin can change the order status to "pending, approve, shipping, cancel..." Please advice. Thanks for the help –  belinq Jul 25 '11 at 0:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.