[support] block visibility based on role AND path

Steve Kessler skessler at denverdataman.com
Mon Oct 6 14:51:23 UTC 2008


I am not using any PHP. 

In Show block for specific roles: I have anonymous user checked and then in
page specific viability settings I have Show on only the listed pages
selected and then I have the path content/contact-coredinated-movement for
the page listed. 

Thanks,
Steve

Steve Kessler 
Denver DataMan 
303-587-4428 
Sign up for the Denver DataMan Free eNewsletter


-----Original Message-----
From: Nick Young [mailto:nick_young at ncsu.edu] 
Sent: Monday, October 06, 2008 8:46 AM
To: Steve Kessler
Subject: Re: [support] block visibility based on role AND path

This looks like what i want to do.

What is the setting/php snippet that you are using to achieve this?

--Nick

........................................................................
Nick Young
Outreach, Communications & Consulting
Office of Information Technology
North Carolina State University
Box 7109, Raleigh 27695
Ph. 919.513.2716 | E-Mail: nick_young at ncsu.edu <mailto:nick_young at ncsu.edu>
........................................................................



Steve Kessler wrote:
> I will need to take this down latter today bit the block on this page
> http://www.coredinatedmovement.com/content/contact-coredinated-movement
> (conditions test) only appears if you are anonymous and you are on the
> specific page. Conditions built into Drupal are AND not OR.  
>
> Steve Kessler 
> Denver DataMan 
> 303-587-4428 
> Sign up for the Denver DataMan Free eNewsletter
>
>
> -----Original Message-----
> From: Nick Young [mailto:nick_young at ncsu.edu] 
> Sent: Monday, October 06, 2008 8:10 AM
> To: support at drupal.org
> Subject: Re: [support] block visibility based on role AND path
>
> The issue is that i need to check on the combination of conditions, 
> rather than just one.
>
> IE:
> I need the block to display only if BOTH conditions are met.
> I need the block to NOT display if none or only one condition is met.
>
> The built-in options only allow you to check for one type of condition 
> (path OR role).
>
> I need it to check for path AND role.
>
> --Nick
>
> ........................................................................
> Nick Young
> Outreach, Communications & Consulting
> Office of Information Technology
> North Carolina State University
> Box 7109, Raleigh 27695
> Ph. 919.513.2716 | E-Mail: nick_young at ncsu.edu
<mailto:nick_young at ncsu.edu>
> ........................................................................
>
>
>
> Steve Kessler wrote:
>   
>> Why does PHP need to be used. In the blocks settings you can determine 
>> visibility for a specific roles as well as specific paths.
>>
>>  
>>
>> For example you could say that only editors see an editing tool bar on 
>> all pages content/*
>>
>>  
>>
>> I may be missing what is going on here but this sounds similar than 
>> needing to do PHP.
>>
>>  
>>
>> Thanks,
>>
>> Steve
>>
>>  
>>
>> Steve Kessler
>>
>> *Denver DataMan *
>>
>> 303-587-4428
>>
>> Sign up for the Denver DataMan Free eNewsletter 
>> <http://www.denverdataman.com/content/enewsletter-signup>
>>
>>  
>>
>> *From:* bharani kumar [mailto:bharanikumariyerphp at gmail.com]
>> *Sent:* Monday, October 06, 2008 7:34 AM
>> *To:* support at drupal.org; nick_young at ncsu.edu
>> *Subject:* Re: [support] block visibility based on role AND path
>>
>>  
>>
>> May  this is clue,
>>
>> If you know  member id,  ,
>>
>> Go to block  configure
>>
>> select  " Show if the following PHP code returns |TRUE| (PHP-mode, 
>> experts only). "
>>
>> and write the code
>>
>> global $user
>>
>> $userid=$user->uid;
>> if($userid ==10 || $userid ==10  ){
>>     
>> return TRUE;
>>
>> }
>> else{
>>
>> return FALSE;
>> }
>>
>> On Mon, Oct 6, 2008 at 6:19 PM, Nick Young <nick_young at ncsu.edu 
>> <mailto:nick_young at ncsu.edu>> wrote:
>>
>> (Issue in Drupal 6)
>> I need a php snippet that allows me to display (or hide) a block based
>> on whether the user logged in is a member of a certain role, and that
>> they are browsing the site at a certain path. I am able to display a
>> block based on one of these things, but not both.
>>
>> IE:
>> I can display a block if the user is a member of a role.
>> I can display a block at a certain path (<site>/node/path/x)
>>
>> However, if i combine the two pieces of php code, then if one of them
>> returns true, the block shows. What i need is for it to check if the
>> path is TRUE, and then also check for the role membership. I have tested
>> the code externally to Drupal, to make sure the nested IF statements are
>> working properly, and they are. It's almost as if Drupal sees the first
>> TRUE, and then stops looking to see if there are multiple conditions to
>> check for as well.
>>
>> Any ideas? Thanks in advance.
>>
>> ........................................................................
>> Nick Young
>> Outreach, Communications & Consulting
>> Office of Information Technology
>> North Carolina State University
>> Box 7109, Raleigh 27695
>> Ph. 919.513.2716 | E-Mail: nick_young at ncsu.edu 
>> <mailto:nick_young at ncsu.edu> <mailto:nick_young at ncsu.edu 
>> <mailto:nick_young at ncsu.edu>>
>> ........................................................................
>>
>>
>>
>> --
>> [ Drupal support list | http://lists.drupal.org/ ]
>>
>>  
>>
>>     
>
>   



More information about the support mailing list