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

Wordpress Profile User Creation Sign On (v2) #20807

Merged

Conversation

davidjosephhayes
Copy link
Contributor

Overview

User is not signed in automatically when submitting a profile form with user creation on Wordpress. This was previously the behavior and I believe the intended behavior.

Before

User is not log on profile submission.

After

User is logged in on profile submission.

Technical Details

No password is passed to the wp_signon method in the CRM_Utils_System_WordPress::createUser method. This is required by this method to authenticate the user (I believe). The password is known at the time of form submission so it is added to the credentials array.

Currently, the wp_signon method is return a WP_Error object with the error message The password field is empty.

Comments

It looks like this change was made in the pull request #18982 by @mlutfy with an update by @christianwach at #20057. There was good discussion by @mlutfy @kcristiano @braders @christianwach. Maybe there is a configuration difference between my Wordpress install and a standard install causing this behavior?

@civibot
Copy link

civibot bot commented Jul 8, 2021

(Standard links)

@civibot civibot bot added the master label Jul 8, 2021
@eileenmcnaughton
Copy link
Contributor

test this please

@eileenmcnaughton
Copy link
Contributor

test fail is unrelated - but let's get the green tick

@christianwach
Copy link
Member

I believe the intended behavior.

@davidjosephhayes Bypassing the standard WordPress account-creation process does not seem like a good idea to me. There is a discussion about this issue in the original PR.

If you want that specific behaviour for your instance, why not use the civicrm_post_create_user hook to implement it? That way you're not forcing this behaviour on every WordPress/CiviCRM install.

Or, alternatively, perhaps you could consider implementing the suggestion for Profile Forms to have an option to enable/disable auto-login?

@christianwach
Copy link
Member

@davidjosephhayes Hmm, I may have misread this PR... seems you're fixing the code that's already in Core rather than introducing code. I'm still ambivalent about this, however, as I'd rather see Profile Forms to have an option to enable/disable auto-login.

@davidjosephhayes
Copy link
Contributor Author

@christianwach I would categorize this PR as strictly a bug fix. In my testing wp_signon does nothing regardless of configuration settings currently.

I think the option to auto logon would be fantastic. I have seen you description of the issues with CiviCRM/WP registration detailed in couple of places. Is there a related issue open on this topic somewhere?

@davidjosephhayes
Copy link
Contributor Author

Is there anything I can do to help get this PR merged?

@kcristiano
Copy link
Member

@davidjosephhayes let me take another look and run this. While I would prefer an option (much like account creation) on a profile, the behavior you suggest adding back is present in Drupal. Therefore, I do think the change that removed this can cause unexpected outcomes.

@kcristiano
Copy link
Member

@christianwach I took another look and did an r-run

This PR is working as intended. Once a user is created and a form is submitted, the user is logged in.

I can see many use cases - primarily allowing member benefits once a membership form is submitted and perhaps follow up forms on events.

This functionality has existed for quite some time and was recently removed.

I also would prefer an option in profile settings, but this will affect all CMS. I do see site owners being surprised on upgrade that a feature that worked for quite some time now fails to work.

I am OK for merging, but would like your feedback.

@elisseck
Copy link
Contributor

elisseck commented Aug 18, 2021

@kcristiano FWIW this surprised us as well. We have a bunch of sites that use the workflow "user signs up for membership with CMS user creation, and gets redirected to a customized user-dashboard page not accessible to an anonymous user". All of a sudden all of those membership forms ended in the ugly CiviCRM "Access Denied" page instead.

I am actually seeing the same behavior on a Drupal 8 site. Not sure if it's related or not yet.

Edit: This patch is working on production for at least one client who really needs it at this time. So it's tested from that point of view.

@kcristiano
Copy link
Member

@seamuslee001 Can you take a look - this looks ready to merge from my point of view

@agileware-justin
Copy link
Contributor

This looks like a good enhancement, thanks @davidjosephhayes

@seamuslee001
Copy link
Contributor

Merging as per review by @kcristiano

@seamuslee001 seamuslee001 merged commit 510b3f2 into civicrm:master Sep 12, 2021
@davidjosephhayes davidjosephhayes deleted the wordpress-profile-signon-2 branch September 14, 2021 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants