Welcome to Geeklog, Anonymous Monday, December 30 2024 @ 01:08 pm EST

Geeklog Forums

Custom Registration Question


Status: offline

jetshack

Forum User
Full Member
Registered: 06/29/04
Posts: 122
Location:Texas
I'm trying to add a field to my registration.

I've read all this (Seriouslly I've read every thing there) but am running into some problems.

I'm trying to add two fields. One field is the FULLNAME field which was already set up as the example.
For the other field I'm going to use the preexisting field for PGPKEY. I'm leaving everything the same for the PGPKEY field except for the text which is displayed, which I'm changing to Graduation Year.

So far this is what I've done

I've added the following to my lib_custom.php
Text Formatted Code

    $user_templates->set_var('FULLNAME', "Full Name");
    $user_templates->set_var('FULLNAME_HELP', "");
    $user_templates->set_var('fullname', $A['fullname']);
        $user_templates->set_var('PGPKEY', "Graduation Year");
    $user_templates->set_var('PGPKEY_HELP', "");
    $user_templates->set_var('pgpkey', $A['pgpkey']);
 


I've also added the following memberdetail.thtml file to the /theme/custom directory. The only thing I've added to this code which came from the example in the system directory is the additional entry box for Graduation Year (PGPKEY).


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 border="0" cellspacing="0" cellpadding="2" width="100%">
    <tr>
      <td align="right" style="text-align:left;vertical-align:middle;padding-left:10px;"><font color='#000000'><b>{USERNAME}</b></font><br>
        <font color=#676767 size=1>{USERNAME_HELP}</font></td>
      <td align=left valign=middle>
        <input type="text" name="username" size="25" maxlength="16" value="{username}">
      </td>
      <td><img src='/images/speck.gif' width=30 height=1></td>
    </tr>
    {passwd_input}
    <tr>
      <td align="right" style="text-align:left;vertical-align:middle;padding-left:10px;"><font color='#000000'><b>{EMAIL}</b></font><br>
        <font color=#676767 size=1>{EMAIL_HELP}</font></td>
      <td align=left valign=middle>
        <input type="text" name="email" size="25" maxlength="100" value="{email}">
      </td>
      <td><img src='/images/speck.gif' width=30 height=1></td>
    </tr>
    <tr>
      <td align="right" style="text-align:left;vertical-align:middle;padding-left:10px;"><font color='#000000'><b>{FULLNAME}</b></font><br>
        <font color=#676767 size=1>{FULLNAME_HELP}</font></td>
      <td align=left valign=middle>
        <input type="text" name="FULLNAME" size="25" maxlength="40" value="{fullname}">
      </td>
      <td><img src='/images/speck.gif' width=30 height=1></td>
    </tr>
    <tr>
      <td align="right" style="text-align:left;vertical-align:middle;padding-left:10px;"><font color='#000000'><b>{PGPKEY}</b></font><br>
        <font color=#676767 size=1>{PGPKEY_HELP}</font></td>
      <td align=left valign=middle>
        <input type="text" name="FULLNAME" size="25" maxlength="40" value="{pgpkey}">
      </td>
      <td><img src='/images/speck.gif' width=30 height=1></td>
    </tr>
    <tr>
      <td align="right" style="text-align:left;vertical-align:middle;padding-left:10px;"> </td>
      <td align=left valign=middle> </td>
      <td> </td>
    </tr>
    <tr>
      <td align="center" colspan="3">
        <input type="hidden" name="uid" value="{user_id}">
        <HR>
        <BR>
        <input type="hidden" name="mode" value="{postmode}">
        {submitbutton}</td>
    </tr>
  </table>
</form>
{endblock}
 


My problem is this, the user registration screen displays correctly, but when the information is submitted the only info which is saved is the username and email address... The info for the two new fields is lost.

So I've missed the part which explains how to get this info to save to the db.

The site in question is here
 Quote

Status: offline

Turner

Forum User
Chatty
Registered: 04/11/05
Posts: 42
Never have used this feature myself, but I think you have failed to add your fields to a few additional functions in lib-custom.

See functions custom_usercreate(), function custom_useredit(), custom_usersave(), etc...

Also, be sure you've added the fields to your db and the {customfields} entry to your template.

I really hope this helps.

-Jeff




 Quote

Status: offline

jetshack

Forum User
Full Member
Registered: 06/29/04
Posts: 122
Location:Texas
I am so lost on this.
 Quote

Status: offline

Turner

Forum User
Chatty
Registered: 04/11/05
Posts: 42
I unfortunately don't know what I'm talking about here. BUT, it seems to me that if you are gonna have custom registration, you need a few things:

1. You need to add your additional fields (address, city, whatever) in your sign up template (which I think you've done). I would not reuse the pgkey and stuff like that. Too confusing.

2. BUT all this does is present the form via which you gather the data from the prospective member. SO, you also need to add these new fields to the function that creates the user. That appears to be the Custom_usercreate() function located in system/lib-custom. (Actually, this must be called by the function that creates the user if you specify in config.php that you have custom code).

3. But what if you need to retrieve this data and edit it later? You therefore also need to be able to have the system recognize the new fields there. Presumably the useredit function does this.

4. The usersave function is likely being used by the usercreate and useredit functions. So, once it recognizes your new field additions, you're set.

I don't think the custom registration stuff is very easy. It just makes setting up a custom registration easier than it would be had you to go sifting through all the Geeklog code and templates to make the needed changes.

I will be working with this soon for my site. But for now, I just can deal with it because I am hot on the heels of a javascript scroller.

Will anyone here help this guy? I am feeling pretty sad that I don't have the skills yet.

-Jeff
 Quote

Status: offline

Blaine

Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
In order to use the custom registration you do need some PHP any mysql knowledge but the framework is all there. We have added all the hooks from the CORE user registration and user admin to call the custom user functions whenever:
- Adding a new user (show the custom form and then save new record)
- Editing a user (show custom fields and save updated record)
- Deleting a user

It's possible to add 50+ fields should that be needed or just 1 new field. Any new fields need to be in a separate table so as to not effect any GL updates later.

The custom_usercreate function would then validate any new user information and save (insert) this record in the new table created for this extended_user_info. The core gl_users table is still used for the basic user info like username, fullname, email address.

The custom_useredit and custom_usersave functions need to created as well to match the new requirements.

Adding two new fields may be 30 - 60 min work with testing and tweaking the layouts. If you don't have the PHP or MySQL experience or time, you can contact me to engage my services to complete this for you.
Geeklog components by PortalParts -- www.portalparts.com
 Quote

Status: offline

jetshack

Forum User
Full Member
Registered: 06/29/04
Posts: 122
Location:Texas
Outstanding work Blaine!
Your solution worked like a charm, thanks so much for your help.
I can't get over how easy the install was.
Once again thanks!
 Quote

Status: offline

Blaine

Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
Thanks Smile and glad I was able to help.

I have now uploaded this completed example so others may use it to guide them on how to use the custom membership feature. This requirement was to add two additional fields on registration "Full Name" and "Graduation Year". Adding one new field is not much less work then adding 10 since it requires all the custom functions to be created and a new database table to store the additional field(s).

The archive is available here includes the complete functions, SQL and detailed instructions.
Geeklog components by PortalParts -- www.portalparts.com
 Quote

All times are EST. The time is now 01:08 pm.

  • 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