WordPress.org

Ready to get started?Download WordPress

Forums

Extended Super Admins
[resolved] can't delete added roles (27 posts)

  1. RavanH
    Member
    Posted 3 years ago #

    Hi,

    Testing the dev version 0.4a (on a 3.1RC4 install with ONE super admin) I find that I cannot delete any roles I. It just keeps adding more...

    Steps:
    1. Check on /wp-admin/network/settings.php?page=esa_options_page some capabilities and hit "Save and Add another"
    2. After the page reloads, there is a new grey area above that one with the title "New Role" but this new area can not be folded open or close and shows only "Would you like this role to be deleted?" with a checkbox beside it.
    3. Place a checkmark in that checkbox and hit "Save and Add another" again.
    4. Now there are TWO of those anonymous grey beams at the top. Indistinguishable from each other and not removable...

    For what it's worth: the capabilities that I had initially checked to be removed have indeed gone for this super admin :)

    http://wordpress.org/extend/plugins/extended-super-admins/

  2. RavanH
    Member
    Posted 3 years ago #

    Okay... I see why these grey bars are anonymous. I had not filled in a name. When putting a name in the name field and saving, there will be a bar with that name and it will open a pane with the settings when clicked the ones without a name cannot be opened or edited.

    And still no way to delete any of them...

    I suggest that an empty name field in the New Role section will result in NO new role. And renaming the button simply to the WP default "Save Changes" with maybe some warning message saying a name needs to be defined before any new role is added.

  3. Curtiss Grymala
    Member
    Plugin Author

    Posted 3 years ago #

    Interesting. Thanks for the feedback. I do have it set up so that it doesn't save completely empty new roles; but you're right that it should return an error if the role name is blank, rather than saving it without a name. Still, it's odd that you can't delete the empty roles. That seems to be a slightly different issue that I'll need to investigate.

  4. RavanH
    Member
    Posted 3 years ago #

    It's not only the empty roles that I cannot delete. Also deleting a role with a name seems impossible. And each attempt will create a new role (without name) ...

    Or am I missing something here? I check the Delete this role box(es), then hit the Save and Add Another button...

  5. Curtiss Grymala
    Member
    Plugin Author

    Posted 3 years ago #

    What you're doing should be the way it works.

    When you go to the page, you should see one box at the bottom of the list that says "New Role" (and won't have a "Delete this role" checkbox next to it); as that's what you use to create a new role. However, you should not be getting multiple roles without names, nor should the existing role you deleted be replaced with empty roles.

    I'll be investigating this issue tomorrow or over the weekend. Thanks for your help and your feedback.

  6. RavanH
    Member
    Posted 3 years ago #

    as i said, there is never any role deleted. there just keep getting more empty ones created...

    maybe this is because i initially crippled the one and only super admin on this test install by limiting some of the capabilities and then saving the settings without any name?

    i'll do some testing with a new super admin...

  7. RavanH
    Member
    Posted 3 years ago #

    nope, same with a clean super admin: i cannot delete any roles...

  8. Curtiss Grymala
    Member
    Plugin Author

    Posted 3 years ago #

    Okay. I think I've found the main issue. If you are using Networks for WordPress (or, presumably, WPMN) and you try to modify the Extended Super Admins settings from a network that doesn't have that plugin activated (so, for instance, one of the new networks you created), this issue crops up.

    Therefore, in order to avoid this issue, for now, my recommendation would be to only modify the Extended Super Admins settings from your original network. I'll continue to investigate to see if I can find a better solution.

    To begin with, though, you'll probably need to remove all of the Extended Super Admins settings from the database. If you're comfortable working with your database backend, you can search your wp_sitemeta table for any items with a meta_key of "extended_super_admins" and delete those rows. Then, visit the Extended Super Admins settings page in your original network and make the changes.

  9. RavanH
    Member
    Posted 3 years ago #

    Hmm... in my case I am modifying from the main (original) network... I have already tried deleting the extended_super_admins entries from the DB to start fresh but the same thing happens all over again even if I take care to give the roles a name.

    I'll test with the plugin in /mu-plugins/ to see if that changes anything.

  10. Curtiss Grymala
    Member
    Plugin Author

    Posted 3 years ago #

    I think I might have found the problem. I've updated the development version again. If you can, please download the development version again (as mentioned before, give it about 30-60 minutes from the time I'm posting this before downloading the new version) and test it out.

    When viewing the plugin in the list of plugins, I've added a new link to delete the Extended Super Admins settings (hopefully that will work for you), which means you shouldn't have to modify your database manually anymore in order to start over from scratch.

    I've also modified the user interface a little bit, hopefully making it a little more obvious how roles should be added or modified (though, more suggestions are always welcome).

    I've modified the plugin so that, if you try to save a new role without a name, that role doesn't get saved. Instead, you see an error message letting you know that it wasn't saved.

    Also, as I mentioned, I have hopefully fixed the issue with trying to delete roles. Thank you for continued help testing and fixing this plugin.

  11. Curtiss Grymala
    Member
    Plugin Author

    Posted 3 years ago #

    I've gone ahead and committed the 0.4a branch as the current stable version. Hopefully I've fixed all of the issues you were encountering. Please let me know if you come across any other issues.

  12. RavanH
    Member
    Posted 3 years ago #

    I'm afraid it's still happening. I see the difference on the settings page and I can now open entries without a name (with that + sign) but deleting is still not possible. And trying to will result in an extra new role without name being created... And I can not see a link on the plugins page to clear the settings from the DB. Only "Network Activate" or "Network Deactivate" (the other links for enabling across all mutliple networks have gone, is that correct?) ...

    I'm going to do a complete clean WP and plugin install to start fresh and see if that will change any thing.

  13. RavanH
    Member
    Posted 3 years ago #

    Another thing I notice (making it a bit difficult to test with) is that when on Network > Settings > Extended Super Admin I get 100% CPU usage for a really long time before I can change or commit anything there. And the side menu roll-up/down function does not work anymore. I see no errors in my javascript console but still, it must be some conflict with the extended_super_admins.js as it does basically the same thing as the admin menu panes... What if you make Extended Super Admins use the same scripts and markup as any other WP back-end pane like on the Dashboard for example?

  14. RavanH
    Member
    Posted 3 years ago #

    UPDATE: I wiped the DB, did a clean install (upgrading to the latest WP3.1 from SVN) and only activated Extended Super Admins. I used another browser when editing the Extended Super Admin page: Google Chrome instead of Opera 11. The 100% CPU is there but only a very short time. Chrome aparently has less trouble there but sadly the problem with being unable to delete any roles and just getting more empty ones in return is still persistent...

    If you want to take a look yourself, create an account on http://aufildudoux.com/wp-login.php?action=register , let me know your username and I'll promote it to Super Admin.

  15. Curtiss Grymala
    Member
    Plugin Author

    Posted 3 years ago #

    That's weird that you're getting that, but I'll look into it. The javascript is actually doing more than just the expand/collapse, but it's a good idea to try to hook into the existing script for that part of the function.

    Just out of curiosity, what browser are you testing in? I've tested in Chrome (my primary browser), Firefox and IE, and I can't seem to reproduce the issue you're noticing. The browser does freeze for a split-second (most likely while it's hiding all of the Codex information and setting up the jquery-ui-dialog items - that's the bulk of what's done with JavaScript), but then everything starts working again. I wonder if it's possible that another plugin is interfering with this one.

    I am also thinking it might be a good idea for me to allow the user to enable/disable the Codex information (there's no need to retrieve it or to use JavaScript to manipulate it if the user doesn't want it there in the first place).

    Regarding the links, that seems to be indicating that the plugin isn't detecting the plugin you're using to create multiple networks (which I think is also what's causing the error in deleting roles). The code I wrote should be detecting the WPMN/NWP plugin, but it seems to be failing somewhere along the way in some situations (since releasing the updated version, I've found the issue you describe on one of my test installations).

    I'll keep looking into all of these issues.

    EDIT - I see you were posting another post while I was writing this. I've registered as cgrymala on the site you provided. I'll also check out the plugin in Opera, since you indicated that's the browser you're using.

  16. RavanH
    Member
    Posted 3 years ago #

    cross-posting there... see my previous response (6 minutes ago) for the current situation (no multi-networks just one plugin active) and browser (opera) :)

  17. Curtiss Grymala
    Member
    Plugin Author

    Posted 3 years ago #

    We cross-posted again. :) See my edit to my previous post.

    Thanks for all of your help and your patience in getting this thing working the way it should.

  18. RavanH
    Member
    Posted 3 years ago #

    You are now super admin :)

  19. RavanH
    Member
    Posted 3 years ago #

    I'm suddenly seeing lots of entries in the PHP error log like:

    [15-Feb-2011 19:59:23] PHP Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /xxx/xxx/test/wp-content/plugins/extended-super-admins/class-extended_super_admins.php on line 341

    And it looks like they occur when trying to delete a role...

  20. Curtiss Grymala
    Member
    Plugin Author

    Posted 3 years ago #

    Thanks for the updates.

    I believe I've found the cause of the issue again, and am currently looking into a solution. It seems that the issue is sprouting from the fact that no capabilities were selected for the role, but it would probably occur if no users were selected, as well. I'm working on trying to get that issue fixed.

    I also added a check for the item on line 341 to make sure the item is an array before trying to use the array_key_exists() function so that should eliminate that part of the issue.

    Finally, I figured out that I forgot to add the "Delete Settings", etc. links to Network Admin area in WP 3.1, so I've fixed that issue (I edited the plugin's files on your test server to address that issue).

    I'll update this topic once I figure out how to fix the main issue.

  21. Curtiss Grymala
    Member
    Plugin Author

    Posted 3 years ago #

    Okay. Problem seems to be fixed on your installation, now. The root of the problem was the fact that the register_setting() function is not available during the init action when you're in the Network Admin area of WP 3.1. Therefore, the sanitization callback was not being invoked when adding or updating the site option.

    I've fixed that issue by manually adding a sanitization filter if the register_setting() function is not available.

    I also put in checks to make sure the "role_members" and "role_capabilities" options are filled with empty arrays if they don't have any explicit settings. That way, they should still work the way they would if they had explicit settings.

    I'll probably release v0.5a to the public either this evening or tomorrow morning, which includes all of the fixes mentioned in this thread. I'm going to try to look into the JavaScript issues before releasing it, though.

    If you notice the issue popping back up again, or you notice any other issues that we haven't already discussed, please let me know and I'll investigate.

    I have updated the development version in the repository. That version should match the version you have on your test server already.

  22. RavanH
    Member
    Posted 3 years ago #

    Excellent! As far as i can tell, it's all working now :)

    About the 100% CPU issue: it looks like there is only 100% CPU for about a second when there are no roles defined but as soon as I start adding new roles, the 100% CPU time increases in leaps...

    But that seems to be the only issue left so: Great work!

  23. Curtiss Grymala
    Member
    Plugin Author

    Posted 3 years ago #

    Very cool.

    I'm getting ready to release 0.5a as the next stable version (the exact version you have on your install right now), but I also spent a lot of time this morning creating the new development version (0.6a), which completely reworks the way the admin page is built (utilizing the built-in meta-box interface, as you suggested, and modifying the JavaScript quite a bit).

    Version 0.5a will go live as the new stable version in a little while, and version 0.6a will become the new development version.

    Thanks again for all of your help on these issues.

  24. RavanH
    Member
    Posted 3 years ago #

    installing the dev version in the test site right now :)

  25. RavanH
    Member
    Posted 3 years ago #

    although the 100% CPU issue is much less in 0.6a than before, it still increases after adding new roles. about 10 roles further, its up to 30 seconds in opera 11 ... but as i said, that's much better then before :)

    i suppose it's that codex info hiding stuff that takes more time as more roles get added. maybe if you only show the codex info on the Add New Role dialog?

    it's sad the boxes do not remember their position (open or closed) like they do on the dashboard for example... no clue which script you need to load for that. i have tried that for one of my own plugins but never found out how. but it would be a great feature ;)

    anyway, it's not a real problem and i suppose 10 roles is more than anyone needs so i say: skip 5a and go straight to 6a for public release :)

  26. Curtiss Grymala
    Member
    Plugin Author

    Posted 3 years ago #

    Awesome news.

    I know there's still some work to be done on cleaning up the way the JavaScript manipulates the Codex info (that will be the big thing to straighten out before making an official 1.0 branch), but I'm glad the issue has improved significantly.

    6a will probably be released tonight or tomorrow (hopefully I'm not pissing off the other people that have the plugin installed by releasing so many updates in a row). :)

  27. Curtiss Grymala
    Member
    Plugin Author

    Posted 3 years ago #

    New version is out (had to fix a compatibility issue with WP 3.0.5 before releasing it as stable). Thanks again for all of your help.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic