parent
8f8e6b6f49
commit
24995dcba5
|
|
@ -19,9 +19,9 @@ class WC_Huayi_Score extends WC_Payment_Gateway {
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->id = 'huayi_score';
|
$this->id = 'huayi_score';
|
||||||
$this->icon = apply_filters('woocommerce_huayi_score_icon', '*');
|
$this->icon = apply_filters('woocommerce_huayi_score_icon', '');
|
||||||
$this->has_fields = true;
|
$this->has_fields = true;
|
||||||
$this->method_title = __( '积分', 'huayi_score' );
|
$this->method_title = __( '积分支付', 'huayi_score' );
|
||||||
$this->method_description = __( '调用系统积分数据进行支付.', 'huayi_score' );
|
$this->method_description = __( '调用系统积分数据进行支付.', 'huayi_score' );
|
||||||
$this->supports = array('refunds');
|
$this->supports = array('refunds');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,3 +43,59 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
$methods[] = 'WC_Huayi_Score';
|
$methods[] = 'WC_Huayi_Score';
|
||||||
return $methods;
|
return $methods;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WordPress 个人资料添加额外的字段
|
||||||
|
* http://www.wpdaxue.com/extra-user-profile-fields.html
|
||||||
|
*/
|
||||||
|
if (!has_action('show_user_profile','huayi_score_user_fields') && !has_action('edit_user_profile','huayi_score_user_fields')) {
|
||||||
|
add_action( 'show_user_profile', 'huayi_score_user_fields' );
|
||||||
|
add_action( 'edit_user_profile', 'huayi_score_user_fields' );
|
||||||
|
}
|
||||||
|
|
||||||
|
function huayi_score_user_fields($user)
|
||||||
|
{ ?>
|
||||||
|
<h3><?php _e("用户绑定信息", "blank"); ?></h3>
|
||||||
|
|
||||||
|
<table class="form-table">
|
||||||
|
<!-- <tr>-->
|
||||||
|
<!-- <th><label for="huayi_openid">--><?php //_e("OpenID"); ?><!--</label></th>-->
|
||||||
|
<!-- <td>-->
|
||||||
|
<!-- <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 />-->
|
||||||
|
<!-- <span class="description">--><?php //_e("请勿随意修改"); ?><!--</span>-->
|
||||||
|
<!-- </td>-->
|
||||||
|
<!-- </tr>-->
|
||||||
|
<!-- <tr>-->
|
||||||
|
<!-- <th><label for="huayi_unionid">--><?php //_e("UnionID"); ?><!--</label></th>-->
|
||||||
|
<!-- <td>-->
|
||||||
|
<!-- <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 />-->
|
||||||
|
<!-- <span class="description">--><?php //_e("请勿随意修改"); ?><!--</span>-->
|
||||||
|
<!-- </td>-->
|
||||||
|
<!-- </tr>-->
|
||||||
|
<tr>
|
||||||
|
<th><label for="huayi_uid"><?php _e("Uid"); ?></label></th>
|
||||||
|
<td>
|
||||||
|
<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('show_user_profile','huayi_score_user_fields') && !has_action('edit_user_profile','huayi_score_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( 'personal_options_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 (!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_uid', $_POST['huayi_uid']);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue