How to programmatically set user state to "active"
You can use a combination of user_load_multiple() and user_save() to update the status property of the users:

$uids = db_query('SELECT uid FROM {users}')-&gt;fetchCol();
foreach (user_load_multiple($uids) as $account) {
  $account-&gt;status = 1;
  user_save($account);
}


It's worth bearing in mind that any mail notifications you have set to inform users of their account status will be invoked using this method.

If you don't want that to happen I think you'll have to go directly into the {users} table and set the status manually (not recommended):

db_update('users')
  -&gt;fields(array('status' =&gt; 1))
  -&gt;execute();