Jump to content

Disable "registration"


Recommended Posts

  • 2 weeks later...
  • 3 weeks later...

Hi guys,

 

Here is the solution, but not professional. (can't modify from admin - but can modified from authentication.tpl)

 

Change this code in yourtheme/authentication.tpl:

 

<form action="{$link->getPageLink('authentication.php', true)}" method="post" id="create-account_form" class="std">
 <fieldset>
  <h3>{l s='Create your account'}</h3>
  <h4>{l s='Enter your e-mail address to create an account'}.</h4>
  <p class="text">
   <label for="email_create">{l s='E-mail address'}</label>
   <span><input type="text" id="email_create" name="email_create" value="{if isset($smarty.post.email_create)}{$smarty.post.email_create|escape:'htmlall':'UTF-8'|stripslashes}{/if}" class="account_input" /></span>
  </p>
  <p class="submit">
  {if isset($back)}<input type="hidden" class="hidden" name="back" value="{$back|escape:'htmlall':'UTF-8'}" />{/if}
   <input type="submit" id="SubmitCreate" name="SubmitCreate" class="button_large" value="{l s='Create your account'}" />
   <input type="hidden" class="hidden" name="SubmitCreate" value="{l s='Create your account'}" />
  </p>
 </fieldset>
</form>
<form action="{$link->getPageLink('authentication.php', true)}" method="post" id="login_form" class="std">
 <fieldset>
  <h3>{l s='Already registered ?'}</h3>
  <p class="text">
   <label for="email">{l s='E-mail address'}</label>
   <span><input type="text" id="email" name="email" value="{if isset($smarty.post.email)}{$smarty.post.email|escape:'htmlall':'UTF-8'|stripslashes}{/if}" class="account_input" /></span>
  </p>
  <p class="text">
   <label for="passwd">{l s='Password'}</label>
   <span><input type="password" id="passwd" name="passwd" value="{if isset($smarty.post.passwd)}{$smarty.post.passwd|escape:'htmlall':'UTF-8'|stripslashes}{/if}" class="account_input" /></span>
  </p>
  <p class="submit">
   {if isset($back)}<input type="hidden" class="hidden" name="back" value="{$back|escape:'htmlall':'UTF-8'}" />{/if}
   <input type="submit" id="SubmitLogin" name="SubmitLogin" class="button" value="{l s='Log in'}" />
  </p>
  <p class="lost_password"><a href="{$link->getPageLink('password.php')}">{l s='Forgot your password?'}</a></p>
 </fieldset>
</form>

 

to this:

 

<form action="{$link->getPageLink('authentication.php', true)}" method="post" id="create-account_form" class="std">
 <fieldset>
 {if $regenabled == 'true'}
  <h3>{l s='Create your account'}</h3>
  <h4>{l s='Enter your e-mail address to create an account'}.</h4>
  <p class="text">
   <label for="email_create">{l s='E-mail address'}</label>
   <input type="text" id="email_create" name="email_create" value="{if isset($smarty.post.email_create)}{$smarty.post.email_create|escape:'htmlall':'UTF-8'|stripslashes}{/if}" class="account_input" />
  </p>
  <p class="submit">
  {if isset($back)}<input type="hidden" class="hidden" name="back" value="{$back|escape:'htmlall':'UTF-8'}" />{/if}
   <input type="submit" id="SubmitCreate" name="SubmitCreate" class="button_large" value="{l s='Create your account'}" />
   <input type="hidden" class="hidden" name="SubmitCreate" value="{l s='Create your account'}" />
  </p>
 {else}
 <h3>{l s='Registration currently unavailable'}</h3>
 {/if}
 </fieldset>
</form>
<form action="{$link->getPageLink('authentication.php', true)}" method="post" id="login_form" class="std">
 <fieldset>
  <h3>{l s='Already registered ?'}</h3>
  <p class="text">
   <label for="email">{l s='E-mail address'}</label>
   <input type="text" id="email" name="email" value="{if isset($smarty.post.email)}{$smarty.post.email|escape:'htmlall':'UTF-8'|stripslashes}{/if}" class="account_input" />
  </p>
  <p class="text">
   <label for="passwd">{l s='Password'}</label>
   <input type="password" id="passwd" name="passwd" value="{if isset($smarty.post.passwd)}{$smarty.post.passwd|escape:'htmlall':'UTF-8'|stripslashes}{/if}" class="account_input" />
  </p>
  <p class="submit">
   {if isset($back)}<input type="hidden" class="hidden" name="back" value="{$back|escape:'htmlall':'UTF-8'}" />{/if}
   <input type="submit" id="SubmitLogin" name="SubmitLogin" class="button" value="{l s='Log in'}" />
  </p>
  <p class="lost_password"><a href="{$link->getPageLink('password.php')}">{l s='Forgot your password?'}</a></p>
 </fieldset>
</form>

 

And add this to first line:

 

{$regenabled = 'false'}

 

If the value is "true", the registration is enabled. Any other word means that the registration is disabled.

Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...

HERE IS THE SOLUTION !!!!

 

 

First of all modify this file:

 

prestashop_root_folder/controllers/AuthController.php

 

Simply you have to comment these lines (usually from 46 to 63):

 

if (Tools::isSubmit('SubmitCreate'))

{

if (!Validate::isEmail($email = Tools::getValue('email_create')) OR empty($email))

$this->errors[] = Tools::displayError('Invalid e-mail address');

elseif (Customer::customerExists($email))

{

$this->errors[] = Tools::displayError('An account is already registered with this e-mail, please fill in the password or request a new one.');

$_POST['email'] = $_POST['email_create'];

unset($_POST['email_create']);

}

else

{

$create_account = 1;

self::$smarty->assign('email_create', Tools::safeOutput($email));

$_POST['email'] = $email;

 

}

}

 

 

Now the "Create your account" button is disabled!!

 

 

Now you have to hide the register new account form.

Edit the file:

 

/prestashop_root_folder/themes/your_theme/css/authentication.css

 

add "color: transparent;" and "margin-left: 9000%" option to the "#create-account" lines.

Probably you will need to split some line from others grouped by a comma (","): it's simple, you have just to remove the comma and insert a "{" and a "}" after the option. See below this example (authentication.css file used in the black-white free template downloaded from http://addons.prestashop.com/it/neutral/3516-black-white.html).

 

ORIGINAL FILE:

 

/* authentication.tpl */

#create-account_form,

#authentication #login_form {

width: 49%;

height: 20em;

clear: none;

float: left

}

#create-account_form h4 {

height: 3.4em;

padding: 0.3em 3em 0 4em

}

#create-account_form p.text,

#authentication #login_form p.text {

height: 3.4em;

margin-left: 4em;

padding-left: 0;

padding-right: 0

}

#authentication #login_form a { color: #000 }

 

#create-account_form { margin-right: 11px }

 

#create-account_form p.text {

text-align: left;

width: 100px

}

#authentication #create-account_form p.text label { width: 100px }

#authentication input#SubmitCreate,

#authentication input#SubmitLogin { margin: 0 }

#authentication p.submit {

margin-right: 0;

text-align: left;

padding-left: 17%!important

}

#authentication p.lost_password { padding-left: 4em }

#authentication #create-account_form fieldset,

#authentication #login_form fieldset { height: 18em }

#authentication p.submit span { padding-right: 0.5em }

#create-account_form label, #authentication #login_form label {

float: none;

clear: both;

display: block;

text-align: left;

width: 100%;

margin-bottom: 0.3em

}

#account-creation_form input.text,

#account-creation_form #id_country,

#account-creation_form #id_state,

#authentication textarea { width: 17em }

 

.account_creation span.inline-infos

{

width:100%;

text-align:left;

margin:2px 0 2px 32%;

font-size:9px;

}

 

 

MODIFIED FILE:

 

/* authentication.tpl */

#create-account_form {

color: transparent;

}

#authentication #login_form {

margin-top: -160px;

width: 49%;

height: 20em;

clear: none;

float: right

}

#create-account_form h4 {

color: transparent;

height: 3.4em;

padding: 0.3em 3em 0 4em

}

#create-account_form p.text {

color: transparent;

}

#authentication #login_form p.text {

height: 3.4em;

margin-left: 4em;

padding-left: 0;

padding-right: 0

}

#authentication #login_form a { color: #000 }

 

#create-account_form {

color: transparent;

margin-right: 11px

}

 

#create-account_form p.text {

color: transparent;

text-align: left;

width: 100px

}

#authentication #create-account_form p.text label {

margin-left: 9000%;

width: 100px }

#authentication input#SubmitCreate {

margin-left: 9000%;

}

#authentication input#SubmitLogin { margin: 0 }

#authentication p.submit {

margin-right: 0;

text-align: left;

padding-left: 17%!important

}

#authentication p.lost_password { padding-left: 4em }

#authentication #create-account_form fieldset {

margin-left: 9000%;

}

#authentication #login_form fieldset { height: 18em }

#authentication p.submit span { padding-right: 0.5em }

#create-account_form label {

color: transparent;

}

#authentication #login_form label {

float: none;

clear: both;

display: block;

text-align: left;

width: 100%;

margin-bottom: 0.3em

}

#account-creation_form input.text {

color: transparent;

}

#account-creation_form #id_country {

color: transparent;

}

#account-creation_form #id_state {

color: transparent;

}

#authentication textarea { width: 17em }

 

.account_creation span.inline-infos

{

color: transparent;

width:100%;

text-align:left;

margin:2px 0 2px 32%;

font-size:9px;

}

Link to comment
Share on other sites

  • 1 year later...
  • 10 months later...
  • 2 months later...

Hi

 

I'm strugglng with the same issue. Its so weird. I understand that having all the information in the PS backend, gives more power to PS. But come on, there is some stores that wants to avoid this process due to the kind of products/services, I delete the log in/sign up buttons from the main page. Now I tested the checkout process and PAW! All the tedious process is there, account and address creation. I know that you can avoid the address creation through the General/Customer dashboard option, selecting Only Account Creation, but its not working for me. Maybe due to I'm using the spanish version.

 

Now my store is complete, otherwise I'd change to another framework gladly.

 

BTW, I guess PS is earning some money, so, an official support for their users would be great.

 

Regards.

Edited by flavex (see edit history)
Link to comment
Share on other sites

  • 4 weeks later...

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
×
×
  • Create New...