Hi I'm working on a membership site which switches a user to an inactive role upon expiration/cancellation. Trouble is, the role change doesn't sync to WPForo unless somebody goes in and manually updates the user in the Wordpress back end. Is there a setting to overcome this? Usergroup synchronization is turned on, the role changes in Wordpress, all the front end navigation items and everything about the site reacts as it should except WPForo and the only resolution I'm finding is a manual process of clicking "update user" which... I hope there's an automation for this.
Hi @matthewjr45,
Try the following hook, put it in a PHP code snippet of the Code Snippets plugin or directly in the functions.php file of the current active WordPress theme:
add_action( 'set_user_role', function( $userid, $new_role, $old_roles = [] ){
delete_user_meta( intval( $userid ), '_wpf_member_obj' );
}, 10, 3 );
It didn't work.
Hrm. Let me rephrase and see if there's more you can offer? Ignoring that it's Memberpress. I'm trying to find the function that will simply hit the refresh button on a user profile when their membership level changes. I've been trying to crack this nut for a while now - any help would be so appreciated.