diff options
Added new fields to profile page (not displayed on registration)
2 files changed, 27 insertions, 9 deletions
| -rw-r--r-- | wp-content/plugins/dx-users/class.cm.php | 31 | ||||
| -rw-r--r-- | wp-content/plugins/dx-users/dx-users.php | 5 |
diff --git a/wp-content/plugins/dx-users/class.cm.php b/wp-content/plugins/dx-users/class.cm.php index df2e61a..4f1dc85 100644 --- a/wp-content/plugins/dx-users/class.cm.php +++ b/wp-content/plugins/dx-users/class.cm.php @@ -1,15 +1,28 @@ <?php class Users { function init() { - add_action( 'add_meta_boxes', array( $this, 'add_custom_box_user' ) ); + add_filter( 'user_contactmethods', array( $this, 'add_custom_box_user' ), 10, 1 ); } - function add_custom_box_user() { - $screen = 'user'; - add_meta_box( - 'wporg_box_id', // Unique ID - 'Phone Number', // Box title - 'wporg_custom_box_html', // Content callback, must be of type callable - $screen // Post type - ); + function add_custom_box_user($contact_methods) { + $new_methods = array( + array( + 'service' => 'phone-number', + 'label' => 'Phone number', + ), + array( + 'service' => 'address', + 'label' => 'Address', + ), + ); + + foreach ( $new_methods as $method ) { + if( ! isset( $contact_methods[$method['service']] ) ) { + $contact_methods[$method['service']] = $method['label']; + } + } + + return $contact_methods; } + + } diff --git a/wp-content/plugins/dx-users/dx-users.php b/wp-content/plugins/dx-users/dx-users.php index a16ab0f..a12b985 100644 --- a/wp-content/plugins/dx-users/dx-users.php +++ b/wp-content/plugins/dx-users/dx-users.php @@ -10,3 +10,8 @@ */ defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); + +include 'class.cm.php'; + +$users = new Users; +$users->init(); |
