michaelryanmcneill / shibboleth

Shibboleth plugin for WordPress
https://wordpress.org/plugins/shibboleth/
21 stars 12 forks source link

Profile fields not populated upon account creation #13

Closed NchemIcaLS closed 7 years ago

NchemIcaLS commented 7 years ago

The profile fields are not filled out when an account is initially created. When the user logs out and back in for the 2nd time the fields are updated correctly. I tested with managed and unmanaged fields, same result.

Does anyone else have this issue?

michaelryanmcneill commented 7 years ago

I'm unable to reproduce this. Steps I'm currently taking:

  1. Install Shibboleth plugin.
  2. Configure Shibboleth plugin with managed fields for first name, last name, email, and username.
  3. Login using "Login with Shibboleth" link on wp-login.php or login using automatic session detection.
  4. Visit wp-admin/profile.php to see populated profile content.

If you initially had the user login with profile data populated by unmanaged fields, that would be the reason for this, as unmanaged fields are not populated by data from the SP.

NchemIcaLS commented 7 years ago

After some more testing, it seems to be a problem with my theme. When I deactivate it, it works as it should. Any idea what function in the functions.php could be messing with the Shibboleth plugin?

michaelryanmcneill commented 7 years ago

Strange...maybe the theme is doing something related to update_user_meta() that is interfering with the process? I'm not sure. Is the theme a free theme available on the codex?

NchemIcaLS commented 7 years ago

The theme is Eduma by Thimpress. I found some calls to wp_update_user() in their custom_functions.php and also some calls to update_user_meta() in their learnpress_functions.php (see below). I am currently not using learnpress but I think these functions are getting called regardless because they are part of the theme.

function thim_save_extra_user_profile_fields( $user_id ) {

    if ( !current_user_can( 'edit_user', $user_id ) ) {
        return false;
    }

    update_user_meta( $user_id, 'lp_info', $_POST['lp_info'] );
}

add_action( 'personal_options_update', 'thim_save_extra_user_profile_fields' );
add_action( 'edit_user_profile_update', 'thim_save_extra_user_profile_fields' );
michaelryanmcneill commented 7 years ago

I would try commenting out those functions and trying the process again to verify if they are indeed conflicting.