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)
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

SomebodySysop - April 17, 2009 - 22:22

We still need to provide a message to the user if he *is* logged in, so what about:

<?php
if ($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

kobnim - April 18, 2009 - 17:07

Hi,
I'd like to suggest a small tweak to the wording:

Instead of:

$message = t('If you have received a registration code for access to a group, process it here.');

how about:

$message = t('If you were given a registration code to join a particular group, please enter it below. Otherwise, for a list of groups you may be able to join without a registration code, please click l("here", "og/".');

How does that sound?

- Mindy

#3

SomebodySysop - April 18, 2009 - 18:55

Sounds fine to me. Have you tried this code?

#4

kobnim - April 20, 2009 - 04:07

Yes, the code is working for me.

#5

sun - December 5, 2009 - 17:44
Status:active» won't fix

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

SomebodySysop - December 8, 2009 - 07:50
Status:won't fix» postponed (maintainer needs more info)

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.

 
 

Drupal is a registered trademark of Dries Buytaert.