SimplePortal

Customization => Blocks and Modifications => Block Requests => Topic started by: Afro on September 26, 2010, 08:40:15 PM

Title: Block for registration form
Post by: Afro on September 26, 2010, 08:40:15 PM
Can we get a block that can display th registration form ?

USERNAME :
EMAIL
PASSWORD
VERIFY PASS

ANTI SPAM PUZZLE ......... ESPECIALLY the one built in inside smf security system ?
Title: Re: Block for registration form
Post by: deansmar on September 27, 2010, 12:45:06 AM
sorry but i dint really understand why you would like a Block for the registration form, when it can already be called through its Action anywere in the forum..

index.php?action=register

if that's not what your after, why not copy the code for the registration into a custom Block.... that's what their there for..!!
Title: Re: Block for registration form
Post by: Afro on September 27, 2010, 04:45:25 AM
Thanks for your response.
Of course i know it can be called into action from anywhere but i need the code for the registration.
Code that will provide the fields i listed above if added to a custom block.
Do you have the piece of code ?
Title: Re: Block for registration form
Post by: deansmar on September 27, 2010, 05:01:43 AM
if i remember rightly you should be able to find it in \Sources\Register.php

this should really be asked at the SMF site... as its not really provided by SP
Title: Re: Block for registration form
Post by: Afro on September 27, 2010, 05:23:45 AM
Lol. Sure t is in the Source/Register.php. It is picking out the right code block i am talking about.

I will go ask at SM.org but if you find anything please let me know.
Title: Re: Block for registration form
Post by: Afro on September 27, 2010, 11:27:24 AM
Nice tip xvp. I will work on that now. Since i need to strip every other links except the registration related ones.
The problem though will be that the box will remain even after registration.

I want the box to disappear after the user registers.
Title: Re: Block for registration form
Post by: Afro on September 27, 2010, 11:36:53 AM
Code: [Select]
<form action="http://www.afrowall.com/index.php?action=register2" method="post" accept-charset="UTF-8" name="registration" id="registration" onsubmit="return verifyAgree();">
<div class="cat_bar">
<h3 class="catbg">Registration Form</h3>
</div>
<div class="title_bar">
<h4 class="titlebg">Required Information</h4>
</div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<fieldset class="content">
<dl class="register_form">
<dt><strong><label for="smf_autov_username">Username:</label></strong></dt>
<dd>
<input type="text" name="user" id="smf_autov_username" size="30" tabindex="1" maxlength="25" value="" class="input_text" />
<span id="smf_autov_username_div" style="display: none;">
<a id="smf_autov_username_link" href="#">
<img id="smf_autov_username_img" src="http://www.afrowall.com/Themes/Glassy20Rc3/images/icons/field_check.gif" alt="*" />
</a>
</span>
</dd>
<dt><strong><label for="smf_autov_reserve1">Your Email Address:</label></strong></dt>
<dd>
<input type="text" name="email" id="smf_autov_reserve1" size="30" tabindex="2" value="" class="input_text" />
</dd>
<dt><strong><label for="allow_email">Allow users to email me:</label></strong></dt>
<dd>
<input type="checkbox" name="allow_email" id="allow_email" tabindex="3" class="input_check" />
</dd>
</dl>
<dl class="register_form" id="password1_group">
<dt><strong><label for="smf_autov_pwmain">Choose password:</label></strong></dt>
<dd>
<input type="password" name="passwrd1" id="smf_autov_pwmain" size="30" tabindex="4" class="input_password" />
<span id="smf_autov_pwmain_div" style="display: none;">
<img id="smf_autov_pwmain_img" src="http://www.afrowall.com/Themes/Glassy20Rc3/images/icons/field_invalid.gif" alt="*" />
</span>
</dd>
</dl>
<dl class="register_form" id="password2_group">
<dt><strong><label for="smf_autov_pwverify">Verify password:</label></strong></dt>
<dd>
<input type="password" name="passwrd2" id="smf_autov_pwverify" size="30" tabindex="5" class="input_password" />
<span id="smf_autov_pwverify_div" style="display: none;">
<img id="smf_autov_pwverify_img" src="http://www.afrowall.com/Themes/Glassy20Rc3/images/icons/field_valid.gif" alt="*" />
</span>
</dd>
</dl>
</fieldset>
<span class="botslice"><span></span></span>
</div>
<div class="title_bar">
<h4 class="titlebg">Verification</h4>
</div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<fieldset class="content centertext">

<div id="verification_control_0" class="verification_control">
<div class="smalltext">
4+4=[Put Answer Below And Register]:<br />
<input type="text" name="register_vv[q][10]" size="30" value=""  tabindex="6" class="input_text" />
</div>
</div>
</fieldset>
<span class="botslice"><span></span></span>
</div>
<div id="confirm_buttons">
<input type="submit" name="regSubmit" value="Register" tabindex="7" class="button_submit" />
</div>
<input type="hidden" name="step" value="2" />
</form>


The html code above gets the registration form as i wanted. Note that all other links are removed except the required registration input boxes.

All that remains is how to make the box disappear after registration.
Title: Re: Block for registration form
Post by: Afro on September 27, 2010, 12:42:06 PM
Sorry, a common error occurred.

When user registers, it say "you are not allowed to view this section "

the reason is that i enabled only the GUESTS to see the block.
Title: Re: Block for registration form
Post by: AngelinaBelle on September 27, 2010, 04:22:36 PM
You have taken that block away, so we cannot see what it is missing.
 
I went the other direction -- started from SMF's function Register and started removing stuff until it no longer broke the page to put it into a block.
 
I quickly created some lousy, hacked-up code based on Register.php. It's awful, but it seems to work.
I've attached it.
 
To use it, you would put the following in a php block:
Code: [Select]
global $sourcedir;
include_once ($sourcedir . '/Subs-ab.php');
ab_registerblock();
Title: Re: Block for registration form
Post by: Afro on September 27, 2010, 05:37:34 PM
Good job
Title: Re: Block for registration form
Post by: AngelinaBelle on September 29, 2010, 08:09:23 AM
You put it in the Sources directory, so that it will be there when the include_once ($sourcedir . '/Subs-ab.php'); step goes looking for it.
 
Title: Re: Block for registration form
Post by: frantic on September 29, 2010, 03:02:58 PM
Hey angelina, i tried the code and put the new source file in my test sites source directory.  When i make the php block, all i get is Register new members link in the portal box the is just a home page redirect.  This block is a fantastic idea by the way.
Title: Re: Block for registration form
Post by: AngelinaBelle on September 29, 2010, 03:11:08 PM
Log out and try it again.
Title: Re: Block for registration form
Post by: frantic on September 29, 2010, 03:26:26 PM
Ok the block displays the whole registration agreement with a bar at the bottom that has "i accept the terms" takes up the whole page to get that agreement in their.  Take a look .

Test Site:  www.theps3forums.com
Title: Re: Block for registration form
Post by: AngelinaBelle on September 29, 2010, 03:39:42 PM
Yes.  If you require new registrants to first read the agreement, that is exactly what will happen.
So this solution works well at afrowall (where that agreement is not used), but maybe not so well for you.
 
You could certainly take my awful hacked-up code and hack it up some more. You would modify the "register" replacement to work with a new form that has the "i agree" checkbox on the form with all the other things. And then, of course, you'd have to write a new template for the new form, based on the current template in Register.template.php.
 
You can do that, of course.
Title: Re: Block for registration form
Post by: frantic on September 29, 2010, 03:45:56 PM
Yes.  If you require new registrants to first read the agreement, that is exactly what will happen.
So this solution works well at afrowall (where that agreement is not used), but maybe not so well for you.
 
You could certainly take my awful hacked-up code and hack it up some more. You would modify the "register" replacement to work with a new form that has the "i agree" checkbox on the form with all the other things. And then, of course, you'd have to write a new template for the new form, based on the current template in Register.template.php.
 
You can do that, of course.

I was afraid you were going to say that.  Thanks Angelina, i'll give it a shot.
Title: Re: Block for registration form
Post by: AngelinaBelle on September 29, 2010, 04:10:13 PM
In any case, I would recommend trying out new stuff in a test forum instead of on your "real" forum. It's pretty easy to install a second forum and set up a second database name (or at least a new tablename prefix)
Title: Re: Block for registration form
Post by: Afro on September 29, 2010, 05:50:14 PM
seems to be working but i am getting some unusual errors in my logs.
I will give it sometime and see if they are related.
Thanks for the work Angelina
Title: Re: Block for registration form
Post by: Afro on September 29, 2010, 06:00:28 PM
Ok, error is

Quote
8: Undefined index: permissions
File: /home/xxxxxxx/public_html/Sources/Security.php
Line: 837

and

Quote
2: in_array() [<a href='function.in-array'>function.in-array</a>]: Wrong datatype for second argument
File: /home/XXXXXXX/public_html/Sources/Security.php


edit
i think the error occurs after deleting the test account i created to test how it works..


meanwhile, it created a registration link 'Register New Members' on my pages.
It shows for only the admin. it goes off if i log in as normal member.
Title: Re: Block for registration form
Post by: AngelinaBelle on September 30, 2010, 09:07:07 AM
You should set that block to show up only for guests.
 
You don't want already-registered members to be forced to see it.
 
But the admin will see it anyway, because the admin sees everything.
So I made it show different contents for anyone who is able to use the admin registration feature.
 
You are free to change this behavior, of course.
Title: Re: Block for registration form
Post by: Afro on September 30, 2010, 09:33:31 AM
I understand. I already set for guests alone.

There is also a little bug. I activated the "select gender on registration" but it did not show up on the registration form except if i click on REGISTER.

What do we add on the file you created to make it show on the registration block ?

here is the error i m getting..

Quote
8: Undefined index: is_owner
File: /home/xxxxxxx/public_html/Sources/Profile-Modify.php
Line: 778
Title: Re: Block for registration form
Post by: AngelinaBelle on September 30, 2010, 12:44:41 PM
I knew it was lousy code! This is because I didn't work through all the steps to figure out how it works. So it is only a rough starting place for you.
There may be many bugs in it.  I just found the one causing the 'is_owner' complaint.
 
In the function Register_noTemplate,
Code: (find) [Select]
//  $context['user']['is_owner'] = true;
Code: (replace) [Select]
  $context['user']['is_owner'] = true;

I have not traced through to find out why it is not showing all required profile fields on registration.
I am guessing this is a result of something else I commented out in the code.
Or else it is because of something that got set on the portal page that wouldn't have gotten set on the regular registration page.
 
To figure out what is going on, I would probably have to brute-force debug my way through the building of $context('profile_fields'), which seems to happen in setupProfileContext
 
I wish you the joy of it!
SimplePortal 2.3.8 © 2008-2024, SimplePortal