Welcome to Geeklog, Anonymous Friday, April 26 2024 @ 04:47 am EDT

Geeklog Forums

Custom Registration : A New Dawn


Status: offline

uKrease

Forum User
Junior
Registered: 01/30/06
Posts: 24
Location:JHB ZA
caffeinated
Greetings GL community,

There are various topics relating to Custom User Registration forms in this forum, and I`ve parsed them all until my eyes started bleeding, but cannot pinpoint where my mistake is in creating a custom user registration form.

The Problem : When I fill in and submit my custom form it just bounces back to the registration form and no entries are made in the database. My log files do not report and SQL errors so I cannot see where things are going wrong.

My GL Version : 1.5.0

I`ve done the following :
1) Replaced the lib_custom functions as suggested in Blaines download and modified them as suggested,
2) Created the gl_localuserinfo table in my database,
3) Placed the template files in the locations suggested in Blaines readme attached in the download
4) Set custom registration to true as suggested

My lib_custom function custom_usercreate() looks like this :

Text Formatted Code

function custom_usercreate($uid) {
    global $_TABLES;

    $title = COM_applyFilter($_POST['title'],true);
    $name  = COM_applyFilter($_POST['name']);

    // Ensure all data is prepared correctly before inserts, quotes may need to be escaped with addslashes()
    DB_query("INSERT INTO {$_TABLES['localuserinfo']} (uid,title,name) VALUES ('$uid', '$title','$name')");
    DB_query("UPDATE {$_TABLES['users']} SET fullname = '$fullname' WHERE uid='$uid'");
    return true;

}
 


My memberdetail.thtml file looks like this :

Text Formatted Code

<!-- This is an example template file for the Custom User Registration Feature -->
<!-- To be located under theme/custom directory - Example XSilver/custom/memberdetail.thtml -->
{startblock}
{message}
<form action="{post_url}" method="post">
    <table cellspacing="0" cellpadding="2" width="100%">
        <tr>
            <td align="right" class="alignleft" style="color:white;vertical-align:middle;padding-left:10px;"><b><font color="white">{USERNAME}<br{xhtml}><small style="color:white">{USERNAME_HELP}</small></td>
            <td align="left" valign="middle"><input type="text" name="username" size="16" maxlength="16" value="{username}"{xhtml}></td>
        </tr>
        {passwd_input}
       
        <tr>
            <td align="right" class="alignleft" style="color:white;vertical-align:middle;padding-left:10px;"><b><font color="white">{TITLE}<br{xhtml}><small style="color:white">{TITLE_HELP}</small></td>
            <td align="left" valign="middle"><input type="text" name="title" size="32" maxlength="80" value="{title}"{xhtml}></td>
        </tr>
       
        <tr>
            <td align="right" class="alignleft" style="color:white;vertical-align:middle;padding-left:10px;"><b><font color="white">{NAME}<br{xhtml}><small style="color:white">{NAME_HELP}</small></td>
            <td align="left" valign="middle"><input type="text" name="name" size="32" maxlength="80" value="{name}"{xhtml}></td>
        </tr>
       
        <tr>
            <td align="center" colspan="3"><input type="hidden" name="uid" value="{user_id}"{xhtml}><hr{xhtml}><br{xhtml}>
            <input type="hidden" name="mode" value="text"{xhtml}>{submitbutton}</td>
        </tr>
    </table>
</form>
{endblock}
 


Edit : Sorry, here is the custom_userform() function in lib_custom :

Text Formatted Code

function custom_userform($uid="",$msg="") {
    global $_CONF,$_TABLES, $LANG04;

    if (!empty($msg)) {
        $retval .= COM_startBlock($LANG04[21]) . $msg . COM_endBlock();
    }

    $post_url = $_CONF['site_url']."/users.php";
    $postmode = "create";
    $submitbutton = '<input type="submit" value="Register Now!">';
    $passwd_input = "";
    $message = "<br><font color='white'><b>Please complete the application below. Once you have completed the application, click the 'Register Now!' button and the application will be processed immediately.</b></font>";
    $A=array();

    $user_templates = new Template ($_CONF['path_layout'] . 'custom');
    $user_templates->set_file('memberdetail', 'memberdetail.thtml');
    $user_templates->set_var('layout_url', $_CONF['layout_url']);
    $user_templates->set_var('post_url', $post_url);
    $user_templates->set_var('startblock', COM_startBlock("Register at PS Leisure Club"));
    $user_templates->set_var('message', $message);  
     
    $user_templates->set_var('USERNAME', "Username");
    $user_templates->set_var('USERNAME_HELP', "Name to be used when accessing this site");
    $user_templates->set_var('username', $A['username']);
   
    $user_templates->set_var('passwd_input', $passwd_input);    
     
    $user_templates->set_var('TITLE', "Title");
    $user_templates->set_var('TITLE_HELP', "eg Mr, Mrs, Dr");
    $user_templates->set_var('title', $A['title']);    

    $user_templates->set_var('user_id', $user);
    $user_templates->set_var('postmode', $postmode);
    $user_templates->set_var('submitbutton', $submitbutton);
    $user_templates->set_var('endblock', COM_endBlock());
    $user_templates->parse('output', 'memberdetail');
    $retval .= $user_templates->finish($user_templates->get_var('output'));

    return $retval;
}
 


Can anyone help, please ?

Thank you in advance for your time and knowledge-sharing..
*goes off to wipe the blood pouring from his eyeballs*

 Quote

Status: offline

uKrease

Forum User
Junior
Registered: 01/30/06
Posts: 24
Location:JHB ZA
Sometimes I can be such a dumb-ass....got it all sorted out....

I just had to figure out where things are...

Sorry for the waste of storage space my query, and this reply, may have utilised in your DB.

Cheers :banghead:
 Quote

All times are EDT. The time is now 04:47 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content