• hello
    I would like to display a zone only for one single account user on my site … but i do not know how to create the right shortcode

    something like
    [s2If is the user with the ID 1234]
    Content for this user only
    [/s2If]

    or [s2If [s2Get user_field=”user_id” /] = 123 ]
    Content for this user only
    [/s2If]

    please could you give me an example ?
    thanks

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • s2If won’t be good enough for that, because there isn’t a function you can use in it for the check you mention.

    You can use a PHP condition, though. WP Admin -> s2Member -> Scripting -> Advanced Conditions

    E.g.

    <?php if (get_current_user_id() == 1) { ?>
    Hello 1
    <?php } ?>

    Remember to install a PHP execution plugin like ezPHP and use the text editor instead of the visual one for the page. https://ww.wp.xz.cn/plugins/ezphp/

    I hope that helps. 🙂

    [ Signature moderated ]

    A way of doing it, with s2If, would be to give that particular user a custom capability (e.g. user1234) that then you check for in the condition.

    [s2If current_user_can(access_s2member_ccap_user1234)]
    Hi 1234
    [/s2If]

    I hope that helps. 🙂

    [ Signature moderated ]

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

The topic ‘S2if and S2Get ?’ is closed to new replies.