Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gyrus/WordPress-Developers-Custom…
Browse files Browse the repository at this point in the history
…-Fields
  • Loading branch information
adrntll committed Jun 24, 2015
2 parents b99582e + d0263e0 commit 185fb4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Please raise any issues via [GitHub](https://github.com/gyrus/WordPress-Develope

== Changelog ==
= 1.3 =
* `user_new_form` hook used to add fields to new user form (to include fields in new user form, set scope as per including them in registration form, e.g. `array( 'registration', 'subscriber' )` - the latter being the default user role)
* `group_by_post_type` now includes option group label even if there's only one post type in the options

= 1.2.2 =
Expand Down
11 changes: 7 additions & 4 deletions slt-custom-fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ function slt_cf_init_options() {
***************************************************************************************/
add_action( 'add_meta_boxes', 'slt_cf_display_post_attachment', 10, 2 );
add_action( 'do_meta_boxes', 'slt_cf_remove_default_meta_box', 1, 3 );
add_action( 'user_new_form', 'slt_cf_display_user', 12, 1 );
add_action( 'show_user_profile', 'slt_cf_display_user', 12, 1 );
add_action( 'edit_user_profile', 'slt_cf_display_user', 12, 1 );
add_action( 'register_form', 'slt_cf_display_user', 12 );
Expand Down Expand Up @@ -173,10 +174,12 @@ function slt_cf_display_user( $user = null ) {
$user_role = 'registration';
$user_id = null;
if ( ! empty( $user ) ) {
// Editing a profile, not registering a new user
$user_roles = $user->roles;
$user_role = array_shift( $user_roles );
$user_id = $user->ID;
if ( $user != 'add-new-user' ) {
// Editing a profile, not registering a new user
$user_roles = $user->roles;
$user_role = array_shift( $user_roles );
$user_id = $user->ID;
}
}
slt_cf_init_fields( 'user', $user_role, $user_id );
if ( count( $slt_custom_fields['boxes'] ) ) {
Expand Down

0 comments on commit 185fb4d

Please sign in to comment.