Tips and Tricks HQ Support Portal › Forums › WP eMember › [wp_eMember_upgrade_membership_level_to] shortcode does not change wp role
- This topic has 6 replies, 2 voices, and was last updated 12 years, 2 months ago by admin.
-
AuthorPosts
-
September 3, 2012 at 2:44 am #7301gmangeshMember
Hello,
I have two eMember Levels – lets say “Gold” and “Silver”.
These are associated with two WordPress role “WP Gold” and WP Silver” respectively.
WordPress Integration is ENABLED.
The association with the WordPress roles is used to drive access to Forums in SimplePress – so it is important that the eMember roles stay in sync with WordPress roles.
I have “Enable Secondary Membership:” enabled – but the behavior described below is the same regardless of this setting.
If I switch a users Primary role from the Edit Members screen in eMember, then the user’s WordPress role also gets correctly modified to stay in sync with the eMember membership level.
However, I also have an upgrade button created using the [wp_eMember_upgrade_membership_level_to level=x] shortcode. And if the user clicks on this upgrade button, then the user’s Primary eMember role gets switched – but his WordPress role does not get switched. This results in the the WordPress roles getting out of sync with eMember roles.
The code for this shortcode confirms the observed behavior – the wp_eMember_upgrade_membership_level_to_handler() function only updates the eMember membershiop table – it does not modify WordPress roles of the user.
Keeping the roles in sync is important for me – is it possible to get a fix for this?
Thanks
September 4, 2012 at 6:15 am #48900adminKeymasterI have fixed this shortcode in the eMember plugin code.
September 4, 2012 at 6:20 pm #48901gmangeshMemberThanks for the rapid response!
I’ll try out the new version
September 5, 2012 at 6:13 pm #48902gmangeshMemberHi,
I get the following error when I click on the “Upgrade” button generated by the [wp_eMember_upgrade_membership_level_to level=x] shortcode:
Fatal error: Call to undefined function emember_debug_log_subsc() in /home/xxx/public_html/xxx/wp-content/plugins/wp-eMember/eMember_misc_functions.php on line 635
(eMember_debug_log_subsc() is defined in ipn/eMember_handle_subsc_ipn_stand_alone.php)
September 5, 2012 at 6:31 pm #48903gmangeshMemberTo test the rest of the functionality I temporarily commented out the offending function call.
Now, the WordPress role is getting updated.
HOWEVER, the SimplePress role does not get updated.
I am guessing some hook is not getting triggered.
September 5, 2012 at 6:44 pm #48904gmangeshMemberOk, found the hook.
The “set_user_role” hook needs to be invoked.
Add the following line after the call to “update_wp_user_Role()”
do_action( ‘set_user_role’, $user_info->ID, $role_name );
( And comment out the call to eMember_debug_log_subsc() to fix the PHP error )
Thanks
September 6, 2012 at 2:50 am #48905adminKeymasterThank you. I have corrected this issue in the plugin.
-
AuthorPosts
- You must be logged in to reply to this topic.