Forums | Mahara Community

Developers /
Suspend users


Shen Zhang's profile picture
Posts: 87

03 May 2010, 22:44

Hi,

We had about 200 duplicated user logins in the system and was looking at the option of suspending them. We decided to suspend the users via a SQL command rather than updating 200 times in the user interface. The SQL command that I used was as follows:

update usr
set suspendedctime = '2010-04-12 15:32:57', suspendedreason = 'This duplicate user account has been suspended to avoid confusion. Please use your account name without an underscore at the end.', suspendedcusr = 1
where username like '%/_' ESCAPE '/'
However, I noticed that the data value for the datafield 'active' is turned to "0" when a user is suspended from the user interface. So obviously I need to adjust the SQL statement above to suspend users. Can anyone here advise me that whether there are more places to update when a system admin suspends users via a SQL statement?
Thanks.
anonymous profile picture
Account deleted
Posts: 1643

04 May 2010, 0:09

From my recollection, just setting the suspendedctime is all that's necessary. Also, a cron job runs that keeps the active flag in sync, so you can update it but you don't have to. You may as well, I guess Smile

Shen Zhang's profile picture
Posts: 87

09 May 2010, 17:42

Thanks Nigel. I've done the SQL in the database to inactivate the suspended users. Meanwhile, just wondering why the cron job isn't doing the job properly. Can you advise which cron job it is and how to check whether it's working properly?

anonymous profile picture
Account deleted
Posts: 1643

09 May 2010, 19:11

Aha, I was not correct. It's not a cron job that updates it. Instead, the Auth plugin type subscribes to a bunch of internal Mahara events in order to update the flag. Because you were updating the flag in the database directly, the Mahara events weren't being triggered. See the PluginAuth class in auth/lib.php (at the bottom) for more details.

4 results