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

Expired account upgrades

Blue

Well-known member
#1
I have an account upgrade where the user can have a custom title and a sig. I noticed an account that the upgrade had expired and the custom title reverted but the account still was showing a sig in the postbit. Is this normal? I thought that once the secondary usergroup was removed all the secondary permissions would be removed as well.
 
R

ragtek

Guest
#2
I have an account upgrade where the user can have a custom title and a sig. I noticed an account that the upgrade had expired and the custom title reverted but the account still was showing a sig in the postbit. Is this normal? I thought that once the secondary usergroup was removed all the secondary permissions would be removed as well.
The permissions are only checked, while you save the new signature.
So you would need an cronjob or extend the userupgrade cron to check and remove the signatures or you could send a conversation that the user needs to change the signature ...
 

Blue

Well-known member
#3
I believe a cronjob would be the best solution, but I have no idea how to do it. If there is a query I could run that would only clear sigs for those that did not have the secondary usergroup that might work too.
 

Jake Bunce

XenForo moderator
Staff member
#4
I believe a cronjob would be the best solution, but I have no idea how to do it. If there is a query I could run that would only clear sigs for those that did not have the secondary usergroup that might work too.
I like queries.

Code:
UPDATE xf_user_profile AS user_profile
SET user_profile.signature = ''
WHERE (
	SELECT user.user_id
	FROM xf_user AS user
	WHERE user.user_id = user_profile.user_id
	AND NOT FIND_IN_SET(23, user.secondary_group_ids)
);
Change the red piece to specify the group id that grants signature permissions.

Backup first. And please understand that this clears signatures for all users who do not belong to the specified group. For example, if an admin is not also in that group then their signature will get cleared. You may wish to exclude admins and mods, like this:

Code:
UPDATE xf_user_profile AS user_profile
SET user_profile.signature = ''
WHERE (
	SELECT user.user_id
	FROM xf_user AS user
	WHERE user.user_id = user_profile.user_id
	AND NOT FIND_IN_SET(23, user.secondary_group_ids)
	AND NOT FIND_IN_SET(3, user.secondary_group_ids)
	AND NOT FIND_IN_SET(4, user.secondary_group_ids)
);
Basically you are specifying all secondary groups that are allowed to have signatures.
 

MGSteve

Well-known member
#5
Is there anyway this could be built into the XF core as I need a similar feature due to the fact we give extra features to those who subscribe, which then need to be removed should their subscription lapse.

I'd have thought anyone who did similar (probably most people who use account upgrades) will need this.
 

Blue

Well-known member
#6
I like queries.

Change the red piece to specify the group id that grants signature permissions.

Backup first. And please understand that this clears signatures for all users who do not belong to the specified group. For example, if an admin is not also in that group then their signature will get cleared. You may wish to exclude admins and mods, like this:

Basically you are specifying all secondary groups that are allowed to have signatures.
This should do the job just fine. I have to wait until the 21st to run it, that's when the next user with a sigs upgrade expires.

Thanks Jake.
 

Blue

Well-known member
#7
Is there anyway this could be built into the XF core as I need a similar feature due to the fact we give extra features to those who subscribe, which then need to be removed should their subscription lapse.

I'd have thought anyone who did similar (probably most people who use account upgrades) will need this.
I would like to see it built in as well.
 

Blue

Well-known member
#8
Custom titles are not reverting after an upgrade expires in some cases. Is there a query I could run similar to this one to revert custom titles after an upgrade expires?




I like queries.

Change the red piece to specify the group id that grants signature permissions.

Backup first. And please understand that this clears signatures for all users who do not belong to the specified group. For example, if an admin is not also in that group then their signature will get cleared. You may wish to exclude admins and mods, like this:

Code:
UPDATE xf_user_profile AS user_profile
SET user_profile.signature = ''
WHERE (
SELECT user.user_id
FROM xf_user AS user
WHERE user.user_id = user_profile.user_id
AND NOT FIND_IN_SET(23, user.secondary_group_ids)
AND NOT FIND_IN_SET(3, user.secondary_group_ids)
AND NOT FIND_IN_SET(4, user.secondary_group_ids)
);
Basically you are specifying all secondary groups that are allowed to have signatures.
 

Blue

Well-known member
#11
Try this:

Admin CP -> Tools -> Rebuild Caches -> Rebuild User Caches
Hey Jake, this doesn't seem to be working. Do you know of a query like this one that would clear custom titles?

Code:
UPDATE xf_user_profile AS user_profile
SET user_profile.signature = ''
WHERE (
    SELECT user.user_id
    FROM xf_user AS user
    WHERE user.user_id = user_profile.user_id
    AND NOT FIND_IN_SET(23, user.secondary_group_ids)
    AND NOT FIND_IN_SET(3, user.secondary_group_ids)
    AND NOT FIND_IN_SET(4, user.secondary_group_ids)
);
 

Blue

Well-known member
#13

Jake Bunce

XenForo moderator
Staff member
#14
Code:
UPDATE xf_user
SET custom_title = ''
WHERE NOT FIND_IN_SET(3, secondary_group_ids)
AND NOT FIND_IN_SET(4, secondary_group_ids);
 

Blue

Well-known member
#16
Code:
UPDATE xf_user
SET custom_title = ''
WHERE NOT FIND_IN_SET(3, secondary_group_ids)
AND NOT FIND_IN_SET(4, secondary_group_ids);

Sorry I thought I was covered with just 2 usergroups but I need to exclude 3 different usergroups. I tried adding another line but it doesn't work and I get an error.
Code:
UPDATE xf_user
SET custom_title = ''
WHERE NOT FIND_IN_SET(3, secondary_group_ids)
AND NOT FIND_IN_SET(4, secondary_group_ids)
AND NOT FIND_IN_SET(5, secondary_group_ids);