gpt4 book ai didi

php - Tank Auth 添加字段

转载 作者:行者123 更新时间:2023-12-04 22:31:06 25 4
gpt4 key购买 nike

我整天都在使用 Tank Auth 库,对此有疑问。我在注册表单中添加了两个字段:分别是 first_name 和 last_name,我试图找出为什么它没有插入到 user_profiles 页面中。

使用更新后的代码我得到了这个错误:

A PHP Error was encountered

Severity: Warning

Message: Missing argument 5 for Tank_auth::create_user(), called in /home/xtremer/public_html/kowmanager/application/controllers/auth.php on line 136 and defined

Filename: libraries/Tank_auth.php

Line Number: 162A PHP Error was encountered

Severity: Notice

Message: Undefined property: Tank_auth::$users

Filename: libraries/Tank_auth.php

Line Number: 188

Fatal error: Call to a member function UpdateProfileInfo() on a non-object in /home/xtremer/public_html/kowmanager/application/libraries/Tank_auth.php on line 188

更新代码:

Auth Controller

Tank Auth Library

Users Model

关于我现在做错了什么有什么想法吗?

我将为此设置 50 点赏金,但我无法获得链接以获取赏金。

最佳答案

您应该做的是将您想要的两列放入 user_profiles 表中,然后向 models/tank_auth/users.php 添加一个函数,例如:

function UpdateProfileInfo ($userID, $firstname, $lastname)
{
return $this->db->update('user_profiles', array('firstname'=>$firstname, 'lastname'=>$lastname), array('user_id' => $userID));
}

然后替换(在/libraries/Tank_auth.php)
函数 create_user($username, $email, $password, $email_activation)

函数 create_user($username, $email, $password, $email_activation, $userInfo)

然后在正下方(在 /libraries/Tank_auth.php 中)
if (!is_null($res = $this->ci->users->create_user($data, !$email_activation))) {添加
$this->users->UpdateProfileInfo($userInfo["firstname"],$userInfo["lastname"]);

然后替换(在/controllers/auth.php)

        if ($this->form_validation->run()) {                                // validation ok
if (!is_null($data = $this->tank_auth->create_user(
$use_username ? $this->form_validation->set_value('username') : '',
$this->form_validation->set_value('email'),
$this->form_validation->set_value('password'),
$email_activation))) { // success

与:

$userInfo["firstname"] = $this->form_validation->set_value("firstname");
$userInfo["lastname"] = $this->form_validation->set_value("lastname");

if ($this->form_validation->run()) { // validation ok
if (!is_null($data = $this->tank_auth->create_user(
$use_username ? $this->form_validation->set_value('username') : '',
$this->form_validation->set_value('email'),
$this->form_validation->set_value('password'),
$email_activation, $userInfo))) { // success

虽然它应该可以工作,但没有经过测试,请告诉我它是如何进行的
最大

关于php - Tank Auth 添加字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7070326/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com