parent
c3526afe40
commit
cc00468df9
|
|
@ -53,49 +53,58 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
add_action( 'edit_user_profile', 'huayi_score_user_fields' );//修改其他用户
|
add_action( 'edit_user_profile', 'huayi_score_user_fields' );//修改其他用户
|
||||||
}
|
}
|
||||||
|
|
||||||
function huayi_score_user_fields($user)
|
if(function_exists('huayi_score_user_fields')) {
|
||||||
{ ?>
|
function huayi_score_user_fields($user)
|
||||||
<h3><?php _e("用户绑定信息", "blank"); ?></h3>
|
{ ?>
|
||||||
|
<h3><?php _e("用户绑定信息", "blank"); ?></h3>
|
||||||
<table class="form-table">
|
|
||||||
<tr>
|
<table class="form-table">
|
||||||
<th><label for="huayi_openid"><?php _e("OpenID"); ?></label></th>
|
<!-- <tr>-->
|
||||||
<td>
|
<!-- <th><label for="huayi_openid">--><?php //_e("OpenID"); ?><!--</label></th>-->
|
||||||
<input type="text" name="huayi_openid" id="huayi_openid" value="<?php echo esc_attr( get_the_author_meta( 'huayi_openid', $user->ID ) ); ?>" class="regular-text" /><br />
|
<!-- <td>-->
|
||||||
<span class="description"><?php _e("请勿随意修改"); ?></span>
|
<!-- <input type="text" name="huayi_openid" id="huayi_openid"-->
|
||||||
</td>
|
<!-- value="--><?php //echo esc_attr(get_the_author_meta('huayi_openid', $user->ID)); ?><!--"-->
|
||||||
</tr>
|
<!-- class="regular-text"/><br/>-->
|
||||||
<tr>
|
<!-- <span class="description">--><?php //_e("请勿随意修改"); ?><!--</span>-->
|
||||||
<th><label for="huayi_unionid"><?php _e("UnionID"); ?></label></th>
|
<!-- </td>-->
|
||||||
<td>
|
<!-- </tr>-->
|
||||||
<input type="text" name="huayi_unionid" id="huayi_unionid" value="<?php echo esc_attr( get_the_author_meta( 'huayi_unionid', $user->ID ) ); ?>" class="regular-text" /><br />
|
<!-- <tr>-->
|
||||||
<span class="description"><?php _e("请勿随意修改"); ?></span>
|
<!-- <th><label for="huayi_unionid">--><?php //_e("UnionID"); ?><!--</label></th>-->
|
||||||
</td>
|
<!-- <td>-->
|
||||||
</tr>
|
<!-- <input type="text" name="huayi_unionid" id="huayi_unionid"-->
|
||||||
<tr>
|
<!-- value="--><?php //echo esc_attr(get_the_author_meta('huayi_unionid', $user->ID)); ?><!--"-->
|
||||||
<th><label for="huayi_uid"><?php _e("Uid"); ?></label></th>
|
<!-- class="regular-text"/><br/>-->
|
||||||
<td>
|
<!-- <span class="description">--><?php //_e("请勿随意修改"); ?><!--</span>-->
|
||||||
<input type="text" name="huayi_uid" id="huayi_uid" value="<?php echo esc_attr( get_the_author_meta( 'huayi_uid', $user->ID ) ); ?>" class="regular-text" /><br />
|
<!-- </td>-->
|
||||||
<span class="description"><?php _e("请勿随意修改"); ?></span>
|
<!-- </tr>-->
|
||||||
</td>
|
<tr>
|
||||||
</tr>
|
<th><label for="huayi_uid"><?php _e("Uid"); ?></label></th>
|
||||||
</table>
|
<td>
|
||||||
<?php
|
<input type="text" name="huayi_uid" id="huayi_uid"
|
||||||
|
value="<?php echo esc_attr(get_the_author_meta('huayi_uid', $user->ID)); ?>"
|
||||||
|
class="regular-text"/><br/>
|
||||||
|
<span class="description"><?php _e("请勿随意修改"); ?></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<?php }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!has_action('edit_user_profile_update','huayi_score_save_user_fields')) {
|
if (!has_action('edit_user_profile_update','huayi_score_save_user_fields')) {
|
||||||
// add_action( 'personal_options_update', 'huayi_score_save_user_fields' );//修改当前用户
|
// add_action( 'personal_options_update', 'huayi_score_save_user_fields' );//修改当前用户
|
||||||
add_action( 'edit_user_profile_update', 'huayi_score_save_user_fields' );//修改其他用户
|
add_action( 'edit_user_profile_update', 'huayi_score_save_user_fields' );//修改其他用户
|
||||||
}
|
}
|
||||||
|
|
||||||
function huayi_score_save_user_fields($user_id)
|
if(function_exists('huayi_score_save_user_fields')) {
|
||||||
{
|
function huayi_score_save_user_fields($user_id)
|
||||||
if (!current_user_can('edit_user', $user_id)) {
|
{
|
||||||
return false;
|
if (!current_user_can('edit_user', $user_id)) {
|
||||||
}
|
return false;
|
||||||
// update_usermeta($user_id, 'huayi_openid', $_POST['huayi_openid']);
|
}
|
||||||
// update_usermeta($user_id, 'huayi_unionid', $_POST['huayi_unionid']);
|
// update_usermeta($user_id, 'huayi_openid', $_POST['huayi_openid']);
|
||||||
if (!isset($_POST['huayi_uid'])) {
|
// update_usermeta($user_id, 'huayi_unionid', $_POST['huayi_unionid']);
|
||||||
update_usermeta($user_id, 'huayi_uid', $_POST['huayi_uid']);
|
if (!isset($_POST['huayi_uid'])) {
|
||||||
|
update_usermeta($user_id, 'huayi_uid', $_POST['huayi_uid']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue