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

XF 1.1 How to mass move to new user group.

Edrondol

Well-known member
#1
Quick question. I would like to have new registers move to a user group that is effectively on probation. I could not see how to make them be anything other than Registered Users.

So what I need to do is either find a way to make new registers go to the group of my choice or find out how to mass move users to a new group called "Trusted Users". I built the promotions and rebuilt caches, but it didn't seem to do the trick.

Ideas?
 

Jake Bunce

XenForo moderator
Staff member
#2
Here is a different idea. Enable moderation:

Admin CP -> Home -> Options -> User Registration -> Enable Manual Approval

That will cause new users to have a user state of "Awaiting Approval". It's not a different usergroup. But users like this who are not "Valid" take on the permissions of the "Unregistered / Unconfirmed" group.

Otherwise you should simply modify the permissions for the "Registered" group if you want to target new registrations. This is as opposed to trying to change the destination group for new users which is not a good idea.

You can add existing users to a new "Trusted" group by creating a promotion. Note that in 1.1 promotions are handled by a cron that runs hourly:

Admin CP -> Tools -> Cron Entries -> User Group Promotions

And be aware that promotions are only awarded to qualifying users who have been active on the forum in the last 24 hours. For your purposes you may wish to temporarily modify this file so that it processes all users regardless of activity:

library/XenForo/CronEntry/UserGroupPromotion.php

Remove the red code:

Code:
		$users = $userModel->getUsers(array(
			'user_state' => 'valid',
			'is_banned' => 0,
			'last_activity' => array('>', XenForo_Application::$time - 86400)
		), array(
			'join' => XenForo_Model_User::FETCH_USER_OPTION
		));
Then manually run the cron to process all users for promotion.
 

Edrondol

Well-known member
#3
That's what I needed! Thanks, man! I rebuilt the caches and didn't even think of running the cron jobs. Thanks again!
 

giorgino

Well-known member
#4
Note that in 1.1 promotions are handled by a cron that runs hourly:

Admin CP -> Tools -> Cron Entries -> User Group Promotions

And be aware that promotions are only awarded to qualifying users who have been active on the forum in the last 24 hours. For your purposes you may wish to temporarily modify this file so that it processes all users regardless of activity:

library/XenForo/CronEntry/UserGroupPromotion.php

Remove the red code:

Code:
$users = $userModel->getUsers(array(
'user_state' => 'valid',
'is_banned' => 0,
 'last_activity' => array('>', XenForo_Application::$time - 86400)
), array(
'join' => XenForo_Model_User::FETCH_USER_OPTION
));
Then manually run the cron to process all users for promotion.
Jake you know the answer for sure ;)
The cron run every 20 mins, not one hour.

In my installation running di cron the server respond with error 500 :(
Alternatives?

Thanks :)
 

giorgino

Well-known member
#6
The only servers error.log line I've found after running the promotion cron is:

Code:
93.56.248.3 - - [28/Jan/2012:11:32:37 +0100] "GET /admin.php?cron/userGroupPromotions/run&_xfToken=1%2C1327746747%2C70b9ebedd2a01f6f17d993c134c89d9d375911b7 HTTP/1.1" 500 5 "http://immobilio.it/admin.php?cron/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.52.7 (KHTML, like Gecko) Version/5.1.2 Safari/534.52.7"
and

Code:
2012/01/28 11:32:37 [error] 31578#0: *1555996 FastCGI sent in stderr: "PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 83 bytes) in /store1/www/it.immobilio.www/doc_root/library/Zend/Db/Statement/Mysqli.php on line 304" while reading response header from upstream, client: 93.56.248.3, server: www.immobilio.it, request: "GET /admin.php?cron/userGroupPromotions/run&_xfToken=1%2C1327746747%2C70b9ebedd2a01f6f17d993c134c89d9d375911b7 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "immobilio.it", referrer: "http://immobilio.it/admin.php?cron/"
 

Jake Bunce

XenForo moderator
Staff member
#7
Yeah, memory error. Too many users at once.

Try re-adding the "last_activity" criteria, but change the timestamp. Then you can process all users in batches by gradually increasing the timestamp between each run. It's tedious but it should work.
 

Digital Doctor

Well-known member
#9
Here is a different idea. Enable moderation:

Admin CP -> Home -> Options -> User Registration -> Enable Manual Approval

That will cause new users to have a user state of "Awaiting Approval". It's not a different usergroup. But users like this who are not "Valid" take on the permissions of the "Unregistered / Unconfirmed" group.

Otherwise you should simply modify the permissions for the "Registered" group if you want to target new registrations. This is as opposed to trying to change the destination group for new users which is not a good idea.

You can add existing users to a new "Trusted" group by creating a promotion. Note that in 1.1 promotions are handled by a cron that runs hourly:

Admin CP -> Tools -> Cron Entries -> User Group Promotions

And be aware that promotions are only awarded to qualifying users who have been active on the forum in the last 24 hours. For your purposes you may wish to temporarily modify this file so that it processes all users regardless of activity:

library/XenForo/CronEntry/UserGroupPromotion.php

Remove the red code:

Code:
$users = $userModel->getUsers(array(
'user_state' => 'valid',
'is_banned' => 0,
 'last_activity' => array('>', XenForo_Application::$time - 86400)
), array(
'join' => XenForo_Model_User::FETCH_USER_OPTION
));
Then manually run the cron to process all users for promotion.
Nominate for the Help Manual !
+ CORE