XF 2.2 XF usergroup Promotion

ed762

Member
I have been struggling with XF promotion for awhile. Since I am writing myself documentation, I may as well share it here. If Iam incorrect, feel free to correct me.

The XF promotion is like a "usergroup controller". Calling it a "promotion" tool is a bit incorrect, because it also reverses usergroup assignment that it did not do in the first place Once it is set, you shall not manually interfere with the usergroups or risk unintended results.

here is an example.

Say we have a generic user with the following state:
User ONE State:
Member of Usergroup Y
Member of Usergroup X
Registration 11 days


EX 1
If promotion Alpha is to add Usergroup X to account when the account is a members of Usergroup Y, and registration >10days

User ONE State:
Member of Usergroup Y - TRUE
Registration 11 days - TRUE

Promotion runs and adds Usergroup X to User One ( no change)

EX 2
If promotion Alpha is to add Usergroup X to account when the account is a members of Usergroup Y and UserGroup X, and registration >10days

User ONE State:
Member of Usergroup Y - TRUE
Member of Usergroup X - TRUE
Registration 11 days - TRue

Promotion runs and adds Usergroup X to User One - ( no change)

EX 3
If promotion Alpha is to add Usergroup X to account when the account is a members of Usergroup Y and is NOT a member of UserGroup X, and registration >10days

User ONE State:
Member of Usergroup Y - TRUE
Member of Usergroup X - FALSE
Registration 11 days - TRue

If Usergroup X is added previously by Promotion Alpha
De-Promotion kicks in. The controller is trying to maintain that only accounts that fulfill the criteria could be a member of usergroup X, but this account is a member of usergroup X already and the promotion cannot happen unless the account iis not a member of usergroup X, therfore it goes ahead to remove usergroup X from the account so to revert the account to the state as if a "promotion" never happened.

In short, XF usergroup promotion will reverse the result if the conditions are not there to create the result. If A can only happen if B and C are present removing C after A happened would cause XF to retroactively remove A. This may be easy to grasp with items such as dates, post count, etc, but the logic is not immediately initutive with usergroup assigment.

Therefore, when restructuing usergroups and migration from other platforms to XF that have different usergroup structure, detail analysis ( using logic) needs to be carried out before running ( and designing ) these promotions.
 
Last edited:
Confused Always Sunny GIF by It's Always Sunny in Philadelphia
 

Scenario Example 4​

Initial Setup:​

  • Promotion A: Adds secondary user group X to users who are:
    • Members of user group Y.
    • Not members of user group X.
    • Registered for more than 100 days.
  • UserXX:
    • Member of user group Y.
    • Manually added to user group X.
    • Registered for 101 days.

Behavior:​

  1. Promotion Application:
    • Since UserXX is already a member of user group X, they do not meet the criteria for Promotion A.
    • Therefore, Promotion A does not add UserXX to user group X.
  2. Promotion Evaluation:
    • If UserXX was previously promoted to user group X by Promotion A and then manually added back to user group X after being removed, the promotion system will not remove UserXX from user group X because the manual addition overrides the promotion system.

Summary​

  • Promotion System Logic:
    • Adds users to specified user groups based on criteria.
    • Removes users from those user groups if they no longer meet the criteria.
  • Manual Overrides:
    • If a user is manually added to a user group, the promotion system will not remove them from that group, even if they no longer meet the criteria.
    • This ensures that manual user group assignments take precedence over automatic promotions.
By following this logic, XenForo ensures that user group assignments remain consistent with the defined promotion criteria while allowing manual overrides by administrators.
 
So what the XF manual is not clear and explicit about - XF actually tracks the promotions and what users are promoted through the usergroup promotions: xf_user_group_promotion_log Table. Basically the promotion runs the criteria through the accounts to apply the promotion, log these users and then monitor / maintain their compliance with "usergroup promotion". If XF demotes an account, and admin manually promotes it again, the chain is broken and XF will stop demoting it. But If XF promotes an account, admin demotes it manually, XF will still promote it again as long as the criteria are met.
 
Back
Top Bottom