Support Forum

How to automatically move people from one user group to another (with Wishlist)

40 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

So we do need to check that the role change event is being triggered as expected. Steve suggests using the new event logging plugin so I will check how to add a hook as I am not yet accustomed to using it.

( @mr-papa – if you get here first can you describe setting this up please? )

MP Mr Papa
Mr Papa
Member

install our event logging plugin…  then go to its sp admin panel…  and fill out the name of the action to log

log.png

The name you want to use is: 

set_user_role

then whenever wp changes the role of a user, it will fire that action…  wait for a user to be auto upgraded and see if the hook was logged.. you can test it by manually upgrading a user…

JM John McIntyre
John McIntyre
Member

The installation failed. I tried both methods – uploading via the wp-admin interface and uploading via FTP.

The FTP info said:

Command: cd “/wp-content/plugins/logger/resources/images”

Error: Directory /wp-content/plugins/logger/resources/images: no such file or directory

Command: cd “/wp-content/plugins/logger/resources”

Error: Directory /wp-content/plugins/logger/resources: no such file or directory

Any ideas?

MP Mr Papa
Mr Papa
Member

see:  https://simple-press.com/documentation/codex/plugins/plugin-basics/using-plugins/

Its an SP plugin, not a WP plugin…

JM John McIntyre
John McIntyre
Member

Ok, it’s working. Set it up and upgraded a user manually… but not sure how to get the results and post them here?

MP Mr Papa
Mr Papa
Member

so if you got an entry in the log, that means wp fired the role change hook… what we want to see happen now is do you get an entry when the user is auto upgraded…

see, we or other plugins cannot know anything is happening unless wp or other notifies via a hook getting fired…  so wait for an auto upgrade and see if you get an entry…

YS Yellow Swordfish
Yellow Swordfish
Member

The event log… in the event log admin menu – second entry.

YS Yellow Swordfish
Yellow Swordfish
Member

OK.SO now you need an automatic update to occur to see if a new event is logged.

MP Mr Papa
Mr Papa
Member

and an fyi, but the arg1 is the user id that had their role changed…

JM John McIntyre
John McIntyre
Member

Just did an auto upgrade. I get the same thing.

What next?

JM John McIntyre
John McIntyre
Member

I tested the auto upgraded account and same problem.. it’s not getting upgraded from mcmasterstrial to mcmastersgold.

YS Yellow Swordfish
Yellow Swordfish
Member

But the event log there shows that the information sent to Simple:Press on the role change is pointing to the old ‘trial’ role not the new ‘gold’ role. The SP User Groups are not being informed of any change. The log should show the new role not the old.

Now I must say I do not think we have seen this happen before. We HAVE seen some instances where a plugin did not send the new role through at all (hence the event log test) but I am pretty sure sending the old role instead of the new role is a first! And I am not sure how that can happen! 

@mr-papa – have you seen anything like this before? Any ideas?

MP Mr Papa
Mr Papa
Member

if that is the old role, means wp (and hence plugins) was not notified of a move to the new role…  makes it hard for any action to be taken…

worth verifying on the wishlist member settings that you have the wishlist levels properly mapped to wp roles… its not a wp or sp setting, but occurs within wishlist options for each level…  and see what you have for the setting of removing levels when adding a new one…

another event you could add to the logging list for clarity if the wishlist hook when it adds a user level…  add these two hooks to the event logging plugin:

wishlistmember_remove_user_levels
wishlistmember_add_user_levels

might give us better picture, in conjunction with the wp role change action, what is going on…