[drupal-devel] [feature] Unique roles feature patch

breyten drupal-devel at drupal.org
Tue Aug 2 14:24:45 UTC 2005


Issue status update for 
http://drupal.org/node/27958
Post a follow up: 
http://drupal.org/project/comments/add/27958

 Project:      Drupal
 Version:      cvs
 Component:    user.module
 Category:     feature requests
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  kubaZygmunt
 Updated by:   breyten
-Status:       patch (code needs review)
+Status:       patch (code needs work)

+1 on feature (I think it's always useful to have these kind of checks
-- will probably save us bug reports in the future;), but -1 on the
patch. It's not necessary to call db_fetch_object to just get a role
id. You can change it to this:
$rid = db_result(db_query("SELECT rid FROM {role} WHERE name = '%s'",
$edit['name']);
and then simply
if ($rid) {
.
.
.




breyten



Previous comments:
------------------------------------------------------------------------

Mon, 01 Aug 2005 16:01:56 +0000 : kubaZygmunt

Attachment: http://drupal.org/files/issues/unique.roles.patch.txt (1.61 KB)

I've added code which prevents user from submiting 2 roles with the same
name.







More information about the drupal-devel mailing list