• Hi there,

    I want to show a member specific shortcode for which the member shall control the visibility.

    Therefore I set up the following:
    1) A username field visible to admin only
    2) A dropdown field visible to admin & profile owner with the “show / don’t show” options named “show-products”
    3) One shortcode field that carries the member specific shortcode and is using the two above as conditionals:
    3.1 SHOW > if > username > EQUALS > %username% (I put that last value in manually to match the inserted member specific shortcode)
    3.2 SHOW > if > show-products > EQUALS > yes

    I set this up for two sample members.
    While the filter (conditional) by username works perfectly to show the member specific shortcode in that member’s profile only, once I add the “show-products” selector, BOTH members’ shortcodes get rendered in BOTH members’ profiles once ANY member turns the “show-products” option to “yes”.

    So to me this seems as if the combination of different conditional fields doesn’t chain up with “AND” operators, but it seems to show once at least one condition matches? So that would be an “OR” operator.

    Question: How do I need to set up several conditional fields so that ALL criteria must be met in order to show a field and hide it if not all criteria match?

    Thanks a ton. ??
    Piet

Viewing 6 replies - 1 through 6 (of 6 total)
  • UM Conditional rules are basic, not extensive, and some logic can not be applied. However, I find that sometimes there are other ways to accomplish similar results.

    Now, if the conditional rules that you wrote above for #2 & #3 are how they are in your field manager, then no wonder why nothing works…

    Question: How do I need to set up several conditional fields so that ALL criteria must be met in order to show a field and hide it if not all criteria match?

    Conditional logic rules depend upon data content variables that have to be present in the profile form either in edit or view modes (or both), else the script ignores those rules.

    Thread Starter spreetaucher

    (@spreetaucher)

    Thanks Boris. ??
    My challenge in this is that I want to use a unique user variable (like username or nickname) to utilize it within a rule in both edit and view mode, that the logged in member shall not be able to edit.

    For username: it is protected from change by the core so it won’t show up in edit view anyway.

    Nickname could work, but to make it visible in edit mode I have to allow the profile owner to actually change its value, what destroys the rule it is linked to.

    I read from other threads here that a “read-only” field in edit mode is not possible, right? Cause that would perfectly solve my problem, I think.

    Thanks again,
    Piet

    Anything is possible, you are only limited by your programming/coding knowledge/skill. If you’ve read in other threads that something is not possible, then it probably just isn’t by default. However, that doesn’t mean that another developer can not modify it.

    Most of these modifications are not supported on this sub forum and neither they should for the fact that this is a free plugin.

    Now, from what I understand on your post, you’re trying to create a shortcode with a call function to print the username on the form in edit mode.

    If so, that would require injecting new functions or providing handler functions in the functions.php which would create your shortcode.

    I hope this helps,

    Thread Starter spreetaucher

    (@spreetaucher)

    Hi Boris,

    thanks for that brilliantly easy instruction, which helped me to print the username into the form in edit mode. I’m pretty sure that will start some other not so skilled programmers as me to move along as well. ??

    However, I want to use the printed value as a conditional value for showing another field in the edit mode, which seems not possible. Am I assuming correctly, that um’s conditional logic generally cannot deal with values that are rendered by shortcode fields?

    What I have now is this:

    IN VIEW MODE:
    – shortcode field that shows user’s products
    — conditional logic 1: show IF proprietary “username” field IS the seller’s/profile owner’s username.
    — conditional logic 2: show IF “products available user1” IS set to “yes”

    IN EDIT MODE
    – 1 dropdown per seller: “products available user1”, “products available user2″… yes/no visible in edit mode only
    — conditional logic for that dropdown to view per seller should be the printed username from the functions.php addition you provided. (So “products available user1” only show if username (from shortcode) equals “user1”)

    But when I enter that second conditional the dropdown field disappears form the edit mode.

    So I guess working with printed values from shortcodes within the conditional fields does not work in general, right?

    • This reply was modified 8 years, 5 months ago by spreetaucher.

    Truth to be told, I still don’t understand what you are trying to do. If the ‘Show IF’ is the shortcode, then that’s not gonna work.

    IME/O, only fields that have a meta key can be used for conditional rules.

    Thus, ‘shortcodes’ are not conducive to the creation of conditional logic rules on UM as I said before (not that it can’t be modified). They can, however, either show, or hide when specific field values or conditions are declared.

    For example, a shortcode could declare that it can Hide/Show -> IF -> An UM field with a meta-key (e.g., first name, email address, country, etc -> Not Empty -> 0

    You can easily try that if you take the shortcode I gave you, and insert this logic:
    Hide -> IF -> First Name -> Not Empty -> 0

    I hope this helps,

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to combine conditional fields that ALL have to match’ is closed to new replies.