Events Made Easy Forums How do I … Using EME IF

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #63234
    blanch80
    Participant

    Hi Franky,

    What I’d like to do is hide certain events on the main events list using [eme_events] based on a users role.

    I’ve already got this setup for booking forms, so when someone is logged in, if they don’t have a specific WordPress role that has been added to the event as an attribute they can’t book onto the event and are shown a message stating: code below.

    [eme_if tag='#_USER_HAS_ROLE{#_ATT{role}}' value='1']
    #_SEATS
    <table class="eme-rsvp-form">
    <tbody>
    <tr>
    <th scope="row">First Name*:</th>
    <td>#REQ_FIRSTNAME</td>
    </tr>
    <tr>
    <th scope="row">Last Name*:</th>
    <td>#_LASTNAME</td>
    </tr>
    <tr>
    <th scope="row">E-Mail*:</th>
    <td>#_EMAIL</td>
    </tr>
    </tbody>
    </table>
    [/eme_if]
    [eme_if tag='#_USER_HAS_ROLE{#_ATT{role}}' value='0']<strong>You are unable to book a place on this event.</strong>[/eme_if]

    What I’d like to do is, using the [eme_events] shortcode, apply the same logic and only show events that people are able to book a place for based on their WordPress role, hiding any that they’re unable to book a space for.

    I can’t seem to get it working, so thought I’d best ask if this is possible?

    Thanks,
    David,

    #63236
    Franky
    Keymaster

    Reason is that in the form the #_ATT value is replaced and later on all the other generic placeholders (like #_USER_HAS_ROLE) when the event-part of the code is executed.
    However for events the logic was coded differently, since there first the generic placeholders are replaced (which is #_USER_HAS_ROLE) and just after that #_ATT and all other event placeholders.
    Now: switching the replacement will not solve the problem too: some people want to use generic placeholders inside #_ATT (and even more: when you have event custom fields then that replacement happens later on too).
    So it is not an easy one 🙂 For now: try to use a fixed role and not via another variable, unfortunately that’s all I can offer. I’ll take a look but no promises at all.

    #63255
    blanch80
    Participant

    Thanks Franky.

    I think I’ve got it working with a fixed role. I can’t really use it in production though as the site has around 15 possible user roles!

    No problem at all, really appreciate you taking a look.

    #63258
    Franky
    Keymaster
    #63259
    Franky
    Keymaster

    Correction: that change *will* help 🙂 But it will be in the next version too.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.