1

I am trying to display a block on an user edit page (example: user/123/edit/custom_url, but for some reason, I can't seem to get it working. Any help is appreciated.

I tried this, but this isn't working:

<?php
global $user;
if (arg(0) == 'user' && $user->uid == arg(1) && arg(2) == 'edit' && arg(3) == 'custom_url' ){
  return TRUE;
}
else {
  return FALSE;
}
?>
1
  • Check if you are setting the block in correct theme? Also use the way as suggested by @timodwhit in his answer. Don't use php code. (Just an Opinion) Jun 29, 2015 at 4:52

2 Answers 2

1

Using the block ui, you can select the visibility of block using user/*/edit/custom_url. The star is a wild card and will give you the ability to place blocks on pages that have a variable in the path.

1
  • Thank you! I was doing this earlier, but i didn't set it to show in admin theme !
    – etz01
    Jun 29, 2015 at 7:33
0

I think it is better to write:

if (arg(0) == 'user' && arg(1) == $user->uid  && arg(2) == 'edit' && arg(3) == * ){
  return TRUE;
}
else {
  return FALSE;
}
?>

or do it by the use of template system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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