Closed (fixed)
Project:
Custom Breadcrumbs
Version:
6.x-2.0-beta3
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
2 Aug 2010 at 13:56 UTC
Updated:
15 Jul 2011 at 12:39 UTC
Hi,
I'm new to Custom Breadcrumbs, but I can't see an answer to this one...
I'm trying to set the visibility based on a user role, but I can't get the code to work properly.
I've got:
<?php global $user;
if in_array('staff member',$user->roles){
return false;
}else{
return true;
} ?>
with a normal ('authenticated user') the subsequent breadcrumb should appear, but it doesn't.
What am I doing wrong?
Comments
Comment #1
MGN commentedDon't include the php tags in the breadcrumb visibility field (its assumed for this field), and put parentheses around in_array and it should work
Comment #2
gmak commentedAh, so simple and yet...
Maybe the instruction text below the visibility field should explain that the php tags are not necessary. That seems contrary to most other fields where you can input php code (like the titles and paths fields on the same form).
Thanks for your help.
Comment #3
MGN commentedI agree, the documentation needs to be more explicit. I'll get that into the next commit.
Comment #4
gmak commentedJust wanted to say, documentation issues aside, this is a great module. The more I understand it's use, the more it's making my site infinitely more usable.
Thanks for all your hard work!
Comment #5
MGN commentedThanks. #872926: Field description for Breadcrumb Visibility with PHP. is another request for the updated documentation. I'll go ahead and mark this issue as fixed, and follow up on that issue.
Comment #7
khosman commentedI've just started running the latest dev version (as opposed to the beta listed above) - and I'm not seeing any note "not to include" opening/closing php tags. It took me a lot of time before figuring this out and it'd be a great time-saver to include for people just discovering this module. I see this thread is nearly a year old now. Has the fix been included in some other version I'm not seeing?
Comment #8
MGN commentedThanks. I found three places where these instructions were missing from the UI (custom_breadcrumbs_views, _panels, and api), so I suspect you are not seeing the note when creating a custom breadcrumb of one of these types. But you should see it when creating any of the other types (node, path, taxonomy). The fix has now been committed to 6.x-2.x-dev.