微信登陆
';
}
add_action('login_form', 'custom_login_button');
//自定义显示错误消息
function custom_login_message(){
$msg = $_GET['err_msg'];
if($msg){
echo '
该微信账号已经被其他用户绑定
'; } } $current_user = wp_get_current_user(); $openid = get_user_meta($current_user->data->ID, 'qa_openid', true); $nickName = get_user_meta($current_user->data->ID, 'qa_nickname', true); $avatarUrl = get_user_meta($current_user->data->ID, 'qa_avatarurl', true); if($_POST['submit']){ delete_user_meta($current_user->data->ID, 'qa_openid', $openid); delete_user_meta($current_user->data->ID, 'qa_nickname', $nickName); delete_user_meta($current_user->data->ID, 'qa_avatarurl', $avatarUrl); echo '重置成功
'; } } function qauth_options_page_html() { if (!current_user_can('manage_options')){ return; } ?> $_POST['QauthApi'], 'qauth_appkey' => $_POST['QauthAppKey'], 'qauth_usersecret' => $_POST['QauthUserSecret'], 'qauth_auto_register' => $auto_register, ]; if($_POST['QauthApi'] && $_POST['QauthAppKey'] && $_POST['QauthUserSecret']){ update_option('qauth_options',$data_r); $flag = true; } if($flag){ echo '保存成功
'; }else{ echo '保存失败
'; } } } add_action( 'admin_menu', 'qauth_options_page' ); function qauth_login_rewrites_init(){ add_rewrite_rule( 'qauthlogin/(.+)\$', 'index.php?&code=$matches[1]', 'top' ); flush_rewrite_rules(); } add_action( 'init', 'qauth_login_rewrites_init' ); function qauth_setup() { $data_r = [ 'qauth_api' => 'https://api.qauth.cn' , 'qauth_appkey' => '', 'qauth_usersecret' => '', 'qauth_auto_register' => false ]; add_option('qauth_options', $data_r); } function qauth_install() { qauth_setup(); flush_rewrite_rules(); } register_activation_hook( __FILE__, 'qauth_install' ); function qauth_deactivation() { flush_rewrite_rules(); } register_deactivation_hook( __FILE__, 'qauth_deactivation' );