From 24995dcba5a6595589328a5d0d33c8994a48537e Mon Sep 17 00:00:00 2001 From: hitsword Date: Mon, 20 May 2019 12:14:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BC=9A=E5=91=98meta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hitsword --- class-wc-huayi-score.php | 4 +-- huayi-score.php | 66 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 63 insertions(+), 7 deletions(-) diff --git a/class-wc-huayi-score.php b/class-wc-huayi-score.php index f291c11..736a95f 100644 --- a/class-wc-huayi-score.php +++ b/class-wc-huayi-score.php @@ -19,9 +19,9 @@ class WC_Huayi_Score extends WC_Payment_Gateway { public function __construct() { $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->method_title = __( '积分', 'huayi_score' ); + $this->method_title = __( '积分支付', 'huayi_score' ); $this->method_description = __( '调用系统积分数据进行支付.', 'huayi_score' ); $this->supports = array('refunds'); diff --git a/huayi-score.php b/huayi-score.php index de51b54..9e17460 100644 --- a/huayi-score.php +++ b/huayi-score.php @@ -19,12 +19,12 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly */ function wc_huayi_score_gateway_init() { - if( !class_exists('WC_Payment_Gateway') ) return; + if (!class_exists('WC_Payment_Gateway')) return; - load_plugin_textdomain( 'huayi_score', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' ); + load_plugin_textdomain('huayi_score', false, dirname(plugin_basename(__FILE__)).'/lang/'); - require_once( plugin_basename( 'class-wc-huayi-score.php' ) ); - add_filter('woocommerce_payment_gateways', 'woocommerce_huayi_score_add_gateway' ); + require_once(plugin_basename('class-wc-huayi-score.php')); + add_filter('woocommerce_payment_gateways', 'woocommerce_huayi_score_add_gateway'); //add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'wc_huayi_score_plugin_edit_link' ); } @@ -38,8 +38,64 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly * @package WooCommerce/Classes/Payment * @return array */ - function woocommerce_huayi_score_add_gateway( $methods ) + function woocommerce_huayi_score_add_gateway($methods) { $methods[] = 'WC_Huayi_Score'; 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) + { ?> +

+ + + + + +ID ) ); ?> + + + + + + +ID ) ); ?> + + + + + + + +
+
+ +
+