MyBB Community Forums

Full Version: Create two different ways of register? (one requiring data, other not)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi friends!.

The question sounds very simple but I don't get any result after some time of investigation.

I have my forum configured with several additional profile data (name, surname, telephone, address, etc). This additional profile data is mandatory in new registers. Let us say that the people that fill these fields go to a group called VIP.

Also, I need to have another simple register form, without no profile data required, just like tradional registers with only username, email and password, so the people that use this form go to another group called Register and not VIP

The way that I thought to achieve what I was looking for it was to create 2 member.php.
- Normal one.
- Another member.php called member_nodatarequired.php, the same that member.php but just commenting (or deleting) this if:

if($profilefield['required'] == 1) (line for me 1347)

The problem is that this only works visually, in the page of the register looks pretty good for what I need, but logically, when you press Send Register, it doesn't work because it says that other fields are requierd (even not showing).

How could I solve this?

Thank you very much for your time.

Any point of view? Should I open the thread in other subforum?
Thanks!



Okey guys, finally I got it. Maybe not the best option because involves modifying, or better said, adding some stuff to the core.


1) Ok, as I said, we need to have 2 member.php.
So, we copy one and rename it to member_users.php, this is the one that we are going to modify, not the other!

2) After that, we go in member_users.php to the following line (112):

require_once MYBB_ROOT."inc/datahandlers/user.php";
rename to
require_once MYBB_ROOT."inc/datahandlers/user_withoutprofile.php";

3) Then, we must copy the inc/datahandlers/user.php and paste it in:
inc/datahandlers/user_withoutprofile.php

No modify or delete inc/datahandlers/user.php!!

4) Now go to this line (675) in member_users.php

if($profilefield['required'] == 1) { ....}

Comment or delete the whole if.

5) Go to inc/datahandlers/user_withoutprofile.php , search for

function verify_profile_fields()

Comment all the code except return true; Like so:

function verify_profile_fields(){

return true;

}

5) Ok, now we have 2 ways of register. One asking for several custom fields that are required and other way of register that doesn't ask for anything excepto nickname, password.


6) In order to give to the user the choice to register in one way or other, lets modify template member_register_agreement and add another form.

The end of the template should be similar to this:
<div align="center">

<input type="hidden" name="step" value="agreement" />
<input type="hidden" name="action" value="register" />
<input type="submit" class="button" name="agree" value=" I agree. Register as VIP " />
</form>



<form action="member_users.php" method="post">
<input type="hidden" name="step" value="agreement" />
<input type="hidden" name="action" value="register" />
<input type="submit" class="button" name="agree" value="I agree. Register as user." />
</form>

</div>
{$footer}
</body>
</html>


[Image: 1YH5STE.jpg]

Note that in the second form we have modify from members.php to member_users.php (the one that doest not ask for additional profile data).

7) We must go to member_register template , rename it to member_register_user (rename will create one new) and modify only when appears member.php for member_users.php

8) Finally, in member_users.php, line 17 and 781 change member_register for member_register_user (carefull with replace all, only the complete words not replace member_register_XXXX!!!)


These would be the result

[Image: 4dQhnzHl.jpg]
[Image: 7rjSqmal.jpg]


Hope it helps for someone!
Regards