1-866-277-9958

Sanitize User Table in Drupal

#!/bin/bash
 
drush sqlq "UPDATE {users} SET pass = md5('pass') WHERE uid > 1;"
drush sqlq "UPDATE {users} SET mail = concat('myaddr+', replace(mail, '@', '_'), '@testdomain.org') WHERE uid <> 0 AND instr(mail, '@testdomain.org') = 0;"

These drush commands will set all users that are not anonymous or user 1 to password "pass" and sanitize all email addresses.

dustinc@getlevelten.com becomes myaddr+dustinc_getlevelten.com@testdomain.org

drush has a --sanitize opt for sql-sync, and this code works the same way --sanitize works but will do it outside of synching a database.

Your rating: None Average: 3 (1 vote)
Syndicate content

©1999 - 2011 LevelTen Interactive - Dallas, TX