function tracker_pathauto_bulkupdate in Pathauto 6
Same name and namespace in other branches
- 5.2 pathauto_user.inc \tracker_pathauto_bulkupdate()
- 5 pathauto_user.inc \tracker_pathauto_bulkupdate()
Bulk generate aliases for user trackers without aliases.
File
- ./
pathauto_user.inc, line 163 - Hook implementations for user module integration.
Code
function tracker_pathauto_bulkupdate() {
$concat = _pathauto_sql_concat("'user/'", 'u.uid', "'/track'");
$sql = "SELECT u.uid FROM {users} u LEFT JOIN {url_alias} ua ON {$concat} = ua.src WHERE u.uid > 0 AND ua.src IS NULL";
$query = db_query_range($sql, 0, variable_get('pathauto_max_bulk_update', 50));
$count = 0;
$placeholders = array();
while ($uid = db_result($query)) {
$account = user_load($uid);
$placeholders = pathauto_get_placeholders('user', $account);
$src = 'user/' . $account->uid . '/track';
if (pathauto_create_alias('tracker', 'bulkupdate', $placeholders, $src, $account->uid)) {
$count++;
}
}
drupal_set_message(format_plural($count, 'Bulk generation of user tracker pages completed, one alias generated.', 'Bulk generation of user tracker pages completed, @count aliases generated.'));
}