Jump to content

Modifying Registration Form - Adding And Removing?


iamp

Recommended Posts

Hi everyone,

 

I've just started using Blesta, and have been working my way through getting it right. I've gotten to the user registration form - there are a few fields I really don't need from clients, and I was wondering if I can switch them off?

Similarly, I'd love to be able to add one extra field (checkbox) and hook into it when they submit (an API for a newsletter) - is there any defined way of doing this / could anyone point me in the right direction?

Many thanks!

Link to comment
Share on other sites

Not all of the fields on the registration form are required (essentially just name and email), although it may not be clear which those are on that page. We have plans to allow fields to be made optional/hidden as described in CORE-547, but that feature is still pending. Currently, if you really needed to remove those fields, you would need to update the appropriate order plugin registration template to do so in your own copy of Blesta.

 

You can add additional fields, like a checkbox, by creating a custom field under [settings] -> [Company] -> [Client Custom Fields]. The fields will then appear on the registration form if they are assigned to the same client group as the registration form.

 

To tie your custom field to an action, you will need to create a custom plugin. Such a plugin could tie into the Clients.create event to check whether the custom field is set when the client registers, and then perform any logic necessary to interface with your newsletter API.

Link to comment
Share on other sites

If you want to dive deep, I just reapplied a customization I had made.  On the order form for new customer signups, I wanted to force users to use their email address.  In order to do this you need to change the following:

MAKE A BACKUP BEFORE ALTERING

{install directory}/plugins/order/views/templates/standard/main_signup.pdt

 

To force e-mail, you'll need to change line 247 to:

$this->Form->fieldHidden("username_type", "email");

Then you'll need to delete lines 248-256, and 246

 

Be cautious about editing, and if in doubt, change the field type to hidden as above and give it a static value then remove the label.

Link to comment
Share on other sites

Hi @Tyson, @mdoering - thanks for the help - I got the fields out no problem at all. I LOVE how easy it is to modify Blesta - I'm a long time WHMCS user and its just so easy. 

 

I'm having trouble hooking into the clients create event, but I'll keep going - thanks again!

Link to comment
Share on other sites

  • 7 months later...

If you want to dive deep, I just reapplied a customization I had made.  On the order form for new customer signups, I wanted to force users to use their email address.  In order to do this you need to change the following:

MAKE A BACKUP BEFORE ALTERING

{install directory}/plugins/order/views/templates/standard/main_signup.pdt

 

To force e-mail, you'll need to change line 247 to:

$this->Form->fieldHidden("username_type", "email");

Then you'll need to delete lines 248-256, and 246

 

Be cautious about editing, and if in doubt, change the field type to hidden as above and give it a static value then remove the label.

 

Dude, you are the freaking man. This behavior should be default. Why complicate matters by allowing customers to choose a username on TOP of their e-mail address, when both must be unique? Usability, man. There's no substitute. Thanks again.

 

EDIT: The code has changed a little. Can you specify the line I am changing FROM?

Link to comment
Share on other sites

You will need to make these changes in the following files. * is a wildcard.

plugins/order/views/templates/*/signup.pdt,

plugins/order/views/templates/standard/types/registration/signup.pdt

 

After

$this->Form->fieldHidden("action", "signup"); 
Add

$this->Form->fieldHidden("username_type", "email"); 
And remove the following code:

<div class="radio">
	<label>
		<?php
		$this->Form->fieldRadio("username_type", "email", ($this->Html->ifSet($vars->username_type, "email") == "email"), array("id"=>"username_type_email"));
		$this->_("Signup.index.field_username_type_email");
		?>
	</label>
</div>
<div class="radio">
	<label>
		<?php
		$this->Form->fieldRadio("username_type", "username", ($this->Html->ifSet($vars->username_type) == "username"), array("id"=>"username_type_username"));
		$this->_("Signup.index.field_username_type_username");
		?>
	</label>
</div>
<div class="form-group username">
	<?php
	$this->Form->label($this->_("Signup.index.field_username", true), "signup_username");
	$this->Form->fieldText("username", $this->Html->ifSet($vars->username), array("id"=>"signup_username", 'class' => "form-control", 'placeholder' => $this->_("Signup.index.field_username", true)));
	?>
</div>
This won't completely prevent someone from using a custom username, to do that you could use the attached vQmod.

username_type_email.xml

Link to comment
Share on other sites

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

If you look at the status in the issue itself, it shows that it was resolved (completed) on 29 Sep and will be in version 3.4 :)

 

Awesome. Is there an ETA on that version? Waiting for this before I buy a perm blesta license, but I really want to do that soon.

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.

Loading...
×
×
  • Create New...