Commit ff9e8427 authored by webchick's avatar webchick

#330983 by recidive and boombatower: Rename users/users_roles tables to...

#330983 by recidive and boombatower: Rename users/users_roles tables to user/user_role for consistency.
parent df591c8f
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* *
* Fields on the file object: * Fields on the file object:
* - fid - File ID * - fid - File ID
* - uid - The {users}.uid of the user who is associated with the file. * - uid - The {user}.uid of the user who is associated with the file.
* - filename - Name of the file with no path components. This may differ from * - filename - Name of the file with no path components. This may differ from
* the basename of the filepath if the file is renamed to avoid overwriting * the basename of the filepath if the file is renamed to avoid overwriting
* an existing file. * an existing file.
......
...@@ -195,7 +195,7 @@ function user_hash_password($password, $count_log2 = 0) { ...@@ -195,7 +195,7 @@ function user_hash_password($password, $count_log2 = 0) {
* @param $password * @param $password
* A plain-text password * A plain-text password
* @param $account * @param $account
* A user object with at least the fields from the {users} table. * A user object with at least the fields from the {user} table.
* *
* @return * @return
* TRUE or FALSE. * TRUE or FALSE.
...@@ -227,7 +227,7 @@ function user_check_password($password, $account) { ...@@ -227,7 +227,7 @@ function user_check_password($password, $account) {
* on the fields in $account. * on the fields in $account.
* *
* @param $account * @param $account
* A user object with at least the fields from the {users} table. * A user object with at least the fields from the {user} table.
* *
* @return * @return
* TRUE or FALSE. * TRUE or FALSE.
......
...@@ -83,7 +83,7 @@ function _sess_read($key) { ...@@ -83,7 +83,7 @@ function _sess_read($key) {
// Otherwise, if the session is still active, we have a record of the // Otherwise, if the session is still active, we have a record of the
// client's session in the database. // client's session in the database.
$user = db_query("SELECT u.*, s.* FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = :sid", array(':sid' => $key))->fetchObject(); $user = db_query("SELECT u.*, s.* FROM {user} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = :sid", array(':sid' => $key))->fetchObject();
// We found the client's session record and they are an authenticated user. // We found the client's session record and they are an authenticated user.
if ($user && $user->uid > 0) { if ($user && $user->uid > 0) {
...@@ -93,7 +93,7 @@ function _sess_read($key) { ...@@ -93,7 +93,7 @@ function _sess_read($key) {
// Add roles element to $user. // Add roles element to $user.
$user->roles = array(); $user->roles = array();
$user->roles[DRUPAL_AUTHENTICATED_RID] = 'authenticated user'; $user->roles[DRUPAL_AUTHENTICATED_RID] = 'authenticated user';
$user->roles += db_query("SELECT r.rid, r.name FROM {role} r INNER JOIN {users_roles} ur ON ur.rid = r.rid WHERE ur.uid = :uid", array(':uid' => $user->uid))->fetchAllKeyed(0, 1); $user->roles += db_query("SELECT r.rid, r.name FROM {role} r INNER JOIN {user_role} ur ON ur.rid = r.rid WHERE ur.uid = :uid", array(':uid' => $user->uid))->fetchAllKeyed(0, 1);
} }
// We didn't find the client's record (session has expired), or they // We didn't find the client's record (session has expired), or they
// are an anonymous user. // are an anonymous user.
...@@ -146,7 +146,7 @@ function _sess_write($key, $value) { ...@@ -146,7 +146,7 @@ function _sess_write($key, $value) {
// Last access time is updated no more frequently than once every 180 seconds. // Last access time is updated no more frequently than once every 180 seconds.
// This reduces contention in the users table. // This reduces contention in the users table.
if ($user->uid && REQUEST_TIME - $user->access > variable_get('session_write_interval', 180)) { if ($user->uid && REQUEST_TIME - $user->access > variable_get('session_write_interval', 180)) {
db_update('users') db_update('user')
->fields(array( ->fields(array(
'access' => REQUEST_TIME 'access' => REQUEST_TIME
)) ))
......
...@@ -117,7 +117,7 @@ function block_schema() { ...@@ -117,7 +117,7 @@ function block_schema() {
'type' => 'int', 'type' => 'int',
'unsigned' => TRUE, 'unsigned' => TRUE,
'not null' => TRUE, 'not null' => TRUE,
'description' => "The user's role ID from {users_roles}.rid.", 'description' => "The user's role ID from {user_role}.rid.",
), ),
), ),
'primary key' => array('module', 'delta', 'rid'), 'primary key' => array('module', 'delta', 'rid'),
......
...@@ -30,7 +30,7 @@ function blogapi_schema() { ...@@ -30,7 +30,7 @@ function blogapi_schema() {
'type' => 'serial', 'type' => 'serial',
), ),
'uid' => array( 'uid' => array(
'description' => 'The {users}.uid of the user who is associated with the file.', 'description' => 'The {user}.uid of the user who is associated with the file.',
'type' => 'int', 'type' => 'int',
'unsigned' => TRUE, 'unsigned' => TRUE,
'not null' => TRUE, 'not null' => TRUE,
......
...@@ -379,13 +379,13 @@ function blogapi_blogger_get_recent_posts($appkey, $blogid, $username, $password ...@@ -379,13 +379,13 @@ function blogapi_blogger_get_recent_posts($appkey, $blogid, $username, $password
} }
if ($bodies) { if ($bodies) {
$result = db_query_range("SELECT n.nid, n.title, r.body, r.format, n.comment, n.created, u.name FROM {node} n, {node_revision} r, {users} u WHERE n.uid = u.uid AND n.vid = r.vid AND n.type = :type AND n.uid = :uid ORDER BY n.created DESC", array( $result = db_query_range("SELECT n.nid, n.title, r.body, r.format, n.comment, n.created, u.name FROM {node} n, {node_revision} r, {user} u WHERE n.uid = u.uid AND n.vid = r.vid AND n.type = :type AND n.uid = :uid ORDER BY n.created DESC", array(
':type' => $blogid, ':type' => $blogid,
':uid' => $user->uid ':uid' => $user->uid
), 0, $number_of_posts); ), 0, $number_of_posts);
} }
else { else {
$result = db_query_range("SELECT n.nid, n.title, n.created, u.name FROM {node} n, {users} u WHERE n.uid = u.uid AND n.type = :type AND n.uid = :uid ORDER BY n.created DESC", array( $result = db_query_range("SELECT n.nid, n.title, n.created, u.name FROM {node} n, {user} u WHERE n.uid = u.uid AND n.type = :type AND n.uid = :uid ORDER BY n.created DESC", array(
':type' => $blogid, ':type' => $blogid,
':uid' => $user->uid ':uid' => $user->uid
), 0, $number_of_posts); ), 0, $number_of_posts);
......
...@@ -66,7 +66,7 @@ function comment_admin_overview($type = 'new', $arg) { ...@@ -66,7 +66,7 @@ function comment_admin_overview($type = 'new', $arg) {
'operations' => array('data' => t('Operations')), 'operations' => array('data' => t('Operations')),
); );
$result = pager_query('SELECT c.subject, c.nid, c.cid, c.comment, c.timestamp, c.status, c.name, c.homepage, u.name AS registered_name, u.uid, n.title as node_title FROM {comment} c INNER JOIN {users} u ON u.uid = c.uid INNER JOIN {node} n ON n.nid = c.nid WHERE c.status = %d' . tablesort_sql($header), 50, 0, NULL, $status); $result = pager_query('SELECT c.subject, c.nid, c.cid, c.comment, c.timestamp, c.status, c.name, c.homepage, u.name AS registered_name, u.uid, n.title as node_title FROM {comment} c INNER JOIN {user} u ON u.uid = c.uid INNER JOIN {node} n ON n.nid = c.nid WHERE c.status = %d' . tablesort_sql($header), 50, 0, NULL, $status);
// Build a table listing the appropriate comments. // Build a table listing the appropriate comments.
$options = array(); $options = array();
...@@ -205,7 +205,7 @@ function comment_multiple_delete_confirm_submit($form, &$form_state) { ...@@ -205,7 +205,7 @@ function comment_multiple_delete_confirm_submit($form, &$form_state) {
* The comment to be deleted. * The comment to be deleted.
*/ */
function comment_delete($cid = NULL) { function comment_delete($cid = NULL) {
$comment = db_fetch_object(db_query('SELECT c.*, u.name AS registered_name, u.uid FROM {comment} c INNER JOIN {users} u ON u.uid = c.uid WHERE c.cid = %d', $cid)); $comment = db_fetch_object(db_query('SELECT c.*, u.name AS registered_name, u.uid FROM {comment} c INNER JOIN {user} u ON u.uid = c.uid WHERE c.cid = %d', $cid));
$comment->name = $comment->uid ? $comment->registered_name : $comment->name; $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
$output = ''; $output = '';
...@@ -272,7 +272,7 @@ function _comment_delete_thread($comment) { ...@@ -272,7 +272,7 @@ function _comment_delete_thread($comment) {
comment_invoke_comment($comment, 'delete'); comment_invoke_comment($comment, 'delete');
// Delete the comment's replies. // Delete the comment's replies.
$result = db_query('SELECT c.*, u.name AS registered_name, u.uid FROM {comment} c INNER JOIN {users} u ON u.uid = c.uid WHERE pid = %d', $comment->cid); $result = db_query('SELECT c.*, u.name AS registered_name, u.uid FROM {comment} c INNER JOIN {user} u ON u.uid = c.uid WHERE pid = %d', $comment->cid);
while ($comment = db_fetch_object($result)) { while ($comment = db_fetch_object($result)) {
$comment->name = $comment->uid ? $comment->registered_name : $comment->name; $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
_comment_delete_thread($comment); _comment_delete_thread($comment);
......
...@@ -181,7 +181,7 @@ function comment_schema() { ...@@ -181,7 +181,7 @@ function comment_schema() {
'type' => 'int', 'type' => 'int',
'not null' => TRUE, 'not null' => TRUE,
'default' => 0, 'default' => 0,
'description' => 'The {users}.uid who authored the comment. If set to 0, this comment was created by an anonymous user.', 'description' => 'The {user}.uid who authored the comment. If set to 0, this comment was created by an anonymous user.',
), ),
'subject' => array( 'subject' => array(
'type' => 'varchar', 'type' => 'varchar',
...@@ -234,7 +234,7 @@ function comment_schema() { ...@@ -234,7 +234,7 @@ function comment_schema() {
'type' => 'varchar', 'type' => 'varchar',
'length' => 60, 'length' => 60,
'not null' => FALSE, 'not null' => FALSE,
'description' => "The comment author's name. Uses {users}.name if the user is logged in, otherwise uses the value typed into the comment form.", 'description' => "The comment author's name. Uses {user}.name if the user is logged in, otherwise uses the value typed into the comment form.",
), ),
'mail' => array( 'mail' => array(
'type' => 'varchar', 'type' => 'varchar',
......
...@@ -1058,7 +1058,7 @@ function comment_render($node, $cid = 0) { ...@@ -1058,7 +1058,7 @@ function comment_render($node, $cid = 0) {
$query->fields('c', array('cid', 'nid', 'pid', 'comment', 'subject', 'format', 'timestamp', 'name', 'mail', 'homepage', 'status') ); $query->fields('c', array('cid', 'nid', 'pid', 'comment', 'subject', 'format', 'timestamp', 'name', 'mail', 'homepage', 'status') );
$query->fields('u', array( 'uid', 'signature', 'picture', 'data', 'status') ); $query->fields('u', array( 'uid', 'signature', 'picture', 'data', 'status') );
$query->addField('u', 'name', 'registered_name'); $query->addField('u', 'name', 'registered_name');
$query->innerJoin('users', 'u', 'c.uid = u.uid'); $query->innerJoin('user', 'u', 'c.uid = u.uid');
$query->condition('c.cid', $cid); $query->condition('c.cid', $cid);
if (!user_access('administer comments')) { if (!user_access('administer comments')) {
...@@ -1084,7 +1084,7 @@ function comment_render($node, $cid = 0) { ...@@ -1084,7 +1084,7 @@ function comment_render($node, $cid = 0) {
// Multiple comment view. // Multiple comment view.
$query_count = 'SELECT COUNT(*) FROM {comment} c WHERE c.nid = %d'; $query_count = 'SELECT COUNT(*) FROM {comment} c WHERE c.nid = %d';
$query = 'SELECT c.cid as cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, c.homepage, u.uid, u.name AS registered_name, u.signature, u.picture, u.data, c.thread, c.status FROM {comment} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.nid = %d'; $query = 'SELECT c.cid as cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, c.homepage, u.uid, u.name AS registered_name, u.signature, u.picture, u.data, c.thread, c.status FROM {comment} c INNER JOIN {user} u ON c.uid = u.uid WHERE c.nid = %d';
$query_args = array($nid); $query_args = array($nid);
if (!user_access('administer comments')) { if (!user_access('administer comments')) {
...@@ -1292,7 +1292,7 @@ function comment_validate($edit) { ...@@ -1292,7 +1292,7 @@ function comment_validate($edit) {
$node = node_load($edit['nid']); $node = node_load($edit['nid']);
if (variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) > COMMENT_ANONYMOUS_MAYNOT_CONTACT) { if (variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) > COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
if ($edit['name']) { if ($edit['name']) {
$query = db_select('users', 'u'); $query = db_select('user', 'u');
$query->addField('u', 'uid', 'uid'); $query->addField('u', 'uid', 'uid');
$taken = $query->where('LOWER(name) = :name', array(':name' => $edit['name'])) $taken = $query->where('LOWER(name) = :name', array(':name' => $edit['name']))
->countQuery() ->countQuery()
...@@ -1635,7 +1635,7 @@ function comment_form_add_preview($form, &$form_state) { ...@@ -1635,7 +1635,7 @@ function comment_form_add_preview($form, &$form_state) {
$output = ''; // Isn't this line a duplication of the first $output above? $output = ''; // Isn't this line a duplication of the first $output above?
if ($edit['pid']) { if ($edit['pid']) {
$comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.signature, u.picture, u.data FROM {comment} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid AND c.status = :status', array( $comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.signature, u.picture, u.data FROM {comment} c INNER JOIN {user} u ON c.uid = u.uid WHERE c.cid = :cid AND c.status = :status', array(
':cid' => $edit['pid'], ':cid' => $edit['pid'],
':status' => COMMENT_PUBLISHED )) ':status' => COMMENT_PUBLISHED ))
->fetchObject(); ->fetchObject();
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
*/ */
function comment_edit($cid) { function comment_edit($cid) {
global $user; global $user;
$comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.data FROM {comment} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid', array(':cid'=>$cid) )->fetchObject(); $comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.data FROM {comment} c INNER JOIN {user} u ON c.uid = u.uid WHERE c.cid = :cid', array(':cid'=>$cid) )->fetchObject();
$comment = drupal_unpack($comment); $comment = drupal_unpack($comment);
$comment->name = $comment->uid ? $comment->registered_name : $comment->name; $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
...@@ -69,7 +69,7 @@ function comment_reply($node, $pid = NULL) { ...@@ -69,7 +69,7 @@ function comment_reply($node, $pid = NULL) {
// $pid indicates that this is a reply to a comment. // $pid indicates that this is a reply to a comment.
if ($pid) { if ($pid) {
// Load the comment whose cid = $pid // Load the comment whose cid = $pid
$comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.signature, u.picture, u.data FROM {comment} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid AND c.status = :status', array( $comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.signature, u.picture, u.data FROM {comment} c INNER JOIN {user} u ON c.uid = u.uid WHERE c.cid = :cid AND c.status = :status', array(
':cid'=>$pid, ':cid'=>$pid,
':status'=>COMMENT_PUBLISHED))->fetchObject(); ':status'=>COMMENT_PUBLISHED))->fetchObject();
if ( $comment ) { if ( $comment ) {
......
...@@ -63,7 +63,7 @@ function dblog_overview() { ...@@ -63,7 +63,7 @@ function dblog_overview() {
array('data' => t('Operations')), array('data' => t('Operations')),
); );
$sql = "SELECT w.wid, w.uid, w.severity, w.type, w.timestamp, w.message, w.variables, w.link, u.name FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid"; $sql = "SELECT w.wid, w.uid, w.severity, w.type, w.timestamp, w.message, w.variables, w.link, u.name FROM {watchdog} w INNER JOIN {user} u ON w.uid = u.uid";
$tablesort = tablesort_sql($header); $tablesort = tablesort_sql($header);
if (!empty($filter['where'])) { if (!empty($filter['where'])) {
$result = pager_query($sql . " WHERE " . $filter['where'] . $tablesort, 50, 0, NULL, $filter['args']); $result = pager_query($sql . " WHERE " . $filter['where'] . $tablesort, 50, 0, NULL, $filter['args']);
...@@ -132,7 +132,7 @@ function dblog_top($type) { ...@@ -132,7 +132,7 @@ function dblog_top($type) {
function dblog_event($id) { function dblog_event($id) {
$severity = watchdog_severity_levels(); $severity = watchdog_severity_levels();
$output = ''; $output = '';
$result = db_query('SELECT w.*, u.name, u.uid FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid WHERE w.wid = %d', $id); $result = db_query('SELECT w.*, u.name, u.uid FROM {watchdog} w INNER JOIN {user} u ON w.uid = u.uid WHERE w.wid = %d', $id);
if ($dblog = db_fetch_object($result)) { if ($dblog = db_fetch_object($result)) {
$rows = array( $rows = array(
array( array(
......
...@@ -33,7 +33,7 @@ function dblog_schema() { ...@@ -33,7 +33,7 @@ function dblog_schema() {
'type' => 'int', 'type' => 'int',
'not null' => TRUE, 'not null' => TRUE,
'default' => 0, 'default' => 0,
'description' => 'The {users}.uid of the user who triggered the event.', 'description' => 'The {user}.uid of the user who triggered the event.',
), ),
'type' => array( 'type' => array(
'type' => 'varchar', 'type' => 'varchar',
......
...@@ -613,7 +613,7 @@ function forum_get_forums($tid = 0) { ...@@ -613,7 +613,7 @@ function forum_get_forums($tid = 0) {
// This query does not use full ANSI syntax since MySQL 3.x does not support // This query does not use full ANSI syntax since MySQL 3.x does not support
// table1 INNER JOIN table2 INNER JOIN table3 ON table2_criteria ON table3_criteria // table1 INNER JOIN table2 INNER JOIN table3 ON table2_criteria ON table3_criteria
// used to join node_comment_statistics to users. // used to join node_comment_statistics to users.
$sql = "SELECT ncs.last_comment_timestamp, IF (ncs.last_comment_uid != 0, u2.name, ncs.last_comment_name) AS last_comment_name, ncs.last_comment_uid FROM {node} n INNER JOIN {users} u1 ON n.uid = u1.uid INNER JOIN {taxonomy_term_node} tn ON n.vid = tn.vid INNER JOIN {node_comment_statistics} ncs ON n.nid = ncs.nid INNER JOIN {users} u2 ON ncs.last_comment_uid=u2.uid WHERE n.status = 1 AND tn.tid = %d ORDER BY ncs.last_comment_timestamp DESC"; $sql = "SELECT ncs.last_comment_timestamp, IF (ncs.last_comment_uid != 0, u2.name, ncs.last_comment_name) AS last_comment_name, ncs.last_comment_uid FROM {node} n INNER JOIN {user} u1 ON n.uid = u1.uid INNER JOIN {taxonomy_term_node} tn ON n.vid = tn.vid INNER JOIN {node_comment_statistics} ncs ON n.nid = ncs.nid INNER JOIN {user} u2 ON ncs.last_comment_uid=u2.uid WHERE n.status = 1 AND tn.tid = %d ORDER BY ncs.last_comment_timestamp DESC";
$sql = db_rewrite_sql($sql); $sql = db_rewrite_sql($sql);
$topic = db_fetch_object(db_query_range($sql, $forum->tid, 0, 1)); $topic = db_fetch_object(db_query_range($sql, $forum->tid, 0, 1));
...@@ -659,7 +659,7 @@ function forum_get_topics($tid, $sortby, $forum_per_page) { ...@@ -659,7 +659,7 @@ function forum_get_topics($tid, $sortby, $forum_per_page) {
} }
} }
$sql = db_rewrite_sql("SELECT n.nid, r.tid, n.title, n.type, n.sticky, u.name, u.uid, n.created AS timestamp, n.comment AS comment_mode, l.last_comment_timestamp, IF(l.last_comment_uid != 0, cu.name, l.last_comment_name) AS last_comment_name, l.last_comment_uid, l.comment_count AS num_comments, f.tid AS forum_tid FROM {node_comment_statistics} l INNER JOIN {node} n ON n.nid = l.nid INNER JOIN {users} cu ON l.last_comment_uid = cu.uid INNER JOIN {taxonomy_term_node} r ON n.vid = r.vid INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {forum} f ON n.vid = f.vid WHERE n.status = 1 AND r.tid = %d"); $sql = db_rewrite_sql("SELECT n.nid, r.tid, n.title, n.type, n.sticky, u.name, u.uid, n.created AS timestamp, n.comment AS comment_mode, l.last_comment_timestamp, IF(l.last_comment_uid != 0, cu.name, l.last_comment_name) AS last_comment_name, l.last_comment_uid, l.comment_count AS num_comments, f.tid AS forum_tid FROM {node_comment_statistics} l INNER JOIN {node} n ON n.nid = l.nid INNER JOIN {user} cu ON l.last_comment_uid = cu.uid INNER JOIN {taxonomy_term_node} r ON n.vid = r.vid INNER JOIN {user} u ON n.uid = u.uid INNER JOIN {forum} f ON n.vid = f.vid WHERE n.status = 1 AND r.tid = %d");
$sql .= tablesort_sql($forum_topic_list_header, 'n.sticky DESC,'); $sql .= tablesort_sql($forum_topic_list_header, 'n.sticky DESC,');
$sql .= ', n.created DESC'; // Always add a secondary sort order so that the news forum topics are on top. $sql .= ', n.created DESC'; // Always add a secondary sort order so that the news forum topics are on top.
......
...@@ -483,7 +483,7 @@ function node_admin_nodes() { ...@@ -483,7 +483,7 @@ function node_admin_nodes() {
$filter = node_build_filter_query(); $filter = node_build_filter_query();
$sort = tablesort_sql($header, '', 'n.changed DESC'); $sort = tablesort_sql($header, '', 'n.changed DESC');
$result = pager_query(db_rewrite_sql('SELECT n.*, u.name FROM {node} n '. $filter['join'] .' INNER JOIN {users} u ON n.uid = u.uid '. $filter['where'] . $sort), 50, 0, NULL, $filter['args']); $result = pager_query(db_rewrite_sql('SELECT n.*, u.name FROM {node} n '. $filter['join'] .' INNER JOIN {user} u ON n.uid = u.uid '. $filter['where'] . $sort), 50, 0, NULL, $filter['args']);
// Build the 'Update options' form. // Build the 'Update options' form.
$form['options'] = array( $form['options'] = array(
......
...@@ -43,7 +43,7 @@ function node_schema() { ...@@ -43,7 +43,7 @@ function node_schema() {
'default' => '', 'default' => '',
), ),
'uid' => array( 'uid' => array(
'description' => 'The {users}.uid that owns this node; initially, this is the user that created it.', 'description' => 'The {user}.uid that owns this node; initially, this is the user that created it.',
'type' => 'int', 'type' => 'int',
'not null' => TRUE, 'not null' => TRUE,
'default' => 0, 'default' => 0,
...@@ -227,7 +227,7 @@ function node_schema() { ...@@ -227,7 +227,7 @@ function node_schema() {
'not null' => TRUE, 'not null' => TRUE,
), ),
'uid' => array( 'uid' => array(
'description' => 'The {users}.uid that created this version.', 'description' => 'The {user}.uid that created this version.',
'type' => 'int', 'type' => 'int',
'not null' => TRUE, 'not null' => TRUE,
'default' => 0, 'default' => 0,
......
...@@ -855,7 +855,7 @@ function node_load_multiple($nids = array(), $conditions = array(), $reset = FAL ...@@ -855,7 +855,7 @@ function node_load_multiple($nids = array(), $conditions = array(), $reset = FAL
else { else {
$query->join('node_revision', 'r', 'r.vid = n.vid'); $query->join('node_revision', 'r', 'r.vid = n.vid');
} }
$query->join('users', 'u', 'u.uid = n.uid'); $query->join('user', 'u', 'u.uid = n.uid');
// Add fields from the {node} table. // Add fields from the {node} table.
$node_fields = drupal_schema_fields_sql('node'); $node_fields = drupal_schema_fields_sql('node');
...@@ -876,7 +876,7 @@ function node_load_multiple($nids = array(), $conditions = array(), $reset = FAL ...@@ -876,7 +876,7 @@ function node_load_multiple($nids = array(), $conditions = array(), $reset = FAL
$query->addField('r', 'timestamp', 'revision_timestamp'); $query->addField('r', 'timestamp', 'revision_timestamp');
$query->fields('r', $node_revision_fields); $query->fields('r', $node_revision_fields);
// Add fields from the {users} table. // Add fields from the {user} table.
$user_fields = array('name', 'picture', 'data'); $user_fields = array('name', 'picture', 'data');
$query->fields('u', $user_fields); $query->fields('u', $user_fields);
...@@ -1865,7 +1865,7 @@ function node_last_changed($nid) { ...@@ -1865,7 +1865,7 @@ function node_last_changed($nid) {
*/ */
function node_revision_list($node) { function node_revision_list($node) {
$revisions = array(); $revisions = array();
$result = db_query('SELECT r.vid, r.title, r.log, r.uid, n.vid AS current_vid, r.timestamp, u.name FROM {node_revision} r LEFT JOIN {node} n ON n.vid = r.vid INNER JOIN {users} u ON u.uid = r.uid WHERE r.nid = %d ORDER BY r.timestamp DESC', $node->nid); $result = db_query('SELECT r.vid, r.title, r.log, r.uid, n.vid AS current_vid, r.timestamp, u.name FROM {node_revision} r LEFT JOIN {node} n ON n.vid = r.vid INNER JOIN {user} u ON u.uid = r.uid WHERE r.nid = %d ORDER BY r.timestamp DESC', $node->nid);
while ($revision = db_fetch_object($result)) { while ($revision = db_fetch_object($result)) {
$revisions[$revision->vid] = $revision; $revisions[$revision->vid] = $revision;
} }
...@@ -3008,22 +3008,22 @@ function node_save_action($node) { ...@@ -3008,22 +3008,22 @@ function node_save_action($node) {
*/ */
function node_assign_owner_action(&$node, $context) { function node_assign_owner_action(&$node, $context) {
$node->uid = $context['owner_uid']; $node->uid = $context['owner_uid'];
$owner_name = db_result(db_query("SELECT name FROM {users} WHERE uid = %d", $context['owner_uid'])); $owner_name = db_result(db_query("SELECT name FROM {user} WHERE uid = %d", $context['owner_uid']));
watchdog('action', 'Changed owner of @type %title to uid %name.', array('@type' => node_get_types('type', $node), '%title' => $node->title, '%name' => $owner_name)); watchdog('action', 'Changed owner of @type %title to uid %name.', array('@type' => node_get_types('type', $node), '%title' => $node->title, '%name' => $owner_name));
} }
function node_assign_owner_action_form($context) { function node_assign_owner_action_form($context) {
$description = t('The username of the user to which you would like to assign ownership.'); $description = t('The username of the user to which you would like to assign ownership.');
$count = db_result(db_query("SELECT COUNT(*) FROM {users}")); $count = db_result(db_query("SELECT COUNT(*) FROM {user}"));
$owner_name = ''; $owner_name = '';
if (isset($context['owner_uid'])) { if (isset($context['owner_uid'])) {
$owner_name = db_result(db_query("SELECT name FROM {users} WHERE uid = %d", $context['owner_uid'])); $owner_name = db_result(db_query("SELECT name FROM {user} WHERE uid = %d", $context['owner_uid']));
} }
// Use dropdown for fewer than 200 users; textbox for more than that. // Use dropdown for fewer than 200 users; textbox for more than that.
if (intval($count) < 200) { if (intval($count) < 200) {
$options = array(); $options = array();
$result = db_query("SELECT uid, name FROM {users} WHERE uid > 0 ORDER BY name"); $result = db_query("SELECT uid, name FROM {user} WHERE uid > 0 ORDER BY name");
while ($data = db_fetch_object($result)) { while ($data = db_fetch_object($result)) {
$options[$data->name] = $data->name; $options[$data->name] = $data->name;
} }
...@@ -3050,7 +3050,7 @@ function node_assign_owner_action_form($context) { ...@@ -3050,7 +3050,7 @@ function node_assign_owner_action_form($context) {
} }
function node_assign_owner_action_validate($form, $form_state) { function node_assign_owner_action_validate($form, $form_state) {
$count = db_result(db_query("SELECT COUNT(*) FROM {users} WHERE name = '%s'", $form_state['values']['owner_name'])); $count = db_result(db_query("SELECT COUNT(*) FROM {user} WHERE name = '%s'", $form_state['values']['owner_name']));
if (intval($count) != 1) { if (intval($count) != 1) {
form_set_error('owner_name', t('Please enter a valid username.')); form_set_error('owner_name', t('Please enter a valid username.'));
} }
...@@ -3058,7 +3058,7 @@ function node_assign_owner_action_validate($form, $form_state) { ...@@ -3058,7 +3058,7 @@ function node_assign_owner_action_validate($form, $form_state) {
function node_assign_owner_action_submit($form, $form_state) { function node_assign_owner_action_submit($form, $form_state) {
// Username can change, so we need to store the ID, not the username. // Username can change, so we need to store the ID, not the username.
$uid = db_result(db_query("SELECT uid from {users} WHERE name = '%s'", $form_state['values']['owner_name'])); $uid = db_result(db_query("SELECT uid from {user} WHERE name = '%s'", $form_state['values']['owner_name']));
return array('owner_uid' => $uid); return array('owner_uid' => $uid);
} }
......
...@@ -92,13 +92,13 @@ function poll_schema() { ...@@ -92,13 +92,13 @@ function poll_schema() {
); );
$schema['poll_vote'] = array( $schema['poll_vote'] = array(
'description' => 'Stores per-{users} votes for each {poll}.', 'description' => 'Stores per-{user} votes for each {poll}.',
'fields' => array( 'fields' => array(
'chid' => array( 'chid' => array(
'type' => 'int', 'type' => 'int',
'unsigned' => TRUE, 'unsigned' => TRUE,
'not null' => TRUE, 'not null' => TRUE,
'description' => "The {users}'s vote for this poll.", 'description' => "The {user}'s vote for this poll.",
), ),
'nid' => array( 'nid' => array(
'type' => 'int', 'type' => 'int',
...@@ -111,7 +111,7 @@ function poll_schema() { ...@@ -111,7 +111,7 @@ function poll_schema() {
'unsigned' => TRUE, 'unsigned' => TRUE,
'not null' => TRUE, 'not null' => TRUE,
'default' => 0, 'default' => 0,
'description' => 'The {users}.uid this vote is from unless the voter was anonymous.', 'description' => 'The {user}.uid this vote is from unless the voter was anonymous.',
), ),
'hostname' => array( 'hostname' => array(
'type' => 'varchar', 'type' => 'varchar',
......
...@@ -35,7 +35,7 @@ function poll_votes($node) { ...@@ -35,7 +35,7 @@ function poll_votes($node) {
$header[] = array('data' => t('Vote'), 'field' => 'pc.chtext'); $header[] = array('data' => t('Vote'), 'field' => 'pc.chtext');
$header[] = array('data' => t('Timestamp'), 'field' => 'pv.timestamp', 'sort' => 'desc'); $header[] = array('data' => t('Timestamp'), 'field' => 'pv.timestamp', 'sort' => 'desc');
$result = pager_query("SELECT pv.chid, pv.uid, pv.hostname, pv.timestamp, pv.nid, pc.chtext, u.name FROM {poll_vote} pv INNER JOIN {poll_choice} pc ON pv.chid = pc.chid LEFT JOIN {users} u ON pv.uid = u.uid WHERE pv.nid = %d". tablesort_sql($header), 20, 0, NULL, $node->nid); $result = pager_query("SELECT pv.chid, pv.uid, pv.hostname, pv.timestamp, pv.nid, pc.chtext, u.name FROM {poll_vote} pv INNER JOIN {poll_choice} pc ON pv.chid = pc.chid LEFT JOIN {user} u ON pv.uid = u.uid WHERE pv.nid = %d". tablesort_sql($header), 20, 0, NULL, $node->nid);
$rows = array(); $rows = array();
while ($vote = db_fetch_object($result)) { while ($vote = db_fetch_object($result)) {
$rows[] = array( $rows[] = array(
......
...@@ -294,7 +294,7 @@ function profile_field_form_validate($form, &$form_state) { ...@@ -294,7 +294,7 @@ function profile_field_form_validate($form, &$form_state) {
form_set_error('name', t('The specified form name contains one or more illegal characters. Spaces or any other special characters except dash (-) and underscore (_) are not allowed.')); form_set_error('name', t('The specified form name contains one or more illegal characters. Spaces or any other special characters except dash (-) and underscore (_) are not allowed.'));
} }
$users_table = drupal_get_schema('users'); $users_table = drupal_get_schema('user');
if (!empty($users_table['fields'][$form_state['values']['name']])) { if (!empty($users_table['fields'][$form_state['values']['name']])) {
form_set_error('name', t('The specified form name is reserved for use by Drupal.')); form_set_error('name', t('The specified form name is reserved for use by Drupal.'));
} }
......
...@@ -132,7 +132,7 @@ function profile_schema() { ...@@ -132,7 +132,7 @@ function profile_schema() {
'unsigned' => TRUE, 'unsigned' => TRUE,
'not null' => TRUE, 'not null' => TRUE,
'default' => 0, 'default' => 0,
'description' => 'The {users}.uid of the profile user.', 'description' => 'The {user}.uid of the profile user.',
), ),
'value' => array( 'value' => array(
'type' => 'text', 'type' => 'text',
......
...@@ -55,7 +55,7 @@ function profile_browse() { ...@@ -55,7 +55,7 @@ function profile_browse() {
} }
// Extract the affected users: // Extract the affected users:
$result = pager_query("SELECT u.uid, u.access FROM {users} u INNER JOIN {profile_value} v ON u.uid = v.uid WHERE v.fid = %d AND $query AND u.access != 0 AND u.status != 0 ORDER BY u.access DESC", 20, 0, NULL, $arguments); $result = pager_query("SELECT u.uid, u.access FROM {user} u INNER JOIN {profile_value} v ON u.uid = v.uid WHERE v.fid = %d AND $query AND u.access != 0 AND u.status != 0 ORDER BY u.access DESC", 20, 0, NULL, $arguments);
$content = ''; $content = '';
while ($account = db_fetch_object($result)) { while ($account = db_fetch_object($result)) {
...@@ -88,7 +88,7 @@ function profile_browse() { ...@@ -88,7 +88,7 @@ function profile_browse() {
} }
// Extract the affected users: // Extract the affected users:
$result = pager_query('SELECT uid, access FROM {users} WHERE uid > 0 AND status != 0 AND access != 0 ORDER BY access DESC', 20, 0, NULL); $result = pager_query('SELECT uid, access FROM {user} WHERE uid > 0 AND status != 0 AND access != 0 ORDER BY access DESC', 20, 0, NULL);