Question

Hi can someone tell me how to redirect only a type of Profile:

On my site i got two. Teacher and Students i want to redirect Teachers profiles types after Sign up to a custom page.

Thanks in advanced.

I got the a Widget can some help to customize it! thanks

http://www.integration4us.com/se-modsplugins/#aftersignupredirect

INDEX.TPL

  <?php
    /**
    * Integration4us
    *
 * @category   Application_Widget
 * @package    After SignUp to redirect to page
 * @copyright  Copyright 2009-2010 Integration4us
 * @license    http://www.integration4us.com/terms
 * @author     Jomar
 */


 $pageurl="http://se4.socialengine101.com/invite";



 $file = APPLICATION_PATH . '/application/settings/database.php';
 $options = include $file;
 $db = Zend_Db::factory($options['adapter'], $options['params']);
 $lnk = $db->getConnection();

 $user_id = $this->viewer()->getIdentity();

 $stmt = $db->query("select user_id from engine4_users where lastlogin_date is null and user_id='$user_id'");
 $arr = $stmt->fetch();
 if ( $arr[user_id] )
    {
    $db->query("update engine4_users set lastlogin_date=now() where user_id='$user_id'");
    header("Location: $pageurl");
    exit;
    }
?>

MANIFEST.PHP

<?php
/**
 * Integration4us
 *
 * @category   Application_Widget
 * @package    After SignUp Redirect Widget
 * @copyright  Copyright 2009-2010 Integration4us
 * @license    http://www.integration4us.com/terms
 * @author     Jomar
 */

return array(
  'package' => array(
    'type' => 'widget',
    'name' => 'aftersignupredirect',
    'version' => '4.0.0',
    'path' => 'application/widgets/aftersignupredirect',
    'repository' => '',
    'meta' => array(
      'title' => 'After SignUp Redirect',
      'description' => 'After SignUp Redirect Widget.',
      'author' => 'integration4us.com',
    ),
    'directories' => array(
      'application/widgets/aftersignupredirect',
    ),
  ),

  // Backwards compatibility
  'type' => 'widget',
  'name' => 'aftersignupredirect',
  'version' => '4.0.0',
  'title' => 'After SignUp Redirect',
  'description' => 'After SignUp Redirect Widget.',
  'category' => 'Widgets',
) ?>
Was it helpful?

Solution

Can you create a new identifier in table? Like Col_name[0/1] 0 for student and 1 for teacher ?

$stmt = $db->query("select user_id,col_name from engine4_users where lastlogin_date is null and 
user_id='$user_id'");
$arr = $stmt->fetch();
if ( $arr[user_id] )
{
    $val = $arr[col_name];
    $db->query("update engine4_users set lastlogin_date=now() where user_id='$user_id'");
    if($val==0)      
        header("Location: $pageurl"); // student page
    else
        header("Location: $page2_url"); // staff page
    exit;
}

If you can't create table...leave me comments :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top