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

kubaZygmunt drupal-devel at drupal.org
Wed Aug 3 10:34:05 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:   kubaZygmunt
-Status:       patch (code needs work)
+Status:       patch (code needs review)
 Attachment:   http://drupal.org/files/issues/unique.roles.patch_0.txt (1.57 KB)

Ok, I've changed code. I hope that this code will be good enough. ;)




kubaZygmunt



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.




------------------------------------------------------------------------

Tue, 02 Aug 2005 14:24:40 +0000 : breyten

+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) {
.
.
.







More information about the drupal-devel mailing list