1
CodeIgniter로 개발 된 포럼이 있습니다. 그리고 나는 Wordpress에 의해 구동되는 나의 웹 사이트를 가지고있다.CodeIgniter와 Wordpress 통합
기본적으로 사용자가 포럼에 등록하면 Wordpress 사용자 테이블에 세부 정보가 추가되므로 두 사람 모두에 등록됩니다.
포럼에 대한 나의 코드 ...
/**
* Create new user record
*
* @param array
* @param bool
* @return array
*/
// username email password last_ip key
function create_user($data)
{
$sql = "INSERT INTO users (username,
email,
password,
last_ip,
created,
activated
) VALUES (
?, ?, ?, ?, ?, ?
)";
$this->db->query($sql, array(
$data['username'],
$data['email'],
$data['password'],
$data['last_ip'],
date("Y-m-d H:i:s", utc_time()),
$data['activated']
));
if ($user_id = $this->db->insert_id()) {
$this->create_profile($user_id);
return TRUE;
}
return FALSE;
}
function activate_user($username)
{
$this->db->query("UPDATE users SET activated = 1 WHERE username = ?", $username);
return $this->db->affected_rows();
}
와 워드 프레스 클래스 등록 ...
/**
* Handles registering a new user.
*
* @param string $user_login User's username for logging in
* @param string $user_email User's email address to send password and add
* @return int|WP_Error Either user's ID or error on failure.
*/
function register_new_user($user_login, $user_email) {
$errors = new WP_Error();
$sanitized_user_login = sanitize_user($user_login);
$user_email = apply_filters('user_registration_email', $user_email);
// Check the username
if ($sanitized_user_login == '') {
$errors->add('empty_username', __('<strong>ERROR</strong>: Please enter a username.'));
} elseif (! validate_username($user_login)) {
$errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.'));
$sanitized_user_login = '';
} elseif (username_exists($sanitized_user_login)) {
$errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.'));
}
// Check the e-mail address
if ($user_email == '') {
$errors->add('empty_email', __('<strong>ERROR</strong>: Please type your e-mail address.'));
} elseif (! is_email($user_email)) {
$errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn’t correct.'));
$user_email = '';
} elseif (email_exists($user_email)) {
$errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.'));
}
do_action('register_post', $sanitized_user_login, $user_email, $errors);
$errors = apply_filters('registration_errors', $errors, $sanitized_user_login, $user_email);
if ($errors->get_error_code())
return $errors;
$user_pass = wp_generate_password(12, false);
$user_id = wp_create_user($sanitized_user_login, $user_pass, $user_email);
if (! $user_id) {
$errors->add('registerfail', sprintf(__('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !'), get_option('admin_email')));
return $errors;
}
update_user_option($user_id, 'default_password_nag', true, true); //Set up the Password change nag.
wp_new_user_notification($user_id, $user_pass);
return $user_id;
}
가 나는 '는 워드 프레스 클래스의 모든 여분의 bumph 필요하지 않습니다 그냥 Wordpress 사용자 테이블에 barebones 포럼 값을 추가로 찾고 있습니다.
어떤 도움이 필요합니까?
질문 무엇인가 분명하게해야합니까? 다른 사람들이 당신의 일을하는 것을 원하지 않습니까? – Shomz