0

嗨,有人可以告诉我如何只重定向一种类型的个人资料:

在我的网站上,我得到了两个。教师和学生我想在注册到自定义页面后重定向教师个人资料类型。

先谢谢了。

我得到了一个 Widget 可以帮助定制它!谢谢

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

索引.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;
    }
?>

清单.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',
) ?>
4

1 回答 1

0

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

于 2013-05-08T12:59:05.943 回答