I have created block and i want to give the only listed paths

i.e user/user_id ex: user/123

i have given user/* but it displays all pages where users pages are there.

i tried below waysenter image description here

and enabled PHPFILTER and tried this

enter image description here


Try "extended_block_visibility" module, install it and then on block setting page select last option "pages on which this php code will return true" and then you can write php code inside php tag like :

if(arg(0) == 'user' && is_numeric(arg(1))){
return TRUE;
return FALSE;

But remember this code will save inside the DB and will break site if write wrong code. Alternatively you can define theme specific visibility using this module.

| improve this answer | |
  • ok will try and let you know. – RaMeSh Apr 7 '16 at 11:44
  • That will definitely work if you will face any problem then let me know :) – Manish Kumar Apr 11 '16 at 12:09

As an option you can use path alias, for example If my user's page alias is /users/myusername then you can set users/* in Visibility settings. So it will be available on user/* page, but not on user/*/* pages.

| improve this answer | |

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.