Jump to content

Using "Email" field for "First Name" on registration.


gamestuff

Recommended Posts

I am in the process of trimming down the required information for clients to register and would like to move to only being known by email.

 

I have managed to set almost everything as needed, however I find when the "First Name" is blank, it causes issues linking back to clients through tickets as the text simply does not exist.

 

To combat this I set a hidden field:

<input type="hidden" name="firstname" id="firstname" value="Client"/>

 

However this names everyone client, which is not ideal.

 

I have tried using the email variable such as this, however it did not work:

<input type="hidden" name="firstname" id="firstname" value="{$clientemail}"/>

 

 

Does anyone know an easy way to push the "{$clientemail}" variable as the first name upon registration. Maybe I am simply missing something that I am overlooking.

Link to comment
Share on other sites

if that is what you need so create a new php file we will name it "emailasfirstname.php", and put the following code inside it:

<?php
function hook_addEmailAsFirstName($vars){
$userid = $vars['userid'];$email = $vars['email'];
# Update Client FirstNamefull_query("UPDATE `tblclients` SET `firstname`='{$email}' WHERE `id`='{$userid}'");}add_hook("ClientAdd", 1, "hook_addEmailAsFirstName");?>

then upload it to "WHMCS-Path/includes/hooks/" directory and we are done.

this Hook will be called when client is registered from admin or client area and save his email as his first name, give a try

 

- - - Updated - - -

 

sorry unable to update my last reply, your code is here:

<?php

function hook_addEmailAsFirstName($vars){
   $userid = $vars['userid'];
   $email = $vars['email'];

   # Update Client FirstName
   $updateclient = full_query("UPDATE `tblclients` SET `firstname`='{$email}' WHERE `id`='{$userid}'");
}
add_hook("ClientAdd", 1, "hook_addEmailAsFirstName");

?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated