wordpress 整合php,wp和thinkphp整合

/

1、废弃

2、对wp-login.

在大约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.

//redirect to cityosweb logout

$redirect_to = ‘/cityosweb/default.

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(‘

wp_cache_delete($user_id, ‘users’);

}

endif;

#########

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时,先通过

当打开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的权限

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值