• Hi,

    This is in regards to wordpress shortcode conditionals, and content restriction, using the s2If function.

    When restricting content to ONLY users who selected a specific custom menu option on the registration page, other than ONLY referencing the entire custom menu field ID (since ALL users are required to make a selection from this custom menu), I also need to reference the specific answer they selected. So that I can make different content show to them, depending on what selection they made. How do I do that?

    For example, I created a custom registration field in s2member admin panel, that is a selection menu, where the user can select between TWO different selections (options). So I want to show certain content on their account login page, only to users who selected a SPECIFIC value on this custom menu field.

    So I just need to know how to reference that specific selection/value in the “[s2If current_user_is ….” shortcode conditional for wordpress.

    In addition to showing only to users who selected a specific option in the custom menu field, I ALSO need to only show this restricted content to level 0 members. Because eventually I will manually change their account to a higher level after approving them. So I don’t want to just show to all members who selected this at registration, but ONLY to members who are BOTH level 0 status, as well as to members who selected a specific menu option. Which means I would of course use the “AND” in the middle of the shortcode to reference BOTH conditions.

    I would assume that maybe the “selection” is referenced as “value”, or something simple like that right? And the final shortcode that I need, would look like the following example:

    [s2If current_user_is(s2member_level0) AND current_user_is(user_field_value=”the specific selection of the custom menu I’m trying to allow access”)] [/s2If]

    Is that right? If not “value” then what would I use instead?

    Thanks,
    Lori

    https://ww.wp.xz.cn/plugins/s2member/

Viewing 3 replies - 1 through 3 (of 3 total)
  • … I also need to reference the specific answer they selected …

    That’s not enough to get this to work the way that you want. You need to make this set a custom capability (ccap) and then use this shortcode syntax:

    [s2If current_user_can(access_s2member_ccap_name_of_ccap)] ... [/s2If]

    Thread Starter Lorik84

    (@lorik84)

    So how do I make the specific selected menu item a custom capability? Sorry I’m new to php. Thanks.

    That would require custom code, for which you’d need to hire a developer.

    An alternative would be to get the Pro version, and then generate shortcodes for two free registration forms, which would be identical except for the ccap they include and the description you provide.

    Then you can wrap them using the checkout options shortcode (see this: https://s2member.com/kb-article/how-do-i-display-multiple-checkout-options/, though that example uses paid options), which would make them into a drop-down list, from which the user would choose whichever is appropriate.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Need tech help for shortcode conditionals’ is closed to new replies.