[imp] First login redirect

Rob Casey rob.casey at bluebottle.com
Sun Jul 20 21:27:52 PDT 2003


G'Day all,

I am looking at incorporating some additional functionality into IMP 
whereby on their first login to IMP, a user is redirected to a particular 
page.  This functionality is similar to the Terms of Service Agreement 
option which is available in (at least) the CVS HEAD version of IMP, 
however, the page which I want to redirect the user to is an existing page 
of the (extended) interface.

To achieve this end, I have written the following code based upon that for 
the Terms of Service Agreement for imp/lib/Maintenance/Task/setup_wizard.php:

<?php

     /**
      *  Maintenance module that redirects user to Bluebottle Setup Wizard upon
      *  first login to webmail environment.
      *
      * Bluebottle Systems Pty Ltd
      *
      * See the enclosed file COPYING for license information (GPL).  If you
      * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
      */

     class Maintenance_Task_setup_wizard extends Maintenance_Task {

         function doMaintenance()
         {
             header( 'Location: ' . Horde::applicationUrl( 
'bluebottle_wizard.php' ) );
             exit;
         }

         function describeMaintenance()
         {
         }

     }

?>


I have then added this maintenance task to the hash in 
imp/lib/Maintenance/imp.php:


     /**
      * Hash holding maintenance preference names.
      *
      * @var array $maint_tasks
      */
     var $maint_tasks = array(
         'setup_wizard'            => MAINTENANCE_FIRST_LOGIN,
         'tos_agreement'           => MAINTENANCE_FIRST_LOGIN,
         'fetchmail_login'         => MAINTENANCE_EVERY,
         'rename_sentmail_monthly' => MAINTENANCE_MONTHLY,
         'delete_sentmail_monthly' => MAINTENANCE_MONTHLY,
         'purge_trash'             => MAINTENANCE_MONTHLY
     );


And then added and enabled the option under my preferences:


$_prefs['setup_wizard'] = array
(
     'value'     =>  0,
     'locked'    =>  true,
     'shared'    =>  false,
     'type'      =>  'implicit'
);


This is all good and the user is redirected to the setup wizard on their 
first login - The problem is that this occurs for every login of new 
accounts, not just the first.  I know this must be something simple which I 
have overlooked but I do not know where else I should be looking in the 
codebase.

Any and all help is appreciated - Even if it is a direct 'RTFM' (just as 
long as you tell me where to read :-)

Thanks in advance,
Rob



Rob Casey
Technical Manager
Bluebottle :: Spam Free Email
http://www.bluebottle.com



More information about the imp mailing list