Author Topic: After Login, redirect to another page  (Read 6166 times)

Offline Spaceman

  • Newbie
  • *
  • Posts: 9
After Login, redirect to another page
« on: January 24, 2012, 12:28:25 PM »
Hello everybody! :)

I'm using roundcube 0.7.1 and I would like to redirect users to another page after the automatic login in RC is made.


I have a website which creates mail accounts to registered users. When those users login to my website, a php script is executed to log them in into my website first, and then it logs them in RC using the autologon plugin. This process ends with the RC main mail page opened.

How can I automatically redirect the users to another page (my website's homepage) after the RC login?


Thank you very much.

:)

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,879
    • SKaero - Custom Roundcube development
After Login, redirect to another page
« Reply #1 on: January 25, 2012, 12:37:53 AM »
Try adding a redirect to your homepage using the login_after Plugin_Hooks hook.

Offline Spaceman

  • Newbie
  • *
  • Posts: 9
After Login, redirect to another page
« Reply #2 on: January 25, 2012, 05:28:15 AM »
Thanks, skaero! It is now working. :)


For anyone interested, I edited the login_redirect.php like this:

Code: [Select]
<?PHP
class login_redirect extends rcube_plugin
{
  public $tasks = 'login';
//  private $mbox = 'IMAP.Roundcube.XYZ'; //here goes the mailbox to redirect to
  function init(){
    $this->add_hook('login_after', array($this, 'login_after'));
  }
  function login_after($args){
//    $rcmail = rcmail::get_instance();
//    $args['_task'] = 'mail';
//    $args['_action'] = '';
 header(&quot;Location: http://www.mywebsite.com/home.php&quot;);
 exit;
//    $args['_mbox'] = $this->mbox;
//    return $args;
  }
}
?>

Offline Spaceman

  • Newbie
  • *
  • Posts: 9
After Login, redirect to another page
« Reply #3 on: January 25, 2012, 07:12:22 AM »
One question, can I get the number of new email messages and display them in my website's homepage?

Thanks.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,879
    • SKaero - Custom Roundcube development
After Login, redirect to another page
« Reply #4 on: January 25, 2012, 09:04:48 AM »
Not easily but you could write a RoundCube plugin that would could get the email count.

Offline Spaceman

  • Newbie
  • *
  • Posts: 9
After Login, redirect to another page
« Reply #5 on: January 25, 2012, 11:54:32 AM »
I am also in need of full customization in RC, like changing the order of the 's in the Message List table.


from...









to...





(and I'm having trouble searching for the correct file to change this)


Am I walking into a world of hurt here? :/

:)

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,850
After Login, redirect to another page
« Reply #6 on: January 25, 2012, 12:18:28 PM »
you can change the default cols in the message list from the config.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,879
    • SKaero - Custom Roundcube development
After Login, redirect to another page
« Reply #7 on: January 25, 2012, 12:22:07 PM »
You should be able to drag and drop the columns.

Offline Spaceman

  • Newbie
  • *
  • Posts: 9
After Login, redirect to another page
« Reply #8 on: January 25, 2012, 12:36:29 PM »
JohnDoh:  nice, it works great. :)

skaero: you're right, but I need this change in the layout to be applied to every user. in fact, it would be better if I could turn that feature off.

This is to be used by elderly people, so I need to put away lots of options and just make available the basic functions of sending and reading e-mails. And of course, make things big for users with vision problem.

I will definitely need to make lots of changes, that's why I asked if I'm entering in a world of hurt.

Thanks to both of you!

:)