/////////wordpress 更改记录////////////////////
1、废弃wp本身的wp_users表,改成对mj_user表建立视图wp_users,这样在wp里不能对wp_users视图进行添加、更新、删除等,而只能色了传统读取。
2、对wp-login.php文件的修改:
在大约345行位置:
//comment it,change to cityosweb
//if ( isset($_GET[‘key’]) ) $action = ‘resetpass’;
// validate action so as to default to the login screen
//comment it,change to cityosweb
//if ( !in_array($action, array(‘logout’, ‘lostpassword’, ‘retrievepassword’, ‘resetpass’, ‘rp’, ‘register’, ‘login’), true) && false === has_filter(‘login_form_’ . $action) )
if ( !in_array($action, array(‘logout’, ‘login’), true) && false === has_filter(‘login_form_’ . $action) )
$action = ‘login’;
大约382行位置,即Logout Action处理的代码段里增加下面这行:
//$redirect_to = !empty( $_REQUEST[‘redirect_to’] ) ? $_REQUEST[‘redirect_to’] : ‘wp-login.php?loggedout=true’;
//redirect to cityosweb logout
$redirect_to = ‘/cityosweb/default.php/Public/doLogout’;
wp_safe_redirect( $redirect_to );
大约603行位置,将login form转移到cityosweb上
//redirect to cityosweb login page
wp_safe_redirect(“/cityosweb/default.php/Index/login”);
exit();
wp-includes/pluggable.php文件约1637行注释了2行代码
function wp_set_password( $password, $user_id ) {
global $wpdb;
//$hash = wp_hash_password($password);
//$wpdb->update($wpdb->users, array(‘user_pass’ => $hash, ‘user_activation_key’ => ”), array(‘ID’ => $user_id) );
wp_cache_delete($user_id, ‘users’);
}
endif;
######### thinkphp cityosweb 更改记录##############
1、用户注册时,需要往wp的wp_usermeta表里添加以下三行数据:
$UserMeta = D(‘UserMeta’);
$usermeta_data = array(‘user_id’=>$user_data[‘cityos_user_id’],
‘meta_key’=>’nickname’,
‘meta_value’=>”);
$UserMeta->addUsermeta($usermeta_data);
$usermeta_data[‘meta_key’] = ‘rich_editing’;
$usermeta_data[‘meta_value’] = ‘true’;
$UserMeta->addUsermeta($usermeta_data);
$usermeta_data[‘meta_key’] = ‘wp_capabilities’;
$usermeta_data[‘meta_value’] = ‘a:1:{s:6:”editor”;s:1:”1″;}’;
$UserMeta->addUsermeta($usermeta_data);
2、login时,先通过ajax登录cityosweb,成功后再把login form提交到wp-login.php,这个也登录成功后,自动redirect to /wp/ 首页。不能用wp-login.php的登录画面,而用cityosweb的login画面,需要更改cityosweb登录脚本。
当打开wp-login.php的login action时,自动转移到cityoweb的login界面上。
3、logout时,直接通过wp的logout action处理,wp logout后自动redirect to cityosweb的doLogout,这个处理完成后,再redirect to /wp/首页。废弃cityosweb的html logout脚本处理。
还有一些小毛病需要处理!
———————————————————–
修改:
$usermeta_data[‘meta_key’] = ‘rich_editing’;
$usermeta_data[‘meta_value’] = ‘false’;
$UserMeta->addUsermeta($usermeta_data);
$usermeta_data[‘meta_key’] = ‘wp_capabilities’;
//$usermeta_data[‘meta_value’] = ‘a:1:{s:6:”editor”;s:1:”1″;}’;
$usermeta_data[‘meta_value’] = ‘a:1:{s:10:”subscriber”;s:1:”1″;}’;
$UserMeta->addUsermeta($usermeta_data);
让新注册wp的用户是subscriber的权限