Page 1 of 1

2 different registration forms with different custom fields

PostPosted: January 19th, 2012, 4:00 pm
by zielakxar
The tittle of this topic pretty much states on what i'm trying to accomplish - coudnt find a ready sollution so i;m trying to make it myself.
I saw this http://www.s2member.com/custom-fields-d ... lly-video/ video but it is about editing already existing custom fields, and i want to hide/show fields depending on where registration form is displayed.
I have 2 registration forms - one on hidden site, so only people with the link will be able to register (made by pro form []) this registration sets some custom capabilities on level 0 . The second registration is on standard wp-login.php?action=register. Registration is open and both reg-forms are free. But i want pro-form registration to display difrent fields than on standard www.mysite.com/wp-login.php?action=register wordpress form.

In wp-login.php file there is a code :

Code: Select all
<form name="registerform" id="registerform" action="<?php echo esc_url( site_url('wp-login.php?action=register', 'login_post') ); ?>" method="post">
   <p>
      <label for="user_login"><?php _e('Username') ?><br />
      <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label>
   </p>
   <p>
      <label for="user_email"><?php _e('E-mail') ?><br />
      <input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr(stripslashes($user_email)); ?>" size="25" tabindex="20" /></label>
   </p>

that code generates standard username and email field and then there is
<?php do_action('register_form'); ?>

that i belive creates rest of fields. question where is a file with do_action('register_form') function ? so i coud see how it works?.

I've even tried what seems a tottaly non-profesional way by editing wp-login.php and writing some javascript code to set .style.display='none'; of custom field holder ID. like :

document.getElementById('ws-plugin--s2member-custom-customfieldID').style.display='none';

but problem is that labels for those fields are in <span> and i cant make them disappear by javascript cause they have no ID.

Any ideas on how to make pro form registration display additional 3 custom fields that wont be displayed on standard registration site in www.mysite.com/wp-login.php?action=register ?

Re: 2 different registration forms with different custom fie

PostPosted: January 20th, 2012, 10:34 pm
by Cristián Lávaque
Well, if the custom fields are different based on the registration level (like after having paid for Level 1, or with a Level 1 free registration pro-form), you could use the custom field setting Applicable Membership Levels. WP Admin -> General Options -> Registration/Profile -> Applicable Membership Levels

But there isn't a setting to control what the custom field applies to based on the URL/page/post the form is in.

Thanks for the idea, though, I'll mention it to Jason. :)

Re: 2 different registration forms with different custom fie

PostPosted: January 21st, 2012, 4:55 am
by zielakxar
Thanks for reply - i think it woud be a nice option since when i was looking for sollution I've read a lot of posts on other forums from people who where looking for the same.

Re: 2 different registration forms with different custom fie

PostPosted: January 22nd, 2012, 8:21 pm
by Cristián Lávaque
Noted. And after the person registers with certain custom fields based on the registration form used, what fields should be shown to the user in his profile? The ones he filled out, the one present in his registration form, every custom field avaialble, others?

If you could give more data on how you're planning to implement this, it'd help us when we look at implementing it.

Thakns!

Re: 2 different registration forms with different custom fie

PostPosted: January 22nd, 2012, 9:27 pm
by zielakxar
Cristián Lávaque wrote:And after the person registers with certain custom fields based on the registration form used, what fields should be shown to the user in his profile?

i think most proper woud be : the one present in his registration form.
Although for my project - its less important what user sees, and what data he can edit after registration in profile. Ofcourse you probably woud want for it to be more versatile, but for me - what is important is getting the data to be read by admin. User doesnt even have to get acces to his profile at all - at least for now.
As i was saying others might be more demanding (or it coud be useful for me some time later) , and i belive displaying information "the one present in particular registration form" woud be the right one.

there's no real hurry for this - i.ve made a temporary sollution by hiding proforms labels/inputs by javascript
style.display=none. Ofc this is not pretty sollution and i know it - but hey it works. Since in pro forms unlike in standard registration forms labels have ID. Such sollution wont work with reqired fields, but for non required its fine.