Closed (works as designed)
Project:
Better Formats
Version:
6.x-1.2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Jan 2011 at 15:00 UTC
Updated:
24 Feb 2011 at 15:09 UTC
+++ /opt/lampp/htdocs/mediacurrent/alaskadispatch_com/sites/all/modules/better_formats/better_formats.module (working copy)
@@ -455,7 +455,11 @@
$types = $type;
$format = array();
- $roles = implode(',', array_keys($user->roles));
+
+ foreach ($user->roles as $key => $name)
+ $roles [] = db_result(db_query('SELECT rid FROM {role} WHERE name = "%s"', $name));
+
+ $roles = implode(',', $roles);
// Prepare types for SQL.
if ($mode !== 'block' && $per_node_type && $node_type) {
This is kind of a quick example, I'm sure you could come up with something better, but I have an OP site and the keys to the $user->roles aren't always the numeric rid, sometimes its the role name which causes a db error. I think we need something more reliable.
Comments
Comment #1
dragonwize commentedIf your keys are not role IDs then something is wrong with your site. user_load is where the roles are loaded into the user object: http://api.drupal.org/api/drupal/modules--user--user.module/function/use...
Comment #2
drupalninja99 commentedIt's weird that it's giving me that in the $user->roles, I am using open publish 2.3.
Comment #3
jdonson commentedWhy are roles not listed in order of rid @ admin/user/roles?
This makes me want to hack core, and I shant, but please give me some solutions. thx!
Comment #4
jdonson commentedsame for
admin/user/permissions
Comment #5
dragonwize commented@jdonson
Please do not hijack an issue for something unrelated.
Those are core pages and are ordered alphabetically. As with everything else, if you do not like it, Drupal provides methods to change whatever you want.