redirect back to form after user logs in.
kobnim - April 17, 2009 - 17:11
| Project: | OG User Roles |
| Version: | 6.x-1.5 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | postponed (maintainer needs more info) |
Jump to:
Description
In the function og_user_roles_register(), anonymous users click a link to login:
function og_user_roles_register() {
global $user;
if ($user->uid) {
drupal_set_message(t('If you have received a registration code for access to a group, process it here.'));
} else {
drupal_set_message(l('You must register/login use registration codes.', 'user/login'));
...
}After logging in or registering, the user is redirected to their user profile page.
My small feature request is that the user instead be redirected back to this form.
I have created some custom code to accomplish this using drupal_get_destination():
if (!$user->uid){
$message = "You must "
. l('register','user/register', array('query' => drupal_get_destination()))
. "or "
. l('login','user/login', array('query' => drupal_get_destination()))
. "to use registration codes";
drupal_set_message($message);
}- Mindy

#1
We still need to provide a message to the user if he *is* logged in, so what about:
<?phpif ($user->uid) {
$message = t('If you have received a registration code for access to a group, process it here.');
} else {
$message = "You must "
. l('register','user/register', array('query' => drupal_get_destination()))
. "or "
. l('login','user/login', array('query' => drupal_get_destination()))
. "to use registration codes";
}
drupal_set_message($message);
?>
#2
Hi,
I'd like to suggest a small tweak to the wording:
Instead of:
how about:
How does that sound?
- Mindy
#3
Sounds fine to me. Have you tried this code?
#4
Yes, the code is working for me.
#5
After the rise of the rewritten OGUR 4.x for Drupal 6, in which many unrelated features of OGUR were removed, and nearing a release of Drupal 7, I'm closing down old issues.
#6
The person who changed the status of these issues to "won't fix" was not authorized to do so: http://drupal.org/node/352139#comment-2352234
OGUR 6.x-1.x will continue to be maintained by me.