I had some hard time to find out why all my attempts to change the page title of the unified login/register form did fail. I didn't think that setting an empty page title in a callback function is a good solution. If you do not like it, hide it per CSS oder whatever, but please do not make it so hard for themers. Thanks :D

Comments

hunmonk’s picture

Status: Active » Needs work

The patch is incomplete. It would need to include the necessary CSS adjustments to emulate the default behavior.

Also, note that #1172652: Show unified login on Access Denied is working on breaking out the unified login form generation from the page call, which will make it easier to re-use the form wherever you like it.

olafkarsten’s picture

okay, you're right. I will have a deeper look into it. At the moment I'm somewhat short on time. I didn't find a simple solution yet, as we didn't have a logintoboggan specific css selector at page title level or above. But I think it is worth the time. The page title is a key element for accessibility and should ever be there.

fabrice-synchro’s picture

I think this issue also disable messages on the unified page login/register when using sub themes (Fusion sub theme in my case).
Thanks a lot.

hunmonk’s picture

that's highly doubtful, as drupal_set_message() and drupal_set_title() reference completely different systems. your problem is most likely elsewhere. in any case, if it really is a problem, it should be filed as a separate issue.

olafkarsten’s picture

I didn't manage to find a solution. We can insert a toboggan body class per preprocess_html and than hide the h1#page-title tag. But than it would be hidden on the login/register page, even if we do not have a unified login page. I don't like that. So feel free to close this issue.

But I think the current state is not right. The problem is that drupal_set_title() sets the header element TITLE too. An empty TITLE element is bad for accessibility. Maybe some better skilled developer than I, find a solution for that.

hunmonk’s picture

Status: Needs work » Closed (works as designed)

@olaf.karsten: you can always write a mini-module that runs after LT and form_alter()'s or does drupal_set_title().

olafkarsten’s picture

Yes, of course - a solution for my own is no problem, but I thought i can find something more general, that deals with this issue in a better way. I like LT and the empty Title element in bothers me somewhat. But I guess, thats life. Thanks

j0rd’s picture

Same problem. This page should not have a blank title.

Should show something like 'Login or Register'

If people want to hide the title with CSS for this page, then so be it, but forcing those who want a title to hack logintoboggan is not a good solution.

hunmonk’s picture

i wasn't easily able to find how drupal_set_title() does its job, but isn't the real problem that it sets both the page title for the browser, and the visible page title in the content? that seems more like a core bug to me.

j0rd’s picture

I noticed this bug.

You don't get a title when the default order of these function calls is like this

    drupal_set_title(t('Access Denied / User log in'));
    drupal_set_page_content($output);

In this order, the title gets set and displayed

    drupal_set_page_content($output);
    drupal_set_title(t('Access Denied / User log in'));
uptil4music’s picture

Status: Closed (works as designed) » Active

Great module, does wonders to improve the UX for sites. Thank you for all the hard work.

I really like the unified login/registration page, but without a proper < title> tag, I unfortunately have to pass on this little nicety.

I don't know if this is the right place or the right way to ask, so I'll just ask, and seek forgiveness in advance if I'm offending anyone. Can someone that writes code post a generic theme function (or a more appropriate solution?) that allows me to set the < title> tag in < head> to something like 'User account' for the unified pages (user/register, user/login, user)?

I'm using 7.x-1.3, but I didn't want to post a duplicate issue. Thanks much for any help toward a solution.

stevecowie’s picture

Reading back through this issue, this is not as straightforward as you probably hope. I need to look a bit further into this to see if there's a long-term solution but the fact that @hunmonk didn't find one doesn't make me optimistic. However, an easy workaround for you is to do this as a preprocess_page function. You can write one of those into a module or just create it in template.php of your theme. You need to check out if the user is logged in or not and also check the page so something like this will do it:

function mytheme_preprocess_page(&$variables){
global $user;
if (!$user->uid && request_uri() == "/user/"){
drupal_set_title(t('title that will appear in the header"));
$variables['title'] = t('This title will appear above the form');
}
}

Note also the earlier suggestion at #6 that you could also do this with a mini-module that comes after LT and changes the title or does a form_alter.

cesareaugusto’s picture

I got the very same problem: no title on unified login page. Which is the status of this bug? How did you solve it?

craigtockman’s picture

Until this gets fixed why not just create a block, set it to php, display it only on the user page, and insert this code:
<?php drupal_set_title("Login"); ?>

md2’s picture

StatusFileSize
new1.87 KB

I think the general consensus is that the module should not make the decision to hide the title on the site builders behalf. If they choose to theme it out, its up to them.

With a title in place, if a user hits /user/login or /user/register they get the correct Browser Title and the correct Page Content Title, Google should be happy with these also.

However when the user clicks either JavaScript button to flip the forms, the titles remain static to the original page that was hit.

The following patch tries to reinstate the page title and change the Browser and Page title on the users request.

Reviews and thoughts would be good

Cheers,
Mark

md2’s picture

Status: Active » Needs review

marking as needs review

md2’s picture

Issue summary: View changes

typo fixed

stefan.r’s picture

#15 seems OK

stevecowie’s picture

Issue summary: View changes
Status: Needs review » Fixed

Tested the patch provided by md2 and pushed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

david_garcia’s picture

Status: Closed (fixed) » Needs work
StatusFileSize
new2.79 KB

So...visiting login or register page triggers 3 page requests (at least if you don't have any other ajax stuff)?¿?¿? IMHO that is not a good approach.

Did some work on it to propose an alternate way of getting the page tittles.

  • stevecowie committed 8b7f9c4 on 7.x-1.x
    issue #1257572 by md2: reinstates page title on unified login page