Events Made Easy Forums How do I … Create or sync Membership group to wp roles..

Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • #60799
    Anonymous
    Inactive

    Hi there,

    I have a specific plugin that makes very well structured course layout. The way I can restrict this is to use a user role in wordpress.

    Is there a way I can link EME Memberships using maybe groups to be linked to Roles in wp somehow? So that if a user pays with e membership it can automatically be added to the wp role and given access to course content?

    #60800
    Anonymous
    Inactive

    1. Question above.

    Additional question here:

    2. I’m also wondering the best way to create a login page for users, does EME has it’s own login form or do we need to map it to a wp user?

    #60801
    Anonymous
    Inactive

    3. How do I check that the member has already payed also? does [eme_if tag='#_IS_USER_MEMBER_OF{xxx}' value='1'] You are in the membership<br> [/eme_if] return 1 if the membership is payed or if he is just part of the membership?

    #60806
    Franky
    Keymaster

    EME memberships can be configured to add members to an EME group. Each member is also a “person” in EME, and that person can be linked to a WP user (either automatically if the user is logged in and you require a user to be logged in or by linking them manually). EME has no login form, that’s for wordpress to handle ๐Ÿ™‚

    The placeholder #_IS_USER_HAS_ROLE can be checked if a logged in user has a certain role (see https://www.e-dynamics.be/wordpress/category/documentation/7-placeholders/7-1-conditional-tags/) inside the eme_if shortcode.

    The placeholder #_IS_USER_MEMBER_OF is only for active members (meaning they also paid).

    #60808
    Anonymous
    Inactive

    Thanks Franky, getting clearer slowly but surely ๐Ÿ™‚

    So a membership can be connected to an EME group, but is it possible to link an EME group to a role in WP ? So that I can basically use a WP role if a user has payed or not?

    #60810
    Franky
    Keymaster

    Well, EME memberships are meant for actual clubs, not really for WP memberships. You can use eme_if and #_IS_USER_HAS_ROLE, but that’s only something handy. The best is to use eme_if and check if the user is actually a member before showing a page.

    #60875
    Anonymous
    Inactive

    So I have now tested this code on a page:

    [eme_if tag='#_IS_USER_MEMBER_OF{Membership}' value='1']
    Part of the Membership
    [eme_if]
    
    [eme_if tag='#_IS_USER_MEMBER_OF{Membership}' value='0']
    Not part of the membership
    [eme_if]
    
    [eme_if tag='#_IS_LOGGED_IN' value='1'] 
    You are logged in 
    [/eme_if]
    
    [eme_if tag='#_IS_LOGGED_IN' value='0'] 
    You are NOT logged in 
    [/eme_if]

    1. Test with a wp admin with NO membership and not in member or people in EME:
    The page shows nothing. Not even that the person is logged in. So I guess the login check is checking if there is a wp person linked to a eme person… correct? Or is there a bypass if you are admin of the site somehow?

    2. I tested with no one logged in:
    This was printed:

    You are NOT logged in

    – This seems logical, but thought also that the check for membership would kick in and print “Not part of the membership”… ?

    3. I tested with an Active Membership, paied person, is in membership and people in EME:
    This was printed:

    Part of the Membership
    Not part of the membershipโ€ฆ Redirect to login siteโ€ฆ..
    You are logged in

    – Here it seems as if something is wrong. As the person is part of the membership and both that the person is part of the membership and not part of the membership kicks in… this does not seem logical?

    Would love if you could comment on the 3 options to see if there is something wrong or maybe just clarify my understanding of how things work. ๐Ÿ™‚

    #60876
    Franky
    Keymaster

    Your closing tag for the first 2 eme_if statements should be [/eme_if], not [eme_if]

    #60878
    Anonymous
    Inactive

    ahh, rookie mistake! didn’t see that, sorry, working like a charm!

    #60906
    Anonymous
    Inactive

    Hi Franky,

    I’m having some issues with the tag #_IS_USER_MEMBER_OF..

    This is the code I am using:

    [eme_if tag='#_IS_USER_MEMBER_PENDING{1}' value='1'] 
    Pending, not activated yet..
    [/eme_if]
    
    [eme_if tag='#_IS_USER_MEMBER_OF{1}' value='1']
    YES Membership
    [/eme_if]

    I noticed I could use the ID 1 of Membership as well as the name of the Membership called “Membership”. And it’s better to use ID in case I change the name of the membership.

    The test is I am registering a new user and do not pay.. This is the results I am seeing:
    Both of the statements are true in this case.. so they get a YES for being part of the membership even they are pending payment.. So both is true..

    As far as I can read the documentation only paying member should be true for [eme_if tag='#_IS_USER_MEMBER_OF{1}' value='1']… right?

    Seems that there might be a bug here?

    #60908
    Franky
    Keymaster

    Well, #_IS_USER_MEMBER_OF should only be true for active members … let me check this

    #60909
    Franky
    Keymaster
    #60910
    Anonymous
    Inactive

    I did the change on my end after doing the latest upgrade and it works! Thanks Franky! ๐Ÿ™‚

    Another thing I noticed:

    I did realise with your update the code #_EXPIRED_MEMBERSHIP_PAYMENT_URL{1} didn’t seem to work.. but I just printed it out while being in a pending state.. it just printed out the text “#_EXPIRED_MEMBERSHIP_PAYMENT_URL{1}”.
    Maybe the user actually have to be expired for this link to work?

    I also tried with #_MEMBERSHIP_PAYMENT_URL{1} and this also did the same just printed out the text: “#_MEMBERSHIP_PAYMENT_URL{1}”..

    Maybe a new bug?

    #60913
    Franky
    Keymaster

    That’s probably because you use those inside your eme_if content. And indeed, that content wasn’t being parsed for placeholders. This oneliner fixes it:
    https://plugins.trac.wordpress.org/changeset/2248272/

    #60914
    Anonymous
    Inactive

    You are right I have used it within a eme_if statement, after adding the code it worked for #_MEMBERSHIP_PAYMENT_URL. ๐Ÿ™‚

    I noticed that after you fixed the “[eme_if tag='#_IS_USER_MEMBER_OF{1}' value='1']” issue, now the check for pending is true regardless if a member is active:

    [eme_if tag='#_IS_USER_MEMBER_PENDING{1}' value='1'] 
    Pending, not activated yet..
    <a href="#_MEMBERSHIP_PAYMENT_URL{1}">Pay now</a>
    [/eme_if]

    Maybe a small fix needed here?

    Another note:
    If the member is expiered is this the only time the “#_EXPIRED_MEMBERSHIP_PAYMENT_URL{1}” gets generated and prints anything? Because it returns null for me, but maybe that is expected behavior as the user has not expired yet so I have not tested that. what do you say?

    #60916
    Franky
    Keymaster

    The IS_PENDING thing is because of a wrong default check, this fixes it:
    https://plugins.trac.wordpress.org/changeset/2248464/

    The _EXPIRED_MEMBERSHIP_PAYMENT_URL indeed only return an url for expired members, not for anybody else.

    #60918
    Anonymous
    Inactive

    Awesome! works like a charm ๐Ÿ™‚

Viewing 17 posts - 1 through 17 (of 17 total)
  • The forum ‘How do I …’ is closed to new topics and replies.
Scroll to Top