Download & Extend

Suggestion: select roles/users by name

Project:Hidden Content
Version:5.x-1.0
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

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

Comments

#1

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

nobody click here