Suggestion: select roles/users by name

Konstantin Boyandin - July 26, 2007 - 06:49
Project:Hidden Content
Version:5.x-1.0
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Greetings,

It's easy to allow selecting roles/users by name, not by id. E.g., this modified code snippet (lines 63-73 of the original .module)

        if(ereg('^ role="([ a-zA-Z0-9;]+)"\]',$part,$hit)){
          $roles=$hit[1];
          $part=ereg_replace('^ role="([ a-zA-Z0-9;]+)"\]','',$part);
          $show=false;
          $roles=explode(';',$roles);
          foreach($user->roles as $kr => $kv){
            if(in_array($kv, $roles)){
              $show=true; break;
            }
          }
        }else if(ereg('^ user=([0-9;]+)\]',$part,$hit)){

will allow using such hidden parts:

[hidden role="Admins"]
text for admins eyes only.
[/hidden]

Suggestion: allow using both names and ids. I have made local modification to handle that.

All the best,

Konstantin

#1

Christefano - January 29, 2008 - 09:30

Konstantin, would you like to post a patch with your local modification?

 
 

Drupal is a registered trademark of Dries Buytaert.