Drupal create duplicate registration form with extra fields - php

I have a site built using drupal7. The site has a registration form now. There is a new requirement now for add a couple of new fields in the registration form and put it in a new page.
ie http://example.com/register is the existing drupal registration form and user submitting this form will be registered.
http://example.com/newpage is a new page with some content and registration form in it with two extra fields. When user submits this page a new user account will be created along with saving the new fields to the user profile.
Any ideas for implementing this in drupal is appreciated.
Thanks

Does it really have to be separated? Meaning that you need in both of your registration form (normal and a custom one). If not you can just add new fields to the "normal form" in the administration of your site, going to this path:
/admin/config/people/accounts/fields
In this interface you can add custom fields (like for content types) for user's profile. You can as well choose if the field appears during regitration.

You can do this in about 15 minutes with basic understanding of the form API by creating a custom module.
What you need to look into:
Creating a module
Creating a menu hook (for your new custom page)
go to /admin/config/people/accounts/fields and create the new fields and add them to registration form
hook_form_alter - add logic in your module to check if arg(0) != your new page, and if so then hide the additional fields.
This should be enough to get you started. If this answer freaks you out then your probably in over your head. Pull up your socks or get some help.

Related

How to implement multi-steps form with Advanced Custom Fields (only code) for custom theme

How can I create a pagebreak or multi-step form with ACF?
I'have created a long form with ACF code in the template files, so i'm not using groups from ACF plugin.
Now I want to create multi-steps for the user to fill out the form in multi steps and that the form would save each time a section is done.
Thanks in advance!

Wordpress ask user's their desired role as a dropdown menu while registration

I want to add a custom field to the Wordpress registration form without using any plugins. I want to add a dropdown menu with user-roles ( some roles I have created). Once the registration is complete the user should not have the ability to change their roles ( only admin can do that, selecting role as admin should not be allowed).
Any help will be appreciated.
I understand that you do not intend to use plugins, but you nevertheless use a theme, be it implemented by your team or some widely available theme. In any case, that theme has an implementation for your registration, so:
Find the registration form
Make sure that you find out where the registration form is.
Add a field to the form
Be it in a CMS editor or in a PHP/HTML file you must be able to edit it and add a field
Find the code which runs when a registration is posted
Again, you need to seek and find.
Enhance your functionalities which save fields
You will need to track and save the posted value
Change the database schema
You will need to do some changes on the MySQL schema in order to support the new field on database-level.

Add user in BuddyPress without using BuddyPress registration form

I have a landing page with a call to action that points a user to a video and a quiz. The quiz is powered by a larger LMS, LearnDash.
LearnDash has the option to require the end user to enter information (fields are customization) before receiving their grade on the quiz.
When the user submits that information, I'd like to have it register them an account on the site. I'm not sure where to begin linking this process together.
I do know buddypress uses register.php to create an account,how do I hook that up to a button?
You can utilize the following three hooks to customize the registration form: register_form, registration_errors, & user_register.
You can learn more about customizing the registration form in the WordPress Codex by visiting this link.
https://codex.wordpress.org/Customizing_the_Registration_Form
If using hooks is to complicated, there are a number of WordPress plugins available that make customizing the registration page a breeze.
RegistrationMagic - Plugin
Ultimate Member - Plugin

add a new custom field to the register pages

I'm using Opencart 1.5.5.1.
I have researched for about 2 days now on how to add a new field to my registration pages (create new account, register checkout and guest checkout) but without any luck. It seems nobody has done a step-by-step tutorial on how to do this seeing that (as I understood) it is not that simple.
My question: How can I add new required fields to all my register pages in Opencart 1.5.5.1?
I wrote a post on how to add re-captcha captcha field in opencart registration page sometime back. Please have a look at this. You can follow this post and achieve what you want with slight modifications.

Customizing Drupal user account form

In my Drupal Site, i will be having two categories of users,say Category A and Category B. When a person wants to create an account on the site, i want to ask them which category they belong to and based on that show the fields on the User Account Form.
The fields shown depend on the category selected. The Drupal user account form has two fields by default i.e. username and email and i can add more by using the Profile module, but how to show different set of fields on the user account form depending on the users selection ?
Any help would be greatly appreciated.
Thank You
Check the Profile Setup module. Some more details about this module (from its project page):
Profile setup for Drupal 6 now works along side the pageroute module (6.x-1.x-dev) to provide additional page types via the pageroute API, so completely custom profile setup workflows are now more flexible than ever thanks to the help of the pageroute module.
Full setup instructions are given in the INSTALL.txt file in the module folder, so please READ THEM BEFORE YOU INSTALL THIS MODULE or consider submitting a bug report.
If you are upgrading from the Drupal 5 version please read the UPGRADE.txt file in the module folder.
I've done this in the past with hook_form_alter and checking $_GET['type']. If $_GET['type'] is empty, I did something like this:
$form = array(
'#value' => '<div>Register as A or Register as B</div>',
);
If $_GET['type'] is 'A' or 'B', I removed the irrelevant form elements for that type. Then in the #submit handler, I put the user in the appropriate role.
Also check out:
http://drupal.org/project/profile_role
http://drupal.org/project/autoassignrole
by using hook_form_alter you can change your form fields, using unset and add a element inside form. I assume that you have a category selection on the same user register page upon selection you can use AHAH Helper module to change form field based on category selection.
hope it helps.

Categories