AI Assistant
Notifications
Clear all

[Closed] Role Change doesn't sync on 2nd time.

5 Posts
2 Users
0 Reactions
1,134 Views
Posts: 4
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@matthewjr45)
Active Member
Joined: 3 years ago
[#30398]

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.

wpForo Version
2.1.5
WordPress Version
6.1.1

4 Replies
Robert
Posts: 10720
Admin
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@robert)
Support Team
Joined: 2 months ago

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 );

Posts: 4
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@matthewjr45)
Active Member
Joined: 3 years ago

It didn't work. 


1 Reply
Robert
Admin
(@robert)
Joined: 2 months ago

Support Team
Posts: 10720
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@matthewjr45,

I'm really sorry, but I have no other solution. It means the membership plugin is not compatible with wpForo. I recommend contact the membership plugin support and ask them to make their plugin compatible with wpForo.


Posts: 4
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@matthewjr45)
Active Member
Joined: 3 years ago

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.


Share: