Publishers who can not create Administrators

I have long recommended the use of Members a fantastic plugin, to properly manage WordPress capabilities and roles, but there are times when it is not perfect, it has its nuances, I mean … [19659002] It is quite common to modify, once installed, some user profile (we are always talking about multiuser sites) so that, in turn, you can add other users. The idea is to build a collaborators structure in which someone, usually the Editor not only reviews the content created by users with profile of Contributor and Author but also can make " responsible for human resources " and add, modify and delete user profiles and their capabilities.

Well, with Members we can do all this but there is a catch and is that when we assign to a user profile the ability to create and / or modify users you can also create and / or modify users with Administrator profile, with the danger that this entails but check the table of Profiles and Capabilities of WordPress .

Fortunately, everything has a solution, so if this is your case (mine if it is, then I manage a network of blogs with multiple user profiles), you just have to acer esto:

  1. Instalas y activos Members
  2. Choose (or create) a user profile to which you will add the capabilities to create, modify, delete, change profiles and users


  3. Add this code to the file functions.php of your active topic:
     class JPB_User_Caps {
    
      // Add our filters
      function JPB_User_Caps () {
        add_filter ('editable_roles', array (& $ this, 'editable_roles'));
        add_filter ('map_meta_cap', array (& $ this, 'map_meta_cap'), 10.4);
      }
    
      // Remove 'Administrator' from the list of roles if the current user is not an admin
      function editable_roles ($ roles) {
        if (isset ($ roles ['administrator']) &&! current_user_can ('administrator')) {
          unset ($ roles ['administrator']);
        }
        return $ roles;
      }
    
      // If someone is trying to edit or delete and that user is not an admin, do not allow it
      function map_meta_cap ($ caps, $ cap, $ user_id, $ args) {
    
        switch ($ cap) {
            case 'edit_user':
            case 'remove_user':
            case 'promote_user':
                if (isset ($ args [0]) && $ args [0] == $ user_id)
                    break;
                elseif (! isset ($ args [0]))
                    $ caps [] = 'do_not_allow';
                $ other = new WP_User (absint ($ args [0]));
                if ($ other-> has_cap ('administrator')) {
                    if (! current_user_can ('administrator')) {
                        $ caps [] = 'do_not_allow';
                    }
                }
                break;
            case 'delete_user':
            case 'delete_users':
                if (! isset ($ args [0]))
                    break;
                $ other = new WP_User (absint ($ args [0]));
                if ($ other-> has_cap ('administrator')) {
                    if (! current_user_can ('administrator')) {
                        $ caps [] = 'do_not_allow';
                    }
                }
                break;
            default:
                break;
        }
        return $ caps;
      }
    
    }
    
    $ jpb_user_caps = new JPB_User_Caps (); 
  4. You save the changes and You're done! now the new user profile will be able to create and modify profiles but you will not be able to create administrators or modify their profiles to not to be, in turn, administrator

Enjoy it!

What you read is an original content of Help WordPress – Resources, themes, plugins and tutorials in Spanish and published it Fernando Tellado first here: Editors who can not create Administrators

Roles and capabilities

It is not the first time that we talk about Profiles and Capabilities in WordPress I have even talked about how to manage them, but I thought that we had to give a little more light in this matter, and for that I have created a table in which you will understand better what each type of user can do in WordPress for the capacities assigned to it.

As you already know, native WordPress capacity management is not the best of the world, and surely more than once you've wanted to assign extra capabilities to a profile without having many others (you just have to look at the table in the huge jump that there is of Author to Editor ), and since everything has a solution, if this is the case, how will you best take advantage of the information in this table, and you will be able to properly manage profiles and capabilities in WordPress I recommend you use the plugin Members which supplements ta lack.

Well, here is the table, I hope it helps to clarify a bit this issue of the Profiles and Capabilities in WordPress . Its use is simple, on the left you have the list of capabilities with its explanation to its right, and in the column of each type of User Profile if there is a logo in the cell it has the capacity of the first column …

Leave messages to your collaborators

If you have a collaborative site, it's a good idea to leave messages to the rest of the authors of your WordPress . You can do it in many ways but a very simple one, for messages that you want to have always present, would be the following:

There are two variables that you can / should change. The first, obviously, is the text to be displayed, and the second is what kind of users, depending on their capabilities will see the message, in this case the author's profile ( edit_posts ]), you can even use several messages depending on the type of user profile.

What's New in WordPress 3.1 • WordPress Help

The new version, WordPress 3.1 which is expected to launch in mid-December (this year) will have a few novelties, not big changes like the redefinition of " ] profiles and capabilities "of users, but some interesting advances.

In short, which is only an advance, surely from now until December we see more possible improvements. Personally I like everything proposed, even leaving in the bedroom still interesting improvements (in my view) as …

Create author and publisher surveys, not just admin • WordPress Help

 wp-polls "title =" wp-polls "width =" 150 "height =" 150 "class =" alignright size-thumbnail wp -image-5375 "srcset =" http://bootstrapx.com/wp-content/uploads/2018/07/wp-polls-150x150.png 150w, https://ayudawp.com/wp-content/uploads/2009 /06/wp-polls-60x60.png 60w "sizes =" (max-width: 150px) 100vw, 150px "/> </p>
<p> The other day I explained <a href= how to use the WP-Polls poll plugin , but this plugin has a "defectillo", and that is that only allows to create and manage surveys to the administrator user of WordPress, a silly mistake.The "normal" users (authors and editors) of a WordPress can only insert surveys but what sense does it have if the surveys have to be created by the administrator and provide the ID of the same to the authors? it seems totally unproductive.

Fortunately everything has a solution in WordPress and I found three ways to skip this restriction :

1. Modify the code of the plugin

This is a simple solution "a priori" you just have to open the file wp-polls.php of the plugin folder and replace this line …

for this another …

Only that does not always work, try and if it works perfect.

2. Modify in depth the code of the plugin

This other solution, proposed in the support forums of WP-Polls goes through a deep modification of some aspects of the plugin files, allowing to define more finely what each type of user can do

But bad news does not always work either.

3. Role Manager

I will not tire of recommend this plugin . And, in addition to its undeniable utility for a complete management of WordPress user profiles, it also integrates with other plugins that depend on these roles . Of course, also with WP-Polls.

Activating the creation and administration of surveys to authors and editors is as easy as going to " Users -> Roles " and in the supersubscribed profiles click on the "Manage polls" box. From that moment, users with an Author and Editor profile can create, manage and, of course, insert WordPress surveys.
 author-manage-polls "title =" author-manage-polls "width =" 500 " height = "216" class = "aligncenter size-medium wp-image-5374" srcset = "http://bootstrapx.com/wp-content/uploads/2018/07/author-manage-polls-500x216.png 500w, https://ayudawp.com/wp-content/uploads/2009/06/author-manage-polls.png 966w "sizes =" (max-width: 500px) 100vw, 500px "/> </a> </p>
<p> Which one do you choose? </p>
<div id=

Loading …

That may also help you: