Jump to content
payam98

removing order form password

Recommended Posts

hi everyone , i want to remove password filed from the order form ! i can hide it but still the error will be there ! so client cannot submit the order. i want to know how can i remove completely ?

 

or please tell me how can do something to generate automatic password ? i mean after client order the password will be generate automatically and send it to the client email.

 

its very important for me :?:

Share this post


Link to post
Share on other sites

generate the password and pass it to your template/URL using ActionHook:ClientAreaPageCart

 

<?php

add_hook("ClientAreaPageCart", 1, function($vars){
   $generatedPassword = '';
   return array("generatedpassword" => $generatedpassword);
});

 

then edit /templates/orderforms/standards/checkout.tpl, replace:

<input type="password" name="password" id="inputNewPassword1" class="field" placeholder="{$LANG.clientareapassword}">

with:

<input type="hidden" name="password" id="inputNewPassword1" class="field" placeholder="{$LANG.clientareapassword}" value="{$generatedpassword}">

 

and:

<input type="password" name="password2" id="inputNewPassword2" class="field" placeholder="{$LANG.clientareaconfirmpassword}">

with:

<input type="hidden" name="password2" id="inputNewPassword2" class="field" placeholder="{$LANG.clientareaconfirmpassword}" value="{$generatedpassword}">

 

this way the password inputs will be hidden with a value, later you can send this password to client by email

Share this post


Link to post
Share on other sites

first of all thanks for your answer dear.

 

just one thing i didn't understand the first part because i am too beginner. can u explain me little more what is the ActionHook:ClientAreaPageCart and where should i put the php code ?

Share this post


Link to post
Share on other sites
generate the password and pass it to your template/URL using ActionHook:ClientAreaPageCart

 

<?php

add_hook("ClientAreaPageCart", 1, function($vars){
   $generatedPassword = '';
   return array("generatedpassword" => $generatedpassword);
});

 

then edit /templates/orderforms/standards/checkout.tpl, replace:

<input type="password" name="password" id="inputNewPassword1" class="field" placeholder="{$LANG.clientareapassword}">

with:

<input type="hidden" name="password" id="inputNewPassword1" class="field" placeholder="{$LANG.clientareapassword}" value="{$generatedpassword}">

 

and:

<input type="password" name="password2" id="inputNewPassword2" class="field" placeholder="{$LANG.clientareaconfirmpassword}">

with:

<input type="hidden" name="password2" id="inputNewPassword2" class="field" placeholder="{$LANG.clientareaconfirmpassword}" value="{$generatedpassword}">

 

this way the password inputs will be hidden with a value, later you can send this password to client by email

 

can u explain me little more what is the ActionHook:ClientAreaPageCart and where should i put the php code ?

Share this post


Link to post
Share on other sites

create new php file inside /includes/hooks/ directory (eg: generateRandomPassword.php) and put the following code inside:

 

<?php 

add_hook("ClientAreaPageCart", 1, function($vars){ 
   $passwordLength = 10;
   $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
   $charactersLength = strlen($characters);
   $generatedPassword = '';
   for ($i = 0; $i < $passwordLength; $i++) {
       $generatedPassword .= $characters[rand(0, $charactersLength - 1)];
   } 
   return array("generatedpassword" => $generatedpassword); 
});

Share this post


Link to post
Share on other sites
create new php file inside /includes/hooks/ directory (eg: generateRandomPassword.php) and put the following code inside:

 

<?php 

add_hook("ClientAreaPageCart", 1, function($vars){ 
   $passwordLength = 10;
   $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
   $charactersLength = strlen($characters);
   $generatedPassword = '';
   for ($i = 0; $i < $passwordLength; $i++) {
       $generatedPassword .= $characters[rand(0, $charactersLength - 1)];
   } 
   return array("generatedpassword" => $generatedpassword); 
});

 

i did everything u said but still the error comes: You did not enter a password!

 

what should i do?

Share this post


Link to post
Share on other sites

try this instead....

 

<?php 

add_hook("ClientAreaPageCart", 1, function($vars){ 
   $passwordLength = 10;
   $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
   $charactersLength = strlen($characters);
   $generatedPassword = '';
   for ($i = 0; $i < $passwordLength; $i++) {
       $generatedPassword .= $characters[mt_rand(0, $charactersLength - 1)];
   } 
   return array("generatedpassword" => $generatedPassword); 
});

Share this post


Link to post
Share on other sites
try this instead....

 

<?php 

add_hook("ClientAreaPageCart", 1, function($vars){ 
   $passwordLength = 10;
   $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
   $charactersLength = strlen($characters);
   $generatedPassword = '';
   for ($i = 0; $i < $passwordLength; $i++) {
       $generatedPassword .= $characters[mt_rand(0, $charactersLength - 1)];
   } 
   return array("generatedpassword" => $generatedPassword); 
});

 

its not work again! (You did not enter a password)

its my website: http://vezeh.com/aa/whmcs/cart.php

 

what should i do ?? my version is 6.3.1

Share this post


Link to post
Share on other sites

try this instead!

<?php  

add_hook("ClientAreaPage", 1, function($vars){
   if ($vars['filename']!="cart"){
       return;
   }
   $passwordLength = 10; 
   $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 
   $charactersLength = strlen($characters); 
   $generatedPassword = ''; 
   for ($i = 0; $i < $passwordLength; $i++) { 
       $generatedPassword .= $characters[mt_rand(0, $charactersLength - 1)]; 
   }  
   return array("generatedpassword" => $generatedPassword);  
});

Share this post


Link to post
Share on other sites
what should i do ?? my version is 6.3.1

it might have been useful if you had mentioned that at the start. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

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