Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By paulcheck on
The login block is supposed to appear when a user is not logged in, and yet it doesn't show on the "Create new account" or "Request new password" pages. I understand it's a bit odd to want it on these pages, but I do mainly for formatting.
I have tried selecting "display block when php code returns TRUE" and then putting code to test of the user is not logged in, but obviously there must be some override that keeps this block from displaying on the create account and request password pages. So...how to get this to work?
Comments
Settings in block
Did you try to simply set in settings of block admin/structure/block/ to tell drupal where the block should appear , by the path to specyfic places ?
BR
Tried this, didn't work
I wouldn't want to do it by path since I do want it to show exactly when the user is not logged in, but on every page including the user/register and user/password pages. (unless adding specific pages is additive to the current behaviour, but I'm guessing it isn't?)
FYI, here is what I did try with the "show when the following php code returns true". I added the following code snippet:
and then cleared the cache. It still doesn't show on the user/register or user/password pages. Is that code ok? If so, why doesn't it show on the user/register and user/password pages? Is the $user variable somehow non-zero on those pages?
FYI, as for specific paths, I did try selecting "show only on the following pages" and listed:
user/register
user/password
This *did* stop the block from apearing on pages other than , but it still didn't show on user/register and user/password. Perhaps I'm not using the currect path for those pages?
Try this
for logged
for anonymous
I found out this does work ONLY if you apply it to a block you've created. If you apply it to a default block, it gets ignored.
However, it's a default block that I NEED to change. (I want to set the content region to only be visible for authenticated users.) I also made other changes to default blocks and not ONE of those took. Only changes that I make to a block, which I've created, actually take effect.
So you can try
If you go to:
Structure
Blocks
Configure
Visibility settings
Roles
Show block for selected role, you can select the role that you want to see/not see the block.
Didn't work
I tried both of those, and both at the same time. Still not working. It seems that the behaviour is being overridden on the user/register and user/password pages.
Work around
Hi: I decided to work around this. I wanted the login block to appear on the user/register and password pages mainly for formatting (although to be honest I think the block "should" appear on those pages). Anyway, since formatting is the most important thing for me I just created a new block that will act as a place holder and will appear on those pages where the login block should be appearing but isn't.
Same problem here -
Same problem here - http://drupal.org/node/1538716.
Please help me understand.
Why in the world would you want the "Go to the Login Page" block
on the Login page?
If it is just a matter of forcing a sidebar to appear
as it would on any other page,
then create a new block
either blank or with any content you like, (create a 'div' and define width/height)
and specify that it only appear on the page(s)
that normally do not have the Login block.
...the Login block does disappear on every page for a logged in visitor anyway, right?
"I am lost here": please clarify
or Don't, and I will assume you have come to your senses.
"Or am I missing something in my haste?"
- Love Chris
All the best; intended.
-Chris (great-grandpa.com)
___
"The number one stated objective for Drupal is improving usability." ~Dries Buytaert *
Any other ideas?
I have the exact same issue. In my case, I want the user login block to show on the registration form. I have configured the block to show on every page. I believe the problem is due to this code: http://api.drupal.org/api/drupal/modules!user!user.module/function/user_block_view/7. Here is the relevant code:
My guess is that this function is being called by the system which checks the path and doesn't show the login block on any page whose path begins with "user". I can't understand why this would be hard-coded into the core?!!? It's perfectly valid to offer the user a chance to login from the registration or forgotten password page.
If this code isn't responsible, does anyone have other ideas why the login block simply won't appear on the registration page?
Thanks
I get here from -
I came here from - http://drupal.org/node/1538716
I think that drupal should not have "hard coded" non display for /user, user/register and user/password. It should be an configurable option in block setting (Show block on specific pages). I think that Visibility settings options is more then enough for any possibilities like for any others blocks. Please discuss.
In case anyone's still
In case anyone's still looking for this... yeah, good call on isolating where the problem comes from. Based on this, I was able to get the block to show on the registration and password-request pages by using hook_block_view_MODULE_DELTA_alter to override the 'if' statement with a more specific one:
@dooleysarahe thx for this!
@dooleysarahe thx for this! working like a harm :)
@mattf10 thanks.
@dooleysarahe - Thanks! It's
@dooleysarahe - Thanks! It's working great!
Drupal beginer
Thank you for this. Exactly
Thank you for this. Exactly what I was looking for.