Customizing the register form

Advanced newspaper or magazine Joomla template to build news website with unique and detailed design.
GK User
Tue Apr 13, 2010 3:14 am
I'd really appreciate help on any of this and which file/settings I need to adjust:

1) What steps do you take to add a 3rd party (re)captcha to the gktwn register form after you've installed one?

I tried alpharegistration and but it didn't work for me (although I have registered for public and private recaptcha keys. I also tried osolCaptcha.

2) How do you edit the register form to add extra text boxes? I've tried editing what I thought were the relevant php files but with no joy.

Also, if you can add boxes, how do you add boxes where an answer is not required? And is it possible to add a tick-box?

3) How do you edit the logout text, which seems to be "Hi (username)"?

Thanks,

Frank
User avatar
Junior Boarder

teitbite
Tue Apr 13, 2010 12:49 pm
Hi

Register button can be found at templates/gk_twn/layout/blocks/gk_header.php lines 54-56

Register code is in templates/gk_twn/lib/php/register.php


Making changes You mentioned needs some work and time. I think that the best solution will be to search for register module which will have Your requests included and replace the code for the new one.
User avatar
Moderator

GK User
Tue Apr 13, 2010 3:59 pm
Thanks very much,

I edited templates/gk_twn/lib/php/register.php and was able to add extra lines. E.g.,

<tr>
<td height="40">
<label id="employermsg" for="employer">
<?php echo JText::_( 'Employer &/ occupation' ); ?>:
</label>
</td>
<td>
<input type="text" id="employer" name="employer" size="40" value="" class="inputbox required" maxlength="100" /> *
</td>
</tr>

(It seems that class="inputbox" above would have allowed the user to leave the entry blank.)

However, when I registered with some test information, I was only sent (as administrator) the name, username and e-mail. Have I made a mistake in the code above?

Also, how do I change the size of the register pop-up to accommodate the new questions?

I haven't edited the button code in gk_header.php. Is that needed?

I would be happy to substitute another registration module that would do the job but there doesn't seem to be an easy way of doing that either. However, I would appreciate any suggestions.

Also, can you help with 1) and 3) above?

Sorry for all the queries.

Thanks again,

Frank
User avatar
Junior Boarder

teitbite
Wed Apr 14, 2010 7:49 pm
Hi

Lets start from the easiest:

To enlarge popup box for register please take a look at this post http://www.gavick.com/forum/76-the-worl ... html#45987

Adding fields to register isn't enought You will need also change the code which manage this form and probably the database too. So It's a bigger work.

The fastest way is to use some 3rd party module and easly replace the code and html in places I've told You 2 posts above. But please remember to instal it first so the database will be modyfied automaticly (if needed).
User avatar
Moderator

GK User
Thu Apr 22, 2010 1:58 pm
Thanks for getting back to me,

OK. I have now installed mighty extensions' registration. It works with the default joomla templates but I can't get it to work yet with gk_twn.

I've followed their instructions here and changed com_user to com_juser in
templates/gk_twn/html/mod_login/default.php

I have also made three replacements of com_user with com_juser in
templates/gk_twn/layout/blocks/gk_header.php
and two replacements of replacements of com_user with com_juser in
templates/gk_twn/lib/php/register.php

It doesn't work yet though. Specifically, what other code do I need to replace, i.e. what with what? I am unable to find further instructions on mighty extensions' site

Thanks,

Frank
User avatar
Junior Boarder

teitbite
Fri Apr 23, 2010 2:16 pm
Hi

But it anything displaying form the new register form? Can I see the site?
User avatar
Moderator

GK User
Fri Apr 23, 2010 3:43 pm
Hi,

Thanks for your reply. When I use your template, your registration and login form display as they did before I installed mighty extensions. I'll send you the site details.
User avatar
Junior Boarder

teitbite
Mon Apr 26, 2010 10:42 am
Hi

I do not see the code for the new registration. Did You published it in any position?
User avatar
Moderator

GK User
Tue Apr 27, 2010 10:53 am
Hi,

I haven't done anything other than what I've described so far. I made the code changes I described after installing the mighty extension form.

I did find a register.php file that came with the installation but when I replaced the gk_twn register.php with that code, it didn't work so I changed it back (but with com_user changed to com_juser).

What changes do I need to make? I would really appreciate your help with this.

Thanks,

Frank
User avatar
Junior Boarder

GK User
Fri Apr 30, 2010 4:19 pm
Hi,

Have you had a chance to look at this? What I want to do is to be able to use the mighty extensions registration form with gk_twn as I would with the standard joomla templates (i.e., once it is working, to customise it throught the joomla interface rather than by coding the php).

Is that possible? If so, can you spell out what precisely I need to change in templates/gk_twn/lib/php/register.php to achieve this?

Thanks.
User avatar
Junior Boarder

teitbite
Mon May 03, 2010 10:09 am
Hi

I have send this post to our programer to help You with replacing the registration but He's extremly busy right now.

I do not know this specyfic register form, but I'm affraid that after the replace some code changes would be needed still.
User avatar
Moderator

GK User
Mon May 03, 2010 8:36 pm
There are two ways to get other registration form in popup - you can place moduleposition (i.e. named "registration") in register popup or you can put registration form code instead of present registration form in the popup code.
User avatar
Administrator

GK User
Wed May 05, 2010 2:20 am
Hi dziudek,

Thanks. Sorry but I need a little more assistance with this. Can you spell out in more detail the steps I need to take with either option?

"you can place moduleposition (i.e. named "registration") in register popup".

How? Where?

"...or you can put registration form code"

which code? Might extensions includes a register.php file here: componentscom_juserviewsusertmpl

Can I just copy and paste from it? How much of it do I need? I've attached a copy in the next message.

"...in the popup code".

Do you mean in the popup code in templates/gk_twn/lib/php/register.php? Which code would I remove from register.php to replace with the new code under option 2?

I will also need to resize the popup window. Is that straightforward?

If it's easier to set up and to manage, I would be ok with a non-pop-up registration form...
User avatar
Junior Boarder

GK User
Wed May 05, 2010 2:26 am
their code is attached

(I've replaced some of the code with "..." so as not to post the entire file but you can see the structure of it.)
User avatar
Junior Boarder

GK User
Thu May 06, 2010 5:17 pm
PS. I've been working on finalizing the form and it may be too long for your pop-up, so a separate page for the register form might actually be preferable. Is that possible?
User avatar
Junior Boarder

GK User
Thu May 06, 2010 6:26 pm
frankh wrote:
PS. I've been working on finalizing the form and it may be too long for your pop-up, so a separate page for the register form might actually be preferable. Is that possible?


I tried to do the pop up trick you were up to, but without success so i just done a separate page... What you need to do is modify /templates/gk_twn/lib/scripts/template_scripts.js and comment out lines 58 throw 73:

Code: Select all
/*   if($('register')) {
      $('register').addEvent("click",function(e){
         new Event(e).stop();
         (function(){gk_popup('popup_register',500,345);}).delay((login_opened) ? 500 : 0);
         register_opened = true;
         
         if(login_opened){
            $E('.gk_popup_close',$('popup_login')).fireEvent("click");
            login_opened = false;
         }
      });
      
      $E('.gk_popup_close',$('popup_register')).addEvent("click", function(){
         register_opened = false;
      });
   }
});
*/


After that in /templates/gk_twn/layouts/blocks/gk_headers on line 55 change the function you are calling, in my case, was alpharegistration... (I needed captcha... :P )

Code: Select all
<a href="<?php echo $url->root(); ?>index.php?option=com_alpharegistration&task=register" id="register"><?php echo JText::_('REGISTER'); ?></a>




Hope it helps! ;)
User avatar
Fresh Boarder

GK User
Fri May 07, 2010 6:02 pm
Thanks very much solucionesavanzadas!! :)

That left just two problems to fix for me*, which I've managed to do:

In templates/gk_twn/html/mod_login/default.php, I changed
Code: Select all
...index.php?option=com_user&view=register

to index.php?option=com_juser&task=register (previously, I changed user but not view)
That fixes it when I click "login" and then "create new account".

In templates/gk_twn/html/com_user/login/default_login.php, I changed
Code: Select all
...index.php?option=com_user&task=register

to index.php?option=com_juser&task=register
That fixes it when I arrive at index.php?option=com_user&view=login and click "register". (However, I suspect that the user is unlikely to arrive at that page unless already registered, e.g., having forgotten the password.)

*I don't know if you had the same problems above using com_alpharegistration as I did with com_juser...

The other changes I made earlier, which I kept were in templates/gk_twn/layout/blocks/gk_header.php, where I changed com_user to com_juser twice on line 54 and 55, though I see that you only did it once on line 55.

For the record, I reversed the other changes I made previously of com_user to com_juser elsewhere (namely on line 49 and in templates/gk_twn/lib/php/register.php) with no apparent effect.

Thanks for all your, dziudek's and teitbite's help!

Frank
User avatar
Junior Boarder

GK User
Tue Aug 24, 2010 1:12 pm
I thought the above was enough but my registration form stopped working at a certain point and I'm not sure why.

FYI, I seem to have got it working again by commenting out the <div id="popup_register" class="gk_popup">... section of gk_twn/lib/php/register.php (lines c.11-94), i.e.:

Code: Select all
<div id="popup_register" class="gk_popup">
   <div class="gk_popup_wrap">
        <div id="close_button_register" class="gk_popup_close"></div>
        <div class="gkp_tl"></div>
        <div class="gkp_t"></div>
        <div class="gkp_tr"></div>
        <div class="gkp_ml"></div>
        <div class="gkp_m">
           <div class="popup_padding">
            <script type="text/javascript" src="<?php echo $url->root(); ?>media/system/js/validate.js"></script>
            <script type="text/javascript">Window.onDomReady(function(){document.formvalidator.setHandler('passverify', function (value) { return ($('password').value == value); }   );});</script>
            <form action="<?php echo JRoute::_( 'index.php?option=com_user' ); ?>" method="post" id="josForm" name="josForm" class="form-validate">
            
            <table cellpadding="0" cellspacing="0" border="0" width="100%" class="contentpane">
            <tr>
               <td width="30%" height="40">
                  <label id="namemsg" for="name">
                     <?php echo JText::_( 'NAME' ); ?>:
                  </label>
               </td>
                 <td>
                    <input type="text" name="name" id="name" size="40" value="" class="inputbox required" maxlength="50" /> *
                 </td>
            </tr>
            <tr>
               <td height="40">
                  <label id="usernamemsg" for="username">
                     <?php echo JText::_( 'USERNAME' ); ?>:
                  </label>
               </td>
               <td>
                  <input type="text" id="username" name="username" size="40" value="" class="inputbox required validate-username" maxlength="25" /> *
               </td>
            </tr>
            <tr>
               <td height="40">
                  <label id="emailmsg" for="email">
                     <?php echo JText::_( 'EMAIL' ); ?>:
                  </label>
               </td>
               <td>
                  <input type="text" id="email" name="email" size="40" value="" class="inputbox required validate-email" maxlength="100" /> *
               </td>
            </tr>
            <tr>
               <td height="40">
                  <label id="pwmsg" for="password">
                     <?php echo JText::_( 'PASSWORD' ); ?>:
                  </label>
               </td>
                 <td>
                    <input class="inputbox required validate-password" type="password" id="password" name="password" size="40" value="" /> *
                 </td>
            </tr>
            <tr>
               <td height="40">
                  <label id="pw2msg" for="password2">
                     <?php echo JText::_( 'VERIFY_PASSWORD' ); ?>:
                  </label>
               </td>
               <td>
                  <input class="inputbox required validate-passverify" type="password" id="password2" name="password2" size="40" value="" /> *
               </td>
            </tr>
            <tr>
               <td colspan="2" height="40">
                  <p class="information_td"><?php echo JText::_( 'REGISTER_REQUIRED' ); ?></p>
               </td>
            </tr>
            </table>
               <p class="form_buttons"><span class="btn"><button class="button validate" type="submit"><?php echo JText::_('REGISTER'); ?></button></span></p>
               <input type="hidden" name="task" value="register_save" />
               <input type="hidden" name="id" value="0" />
               <input type="hidden" name="gid" value="0" />
               <?php echo JHTML::_( 'form.token' ); ?>
            </form>
         </div>
        </div>
        <div class="gkp_mr"></div>
        <div class="gkp_bl"></div>
        <div class="gkp_b"></div>
        <div class="gkp_br"></div>
     </div>
</div>
User avatar
Junior Boarder


cron