• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 User Group Promotions with TWO "Add to" secondary user groups

Freelancer

Well-known member
#1
I have a user group promotion that adds a user to 2 secondary user groups. The user promotion log shows that the promotion was applied with the cron, but the second group was not added. The user was only added to one of the two groups actually. I also checked if another promotion would remove the second secondary group but there is nothing that should interfere. The promotion is applied so it must match the requirements but then the second secondary group is not applied.
 

Mike

XenForo developer
Staff member
#2
Does this apply to everyone that has been promoted?

Have you used the group that wasn't applied for anything else in the past?
 

Freelancer

Well-known member
#3
Very good questions.

1: Actually this promotion is only applied to two users by now. I made it new. And both have all promotions applied (I checked it in the ACP Manager) but only one of the two has both user groups applied.

2: The second question is also very piercing... For effort economical reasons the second group was used for other things in the past and I just renamed it from "Lapsed" to "Terminated"...

Background: The promotion deals with inactive users. Selecting a Custom User Field with "Membership State" Labels by the admin, it adds a user to the two groups "Inactive" and "Terminated" while "Inactive" is for the permissions (removing all permissions) and "Terminated" is just cosmetic (Banner on the member profile). So I can re-use the inactive user group for many things and put different banners/labels on that user with a second user group (Retired, Deceased etc)...
 

Mike

XenForo developer
Staff member
#4
The reuse is likely the issue. I'm going to guess that at some point you manually removed the user from the group.

I suspect there's something else in the system that has automatically put the user in that group. When the promotion has triggered, it determines which group needs to be added based on what changed in the user group change system. If that system thinks the user should already be in a particular group, it won't be granted programmatically. In this instance, if it's just one user, you could add the group manually.

You could confirm this by looking at the xf_user_group_change table records for this user. I expect you'll find another one that mentions this group ID. (And the name should give you an idea of what it was.)
 

Freelancer

Well-known member
#5
if it's just one user, you could add the group manually.
That actually brought me to think "what if the other way around will reset the promotion". I changed the custom user field to another member state "clear" which then removed "both" groups automatically. After that I switched to "Terminated" again and bingo... the system applied the promotion again and this time with both groups. Sometimes being asked the right questions puts a spotlight to the solution. I still have no idea why this happened but the promotion worked again. Damn, I love XF for the "workarounds" haha. There is nothing you can't do somehow. Thanks Mike
 

Freelancer

Well-known member
#6
Some additional Insight: I am now pretty convinced that the problem with user promotions is "imported users"... I imported a user database and the user promotions that rely on the data of imported custom fields did not work in multiple cases. As a simple solution I changed the imported data selections to other selections, saved the user profiles and then changed the selections back to the imported selection again. Then ran the cron jobs, rebuild the user promotion caches and bingo it works. It seems like imported data does not trigger the user promotions at all. Only if I change the user profile in XF itself and then switch to and save it again in its original (imported) state, the user promotions actually work.