• Resolved jeanmarcg

    (@jeanmarcg)


    Hi,

    Content control doesn’t seem to work with custom roles. You can check custom roles on the general tab, you can save the rule but when you open the rule again, custom controls are unchecked…

    Is it a bug, a limitation ?
    thanks for your response

    JeanMarc

Viewing 15 replies - 1 through 15 (of 15 total)
  • Thread Starter jeanmarcg

    (@jeanmarcg)

    custom ROLES are unchecked

    Plugin Author Daniel Iser

    (@danieliser)

    @jeanmarcg – Sorry to hear you are having issues. Can you clarify if your second comment was a clarification on the first or something you found after further debugging.

    In general though it should work with custom roles. We call known WP methods of getting the list of roles and use that same list to check against on the front end.

    That said it doesn’t sound like its having trouble getting the list at least for those 2 functions.

    Something you can try is manually filtering your roles in: https://github.com/JunglePlugins/Content-Control/blob/master/classes/Roles.php#L23

    See if that resolves it, if so it likely means they are not registered soon enough for whatever reason.

    Thread Starter jeanmarcg

    (@jeanmarcg)

    Hi,

    my second post was to clarify the first one. In the first post I have written “Custom controls’ instead of “customs roles”.
    In fact I have no problem to get the custom roles list, I can check them and save the rule. But when I open the rule again, custom roles are unchecked…

    any clue ?

    Thanks
    JeanMarc

    Plugin Author Daniel Iser

    (@danieliser)

    @jeanmarcg – Not yet, but I’m sure we can get to the bottom of it. How were the roles added?

    Thread Starter jeanmarcg

    (@jeanmarcg)

    Hi,

    I use the plugin “User Role Editor” to add custom roles.

    Thanks
    JeanMarc

    HEllo @danieliser I see a similar issue, under the “which roles can see this content” section. I have created a custom role, using another plugin. That role does show up (in this case ‘Member-1’), however, when checked, and saved, it does not update the setting. This works if I use a pre-set WordPress role such as “Subscriber” however.

    I have the same problem…

    Thread Starter jeanmarcg

    (@jeanmarcg)

    @danieliser : did you succeed to reproduce the problem ?
    thanks for your response
    JeanMarc

    Having the same problem. No fix?

    • This reply was modified 3 years, 9 months ago by Kizuri.

    I’m not sure if this will help others, but I was experiencing the same problem as the OP, and I’m also using User Role Editor to add/manage custom roles. After a bit of testing, I figured out that it was happening because I had a dash in the roles that I wanted to select (e.g., custom-role). When I created and selected custom roles with underscores (e.g., custom_role) it worked. So, if the roles that aren’t working for you have a dash in them, using underscores instead may provide a work-around until the plugin is fixed.

    Thread Starter jeanmarcg

    (@jeanmarcg)

    thanks @richlivi, my custom roles have a dash in their names indeed. il will try your work-around this day.

    my roles have dashes too
    thank. check it out

    Thread Starter jeanmarcg

    (@jeanmarcg)

    @richlivi your work-around works for me. thanks a lot

    Plugin Author Daniel Iser

    (@danieliser)

    Hey all, the hyphen clue was definitely helpful in both duplicating and tracking it down.

    I’ll see about getting a quick patch out this week.

    So the issue turned out not to actually be in the code we wrote, but rather in a JS library used to serialize the form data for properly sending it over AJAX.

    For some reason, its validation regex pattern didn’t accept a - in the inner key of a field name, in this case roles[custom-role]. Strangely we have used it in multiple projects for years, with over 700k users. Somehow only this specific use case caused an issue.

    I’ve manually corrected it in our bundled copy of that code and it seems to be working now with those custom roles.

    Sorry for the confusion and appreciate the help reproducing the issue, we’ve never been able to do that prior to now.

    Thread Starter jeanmarcg

    (@jeanmarcg)

    @danieliser : thanks for the fix (V 1.1.5). All is working fine now.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Custom roles’ is closed to new replies.