• Resolved 21stcn

    (@21stcn)


    Hi there.

    I am overwhelmingly confused by trying to set conditions for events based on roles. Let’s take an example.

    I want points to be awarded to a user when they comment IF they are a subscriber OR a contributor. So I would think to set it up as follows (image reference: https://imgur.com/pSTp6hh):

    Award to
    Comment > Author

    Conditions
    Comment ? Author ? Roles
    Contains
    Minimum: 1 (meets minimum of 1 role below?)
    Maximum: 2 (meets maximum of 2 role below?)

    Conditions
    Role Equals Subscriber
    Role Equals Contributor

    If I set minimum to 0, EVERY user type is awarded points for commenting.
    If I set minimum to 1, NO points are awarded regardless of role.

    What is the point of the Contains integers and conditions for roles if the above settings don’t do anything? I just want to know how to do a user OR operator which I can’t seem to make happen.

    The only other way i can think to do it is to add a new reaction for each user type (ie: create “Comment on a post” reaction for each user seperately, but then what is the point of Comment ? Author ? Roles conditions in the first place?

    PS: Users in WordPress cannot have multiple roles as the documentation seems to suggest. Users can have a single role but roles can have multiple capabilities.

    • This topic was modified 7 years, 7 months ago by 21stcn.
    • This topic was modified 7 years, 7 months ago by 21stcn.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author J.D. Grimes

    (@jdgrimes)

    Hi @21stcn,

    I’m sorry that this is confusing. Part of the problem is that really only AND conditions are supported, OR conditions is a feature that is still planned to be added.

    Technically, in WordPress a user can have multiple roles. This isn’t really exposed in WordPress’s native role management UI, but the underlying code does allow for it, which is why WordPoints treats it as if a user can have multiple roles.

    The min and max mean “user must have min/max number of roles matching these conditions.” So all of the conditions there will be applied to each of the roles that the user has, and if at least one role matches those conditions, then the points will be awarded (if the minimum is one).

    The reason that none match is because when you add multiple conditions they are treated as AND conditions. A user can’t have a role that is both Subscriber AND Contributor, so no users match the condition and thus no users are awarded.

    So really, I guess it is not possible achieve what you want to in WordPoints yet, without some code. Or, like you say, you would need to reactions, one to award points to subscribers, and another one to award points to contributors. I’m sorry for that inconvenience.

    These are all features that I plan to add soon, so I’ll keep this in mind and try to make it a higher priority. Perhaps you also wouldn’t mind sharing some more details about your use-case and what you’re trying to achieve, as this will also help me to decide how to build these features.

    Thread Starter 21stcn

    (@21stcn)

    Thanks for the reply and the detailed explanation.

    The use-case is pretty standard I would have thought: you want some user types to receive points in certain instances, some not to. I am working on a blog which has content creators/managers (Editors and Authors) who publish about two posts a day, and then consumers (Subscribers and Contributors) who comment and interact with the blog. If a Subscriber OR a Contributor comments, they get points — the freedom to make this type of basic assignment seems implicit in the plugin.

    I am using Wordpoints to reward the consumers for visiting the blog and commenting (and eventually buying though WC etc.) but don’t want to dish out the same points to the content creators, who I want to give points of the same type, but not for the same things. I suppose I could just let the system give points to the creators and not display them and then create a new points type for creators (even though some points should overlap between types), but it seems like the wrong way to go about it.

    If you have the situation where you need to create duplicate reactions for each user type, it seems to undermine the effectiveness of the plugin, especially in multi/site setups with lots of roles. For a single reaction, such as posting a comment, you might have 4 entries to cover your roles, multiplied by any other comment related action, such as replying to a comment. The points type screen would become a mess and updating point quantities/descriptions becomes an administrative headache because the values are all the same, just the user roles are different.

    But I am just diving into the plugin and will make it work one way or another. I just wanted to check that I wasn’t missing something obvious here. I would think having the ability to have an OR operator for user roles would be quite a popular request going forward (the ACF conditional logic system is a pretty good one for reference). Assign point for visiting the site.. to who? Subscribers and Contributors. Done.

    All that said, the plugin is fantastic and I really appreciate its quality and the work you’ve put in. If things go according to plan, I’ll be purchasing at least the WooCommerce module (which reminds me, page of the modules is currently inaccessible: https://wordpoints.org/modules/page/2/ ). So thanks again for the plugin and your assistance.

    Plugin Author J.D. Grimes

    (@jdgrimes)

    Thank you for the detailed explanation. Yes, this does seem like a common use-case. I’ll work to get this feature in soon (probably in 2.5.0, likely sometime before the end of the year).

    Thank you also for your kind words regarding the quality of the plugin. That is something that I strive for, and it is always good to hear when it is appreciated. ??

    And thanks for the tip on the 404 page, I’ll look into that.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Role condition completely confusing’ is closed to new replies.