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.
Module works flawlessly.
I would like to keep the UX consistent and have this same modal come up for all default Login and Register links like those for comments.
Is this possible with minimum effort?
Comments
Comment #2
2phaShould be pretty easy. If the links provided by this module are already on the page then you don't need to worry about the modals.
Just theme your register and login links the same way this module does.
You could do it by implementing theme_link().
For the login, you just need to make it like this:
<a href="#" data-toggle="modal" data-target="#login-modal">' . t('Login') . '</a>
and the register like this:
<a href="#" data-toggle="modal" data-target="#register-modal">' . t('Register') . '</a>
Comment #3
2phaComment #4
joshuautley CreditAttribution: joshuautley commentedExcellent thank you.
Comment #5
joshuautley CreditAttribution: joshuautley commentedWorked like a charm!
Comment #6
joshuautley CreditAttribution: joshuautley commentedThis may help someone who finds this thread....
I wanted to trigger the modal from the node links, specifically for the comment module. Here is the function I put in my template.php file....
All I changed was...
<a data-target="#login-modal" data-toggle="modal" href="#">Sign In</a> or <a data-target="#register-modal" data-toggle="modal" href="#">Join Now!</a>
And...
<a data-target="#login-modal" data-toggle="modal" href="#">Sign In</a>
Here is the original function from the comment.module.... (lines 2364 - 2400)
Comment #7
slaurent CreditAttribution: slaurent commentedHi,
That's almost exactly what I need, except I need to apply it to a "you must login or register to view this form" message that appears when a non-authorized user wants to fill a webform . I'm looking for the good hook, though i'm not experienced with using hooks and I can't find it... Will it be in webform or in core form?
Thanks in advance from a Drupal newbie!
Comment #8
2phaIt seems the webform module outputs the message wit a call to drupal_set_message().
You could do as outlined at THIS stackoverflow question.
Alternatively, you could probably write some javascript to search for links to the login or register pages, and change them as needed.
Why the webform module still does not easily allow you to set these messages I don't know. Maybe it's worth putting a feature request in the webform module issue queue.