I am getting the following warning when updating user information or when a new user creates an account:

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: SELECT * FROM users_roles WHERE uid = 2 AND rid = in /home/bedigiti/public_html/_theparadox/includes/database.mysql.inc on line 172.

The relevant code appears to be:

/**
 * Supporting functions
 */

function _role_control_grant_role($user, $roleid) {
	// Verify this user isn't in this role already
	$result = db_query("SELECT * FROM {users_roles} WHERE uid = $user->uid AND rid = $roleid");
	$role_already_given = db_num_rows($result);
	if (!$role_already_given) {
		db_query('INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)', $user->uid, $roleid);
	}
}

function _role_control_deny_role($user, $roleid) {
	// Verify membership
	$result = db_query("SELECT * FROM {users_roles} WHERE uid = $user->uid AND rid = $roleid");
	$role_present = db_num_rows($result);
	if ($role_present) {
		db_query("DELETE FROM {users_roles} WHERE uid = %d AND rid = %d", $user->uid, $roleid);
	}
}

Comments

elliot’s picture

Assigned: Unassigned » elliot

cyrxi,
I'll try to take a look at this over the next few days. We don't have a setup where users can create new accounts, but I should be able to set something up. What version of Drupal are you using?
-Elliot

Carlos Miranda Levy’s picture

I installed it on one of my sites open to user registration and it works fine...

You may want to check other user related modules you may have installed...

elliot’s picture

Status: Active » Closed (fixed)

Since I haven't heard anything and I haven't seen this I'm going to close this issue, please open another if you find that in error.
-Elliot