Events Made Easy › Forums › How do I … › Create or sync Membership group to wp roles..
Tagged: content, groups, membership, roles
- This topic has 16 replies, 2 voices, and was last updated 4 years, 9 months ago by Anonymous.
-
AuthorPosts
-
Sat 8 Feb 2020 at 01:44 #60799AnonymousInactive
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?
Sat 8 Feb 2020 at 02:01 #60800AnonymousInactive1. 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?
Sat 8 Feb 2020 at 16:44 #60801AnonymousInactive3. 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?
Sun 9 Feb 2020 at 21:42 #60806FrankyKeymasterEME 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).
Sun 9 Feb 2020 at 22:24 #60808AnonymousInactiveThanks 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?
Mon 10 Feb 2020 at 10:12 #60810FrankyKeymasterWell, 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.
Mon 17 Feb 2020 at 14:42 #60875AnonymousInactiveSo 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. ๐
Mon 17 Feb 2020 at 19:42 #60876FrankyKeymasterYour closing tag for the first 2 eme_if statements should be [/eme_if], not [eme_if]
Mon 17 Feb 2020 at 23:41 #60878AnonymousInactiveahh, rookie mistake! didn’t see that, sorry, working like a charm!
Fri 21 Feb 2020 at 13:43 #60906AnonymousInactiveHi 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?
Fri 21 Feb 2020 at 14:39 #60908FrankyKeymasterWell, #_IS_USER_MEMBER_OF should only be true for active members … let me check this
Fri 21 Feb 2020 at 14:44 #60909FrankyKeymasterThis oneliner should fix it:
https://plugins.trac.wordpress.org/changeset/2248188/Fri 21 Feb 2020 at 15:22 #60910AnonymousInactiveI 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?
Fri 21 Feb 2020 at 17:05 #60913FrankyKeymasterThat’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/Fri 21 Feb 2020 at 21:42 #60914AnonymousInactiveYou 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?Fri 21 Feb 2020 at 22:12 #60916FrankyKeymasterThe 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.
Fri 21 Feb 2020 at 22:49 #60918AnonymousInactiveAwesome! works like a charm ๐
-
AuthorPosts
- The forum ‘How do I …’ is closed to new topics and replies.