Support » Plugin: Toggle Meta Boxes » Super Admin Override

Viewing 1 replies (of 1 total)
  • Plugin Author David Sader

    (@dsader)

    Yeah, something was bjorked in my code there. Needed a fine tuning, tanx.

    You can toggle whether any restrictions apply to the super admin with the first checkbox.

    “Super Admin gets the following limited meta boxes, too?”

    But then you could just toggle the comment editing restriction if you want a temporary workaround – which is what I do.

    The restrictions really only curb authors from editing others’ comments. If they are already an admin of the blog, they can still moderate another’s comments, but the link to edit it is hidden.

    Check for an update soon.

    Here are the code revisions if you want to get ahead of me.

    //Comment Editing Restrictions
    	// http://scribu.net/wordpress/prevent-blog-authors-from-editing-comments.html
    	function ds_network_admin_restrict_comment_editing( $caps, $cap, $user_id, $args ) {
    		$menu_perms = get_site_option( "menu_items" );
    
    		if( !isset($menu_perms[ 'super_admin_mb' ] ) && is_super_admin())
    		return $caps;
    
    		if( isset($menu_perms[ 'comment_edit' ]) ) {
    
    			if ( 'edit_comment' == $cap ) {
    				$comment = get_comment( $args[0] );
    
    			if ( is_super_admin( $comment->user_id ) )
    				$caps[] = 'manage_network'; //NetworkAdmin is only role that can edit this comment - no user can approve or trash it either!
    			if ( ! is_super_admin( $comment->user_id ) && $comment->user_id != $user_id )
    				$caps[] = 'moderate_comments'; //NetworkAdmin, Admins, Editors roles can edit others comments
    			}
    		}
    		return $caps;
    	}
    
        function ds_remove_comment_edit($actions, $comment) {
    		$menu_perms = get_site_option( "menu_items" );
    
    		if( !isset($menu_perms[ 'super_admin_mb' ] ) && is_super_admin())
            return $actions;
    
    		if( isset($menu_perms[ 'comment_edit' ]) ) {
    
            	$user_id = get_current_user_id();
            	if ($comment->user_id != $user_id) {
                	unset($actions['edit']); // edit link appears only on own comments
                	unset($actions['quickedit']); //quickedit may already be toggled for all roles
            	}
    		}
            return $actions;
       }
Viewing 1 replies (of 1 total)
  • The topic ‘Super Admin Override’ is closed to new replies.