0

I want to show a block only on these user pages: .../user/USER_ID/recurring-fees. What will be the code to be placed in the PHP box to make this work?

2

I'm not sure what you mean by the PHP box. You could do this with the block's visibility settings. For example, if you wanted to show the "Powered by Drupal" block on only the URLs you mentioned, you would go to...

/admin/structure/block/manage/system/powered-by/configure

...and in the Pages tab of the Visibility Settings, enter...

user/*/recurring-fees

Also make sure you have ticked the radio button for "Only the listed pages".

If you are coding the block yourself, you could do something toward the top of your block function like...

if ('user' !== arg(0) || !is_numeric(arg(1)) || 'recurring-fees' !== arg(2)) {
 return array();
}

See http://api.drupal.org/api/drupal/includes!bootstrap.inc/function/arg/7

But the usual approach is to use the visibility settings.

  • This actually worked! What a dummy (the PHP box is the "Pages on which this PHP code returns TRUE (experts only)" area). THANKS! @arnoldbird – Otter Creative Studio Mar 17 '13 at 3:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.