Why is profile module necessary as a requirement? I ask because I am using content profile.

Is UC signup compatible with content profile?

CommentFileSizeAuthor
#4 527700_remove_profile_dependency.patch19.24 KBrecrit

Comments

ezra-g’s picture

Title: Compatible with content profile » Content Profile Support
Category: support » feature

UC Signup does not use content profile fields, it uses the core profile module. Patches to make it work for content profile are welcome!

GregoryHeller’s picture

This would be a great addition. I don't think we have it in our budget to work on it this time around, but we might be able to support work on it.

But i would first ask why is the core profile module required? what if i don't care to collect any information other than the username of the person "signing up" why would i need profile module?

greggles’s picture

Title: Content Profile Support » Optional Content Profile support, and make core profile optional as well

Yes, I think these two should both be optional.

@Gregoryheller - there are a couple folks interested in this so if you have some funding for it that could take it to completion.

recrit’s picture

Status: Active » Needs review
StatusFileSize
new19.24 KB

ok, so I have had numerous issues implementing the latest dev. The majority of which stemmed from this issue with the profile dependency and user creation in general. So I have created the following patch to decouple this module from profile. I have made some major changes to implement this, so I hope there are some testers available. It has worked in my limited testing.

Changes:

  • added global setting to enable/disable collection of profiles for the attendees (admin/store/products/signup)
  • major overhaul of uc_signup_attendees_form - pulled out profile form building into new function uc_signup_attendees_form_add_profile_forms. This function could be used to add more form elements from different modules, for instance content_profile; however, I had no luck trying to integrate content_profile.
  • major overhaul of hook_order "submit"
    • Created a function uc_signup_create_user to handle creating the user accounts similar to how uc_cart does it on checkout. I had many issues with current implementation since it parades as UID 1 and calls drupal_execute('user_register', $form_state), which if you are using content profile on your user registration form with required fields... that causes some problems.
  • miscellaneous minor code clean up
ezra-g’s picture

Status: Needs review » Needs work

Thanks for this patch. Unfortunately, it's difficult to review since it makes so many different changes. Could you break this into separate issues and patches?

Also, could you elaborate on the problems with using drupal_execute? This approach is used intentionally to avoid errors when using a captcha.

Thanks!

recrit’s picture

all the changes were to make the profile optional. I will have to think about breaking up patch. The attendee form overhaul could be a separate patch since that only cleans up the form to provide a common function to get more profiles fields from various sources. I will post back once I have something.

drupal_execute...
In my use case, I did not need to collect profile info so I had profile enabled but no profile fields. Everything would work fine since when $profile_form = array_values(module_invoke('profile', 'user', 'register', array(), (object)array())); got called it only pulls the hook_user for the profile module. However, when drupal_execute('user_register', $form_state) runs it calls everyones hook_user register such as CAPTCHA, content_profile (if you have it set to), some mail modules opt out, etc. The way I took uc_signup's use of the profile fields was to gather some extra user info for each attendee; therefore, if you are not asking if they are a human with CAPTCHA, using content_profile fields, or incorporating everything that would normally appear on the user registration form then the way to go is to do the same as uc_cart and just create the user account based on email alone. Then if you want profile fields you can only pull those for the uc_signup form - which you already are doing with the module_invoke('profile', 'user', 'register'...).

I ran into the issue of having content_profile configured to be used on the registration form and I had 2 required fields of first and last name. When drupal_execute would run, it would try to create these content_profile nodes and stop on error of missing required fields.

ezra-g’s picture

Please see #623900: API for additions to attendee info form for an update on how this can be implemented compatible with future plans for uc_signup.

ezra-g’s picture

Status: Needs work » Closed (duplicate)

Marking as a dupe of the above mentioned issue.