block visibility snippet restrict path I use the following snippet to restrict who can see a block inside admin pages. Can you help me add the restriction of a path /cart* for non admin users into this snippet?

if (user_access('access administration pages')) {
  return FALSE;
} else {
  return TRUE;
}
I am assuming the logic is:

Display this block only on pages with a path beginning with cart/*,
And only when the user has `access administration pages` permission


If so....

if (arg(0)=='cart' &amp;&amp; arg(1) &amp;&amp; user_access('access administration pages')) {
  return TRUE;
} else {
  return FALSE;
}


If you want it displayed on path cart all by itself as well, just remove the &amp;&amp; arg(1) from the above and then it will work on cart in addtion to cart/foo and cart/foo/bar etc.

If, however, you want it only on cart/oneargumentonly, you can add in &amp;&amp; !arg(2).

ADDITION/CORRECTION:

if (user_access('access administration pages') || (arg(0)=='cart' &amp;&amp; arg(1))) {
  return FALSE;
} else {
  return TRUE;
}


while return FALSE if the user can access administration pages regardless of the path OR the path is cart/* regardless of any permissions.

So, if my logic is right now, if the user can access administration pages the if is "short circuited" and returns FALSE.  Otherwise, if the user doesn't have this permission, it continues on and if the path is cart/* it returns FALSE.  Otherwise, since we already know the user doesn't have the access administration pages permission it returns TRUE for any other path.

FINAL?

if (user_access('access administration pages') || arg(0)=='cart') {
  return FALSE;
} else {
  return TRUE;
}