XF 2.2 If/as long | State == awaiting email confirmation, Username color should be red

Masetrix

Well-known member
How can I achieve the following.

We often have users who register but make a mistake with the email and the link for activation does not arrive either. These users then usually create a 2nd registration with a similar name and the correct email address.

For our moderators, however, it appears like a double account because they have no access to the data of newly registered users.

I would now like to display every user name of newly registered users in red as long as it is not yet activated, the user state == awaiting email confirmation.

Does anyone have any idea how I can best achieve this?
 
Solution
A user group promotion with the user state of awaiting email confirmation, promoted to a user group with user name color set to red.

Masetrix

Well-known member
Is this a bug or am I doing something wrong?

First, I created a new promotion for the newly registered users,
1610561263771.png

with the State:
1610561510067.png
It is working.

Then the second promotion, which should move users from the group above back to registerd if the user is state Valid ...
1610561865840.png

1610561968082.png

Then I put a new user on whose email it is guaranteed that it cannot be verified because it is completely invalid.
1610562145612.png

After a short time, the user was moved back to the registered group, although his state is not valid.
1610562406315.png
1610562466941.png

Can you show me the mistake?
I am a bit confused. 🤪 ;)
 

Masetrix

Well-known member
You don't need a second promotion.

Members will be promoted and demoted automatically if they meet or no longer meet the criteria.

Well, I deleted the second promition and started a new test.
The problem persists, the users are moved to the registered group and the styling changes without the user state being "valid", which would actually be a condition for moving.

Do you have any other idea what's going wrong?

1610629257297.png
1610629315647.png
1610629512792.png
 
Last edited:

Masetrix

Well-known member
Update:

I've checked that again now.

The promotion does everything right.
Then, when the cron job "cron entry: User group promotions" is run for the first time, all newly registered users are moved to the group registered, even if the user state is not "valid" ...

There must be a bug in the code.
 

Masetrix

Well-known member
Until the problem was solved, I've now added a second promotion.

This moves all users of the group "registered" with the state "awaiting email confirmation" into the user group with unchecked email addresses, as does the first promotion for new users who register

With XF you sometimes have to go strange ways;)
 

Brogan

XenForo moderator
Staff member
With XF you sometimes have to go strange ways;)
You really don't.

I have just tested it with a single promotion and it works exactly as expected.
Only members with a state of 'Awaiting email confirmation' are promoted.
Once they become valid, they are demoted.

I suspect your promotion criteria is incorrect, or there's something else involved.
 

Masetrix

Well-known member
I have just tested it with a single promotion and it works exactly as expected.
Only members with a state of 'Awaiting email confirmation' are promoted.
Yes, that's right, I didn't say anything else either.
Once they become valid, they are demoted.
From here on there is the problem that I showed above in the screenshot. As soon as the cron entries for user group promotions have been carried out, all users with the state "awaiting email confirmation" are again in the registered group.

I also tested it in the test environment, without add-ons - same result.

I suspect your promotion criteria is incorrect, or there's something else involved.
Where should the user criteria be incorrect, the promotion works? Above in the topic I have posted everything as it is set here

Only the xf-cronjob for user promotions then also moves users with wrong criteria / state. This happens in the live forum with addons as well as in the test environment without add-ons or other modifications
 

Brogan

XenForo moderator
Staff member
all users with the state "awaiting email confirmation" are again in the registered group.
That's correct.

All users have the registered user group as the primary - they are always in it, no matter what.

User group promotions add other user groups as secondary.
 

Masetrix

Well-known member
That's correct.

All users have the registered user group as the primary - they are always in it, no matter what.

User group promotions add other user groups as secondary.
That's clear, as I said in
First, I created a new promotion for the newly registered users,

So far it works - if then the xf-cronjob runs first time, the additional/second Usergroup is removed, and the user is in the "registered" group only, but with wrong state "awaiting email confirmation.". That shouldn't happen.

A fix that's working for me is a second promotion, that sets for all user in group "registered" with the state "awaiting email confirmation", the second Usergroup again..
 
Top