This is a good idea. It would simplify bits of code in lots of places.
I'll work on this. Thanks for the suggestions.

Cheers,
Dan


On Wed, Sep 23, 2009 at 6:47 AM, DrunkenMonk <[email protected]> wrote:
>
>
>
> (strpos(" ,$BOLTmemberships,", ",admin,")
>
> Replace this with a BOLTmembership('admin')
>
> function BOLTmembership($group) {
>   global $BOLTmembership;
>   $memberships = explode(',',$BOLTmembership);
>   if( is_array($group) )
>    foreach($group as $g)
>      if( in_array($g, $memberships) ) return true;
>   else
>    if( in_array($g, $memberships) ) return true;
>  return false;
> }
>
> Then you can test several group memberships at the same time, probably
> faster since strpos will check each character in the string. You get
> much cleaner code when calling it.
>
> if( BOLTmembership(array('admin', 'editor')) )
>  print("damn I've got the crazy memberships dawg");
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"BoltWire" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/boltwire?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to