Hi, thanks for the great module!
Profile2 alters the user_profile_form. simplesamlphp_auth adds simplesaml_auth_user_profile_form_submit to the submit handlers for the user_profile_form in certain circumstances.
When submitting the user_profile_form when editing a profile, a fatal error is thrown:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'authname' cannot be null: UPDATE {authmap} SET authname=:db_update_placeholder_0 WHERE ( (uid = :db_condition_placeholder_0) AND (module = :db_condition_placeholder_1) ); Array ( [:db_update_placeholder_0] => [:db_condition_placeholder_0] => 13711 [:db_condition_placeholder_1] => simplesamlphp_auth ) in simplesaml_auth_user_profile_form_submit() (line 308 of DOCROOT/sites/all/modules/contrib/simplesamlphp_auth/simplesamlphp_auth.module).
This is because in simplesaml_auth_user_profile_form_submit the 'name' value is being pulled directly from $form_state['values'].
When submitting the form, there's always a $form_state['user'] variable available to us in submit handlers, so I propose using that variable to get the uid and the user name for updating the authmap table, rather than trying to get the values out of $form_state['values'] directly.
Patch to follow.
Comment | File | Size | Author |
---|---|---|---|
#4 | incompatibility_with-2545602-4.patch | 1.79 KB | jlandfried |
#2 | incompatibility_with-2545602-2.patch | 1.65 KB | jlandfried |
#1 | incompatibility_with-2545602-1.patch | 936 bytes | jlandfried |
Comments
Comment #1
jlandfried CreditAttribution: jlandfried at Last Call Media commentedPatch referenced in OP is attached. This seems like a low impact way of making it compatible with profile2, without having to do any profile2-specific checks.
Comment #2
jlandfried CreditAttribution: jlandfried at Last Call Media commentedActually, it probably just makes more sense to only alter the user_profile_form if the user_category is 'account', that way this isn't getting attached to any versions of the form except for the one that core provides. Then the submit handler doesn't need to be altered at all either.
Updated patch attached.
Comment #3
snufkin CreditAttribution: snufkin commentedCould you reroll please?
Comment #4
jlandfried CreditAttribution: jlandfried at Last Call Media commentedNo problem!
Comment #5
snufkin CreditAttribution: snufkin commentedCommitted, thanks!