WordPress.org

Ready to get started?Download WordPress

Forums

User Role Editor
[resolved] Can't Add New Capability (7 posts)

  1. slimandslam
    Member
    Posted 2 years ago #

    When I go to the "Add New Capability" box and try to add the capability "12month", I get an error message from URE that says:

    "Capability Name must contain digits and latin characters only!"

    Of course, "12month" only contains digits and latin characters, so why is there an error message?

    J

    http://wordpress.org/extend/plugins/user-role-editor/

  2. Vladimir Garagulya
    Member
    Plugin Author

    Posted 2 years ago #

    Try 'month12' and you will get success with it. URE checks that capability name be valid programming language identifier, that is starts from the letter, not from the digit.

  3. slimandslam
    Member
    Posted 2 years ago #

    Hi Vladimir,

    I don't understand. A custom capability identifier is just a string, not a
    programming language identifier, right? I can create the custom capability string
    "12month" and store it just like any other string. Why would it need to
    be a programming language identifier?

    Jason

  4. Vladimir Garagulya
    Member
    Plugin Author

    Posted 2 years ago #

    Hi Jason,

    Possibly you are right, and such limitation could be seen as excessive or redundant.
    I followed existing WordPress standard capabilities names when wrote user input validation rool for capabilities names, as for the roles names too. You can discover that URE doesn't allow to input role names with spaces inside. You never know where it could fire, in WordPress version 3.5 or 4.1. Just see that standard WP capabilities is not started from digits, and doesn't contain spaces or hyphens inside, etc. That's why I consider to not allow extend that.

    Regards,
    Vladimir.

  5. slimandslam
    Member
    Posted 2 years ago #

    Hi Vladimir,

    Not allowing spaces makes perfect sense.

    However, as you can see from the WordPress add_cap() function,
    custom capabilities in WordPress are just strings:

    http://codex.wordpress.org/Function_Reference/add_cap

    So, it's reasonable to allow any combination of numbers, upper-case letters, and lower-case letters.

    Please update your plugin accordingly.

    Thanks,

    J

  6. Vladimir Garagulya
    Member
    Plugin Author

    Posted 2 years ago #

    Hi Jason,

    Try version 3.7. I allowed to use any combination of letters, digits, hyphens and underscores for role and capability names.

    Regards,
    Vladimir.

  7. slimandslam
    Member
    Posted 2 years ago #

    Thanks!

    J

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.