Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom role lost if user profile edited with GF User Registration activated #478

Closed
rafaehlers opened this issue Aug 20, 2015 · 0 comments
Closed

Comments

@rafaehlers
Copy link
Contributor

rafaehlers commented Aug 20, 2015

One of our users have a User Registration form done with the User Registration add-on.

The function below assign a custom role to this user by combining 2 fields:

add_action("gform_user_registered", "change_roles", 10, 4);
function change_roles($user_id, $config, $entry, $user_pass) {

//NOTE: change 5 below with the ID of your field that has the roles in it and replace 6 with the ID of the field with your locations in it. Make sure the value of those fields have the proper values so that when put together will generate the proper role (i.e. student-nyc)
$selected_role = $entry[5] . '-' . $entry[6];

$user = new WP_User( $user_id );
$user->set_role( $selected_role );

}

The problem is that if he uses GravityView to edit details about this user profile, the custom role was lost.

On my tests, I've found this:

Test 1

  1. Registered new user with custom role = student-tokio
  2. Updated the user details with GravityView
  3. The role gets back to the default selected option in the User Registration add-on

Test 2

  1. Registered new user with custom role = student-tokio
  2. Disabled the User Registration add-on
  3. Updated the user details with GravityView
  4. The role student-tokio was kept for the user

It looks like a problem with that GF Add-on and not GravityView...

Here's the HS ticket with more details: https://secure.helpscout.net/conversation/111017013/3056/

┆Issue is synchronized with this Asana task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant