v4.x: remove first and last name from signup page

cr33p

Member
YetiShare User
May 8, 2016
33
2
8
hi
if i remove first and last name from signup page, will registration work ok ?
i mean, i don't need people to type in such details
thanks in advance.
 

cr33p

Member
YetiShare User
May 8, 2016
33
2
8
how can i disable first and last name ?
can i just comment in html ?
 

adam

Administrator
Staff member
Dec 5, 2009
2,008
97
48
Hi,

Yes you should be able to remove it. Try the following:

In:

"\themes\flow\templates\register.html"

Find and remove:

Code:
$title               = trim($_REQUEST['title']);
$firstname           = trim($_REQUEST['firstname']);
$lastname            = trim($_REQUEST['lastname']);
Also remove:

Code:
if (!strlen($title))
{
    notification::setError(t("please_enter_your_title", "Please enter your title"));
}
elseif (!strlen($firstname))
{
    notification::setError(t("please_enter_your_firstname", "Please enter your firstname"));
}
elseif (!strlen($lastname))
{
    notification::setError(t("please_enter_your_lastname", "Please enter your lastname"));
}
Change:

Code:
UserPeer::create($username, $newPassword, $emailAddress, $title, $firstname, $lastname);
to:

Code:
UserPeer::create($username, $newPassword, $emailAddress, 'Mr', '', '');
You'll need to edit the content for the register email as it uses the firstnae. In the script admin, languages section, search for and edit the content for 'register_user_email_content'.

Remove:

Code:
<div class="input-group"> <span class="input-group-addon"><i class="fa fa-chevron-right"></i></span>
                <select class="form-control" autofocus="autofocus" tabindex="1" id="title" name="title">
                    <option disabled selected><?php echo t("title", "title"); ?></option>
                    <option value="Mr" <?php echo ($title == 'Mr') ? 'SELECTED' : ''; ?>><?php echo t('title_mr', 'Mr'); ?></option>
                    <option value="Ms" <?php echo ($title == 'Ms') ? 'SELECTED' : ''; ?>><?php echo t('title_ms', 'Ms'); ?></option>
                    <option value="Mrs" <?php echo ($title == 'Mrs') ? 'SELECTED' : ''; ?>><?php echo t('title_mrs', 'Mrs'); ?></option>
                    <option value="Miss" <?php echo ($title == 'Miss') ? 'SELECTED' : ''; ?>><?php echo t('title_miss', 'Miss'); ?></option>
                    <option value="Dr" <?php echo ($title == 'Dr') ? 'SELECTED' : ''; ?>><?php echo t('title_dr', 'Dr'); ?></option>
                    <option value="Pro" <?php echo ($title == 'Pro') ? 'SELECTED' : ''; ?>><?php echo t('title_pro', 'Pro'); ?></option>
                </select>
            </div>
            <div class="input-group"><span class="input-group-addon"><i class="fa fa-chevron-right"></i></span>
                <input type="text" class="form-control" placeholder="<?php echo t("firstname", "firstname"); ?>" tabindex="1" value="<?php echo isset($firstname) ? validation::safeOutputToScreen($firstname) : ''; ?>" id="firstname" name="firstname">
            </div>
            <div class="input-group"><span class="input-group-addon"><i class="fa fa-chevron-right"></i></span>
                <input type="text" class="form-control" placeholder="<?php echo t("lastname", "lastname"); ?>" tabindex="1" value="<?php echo isset($lastname) ? validation::safeOutputToScreen($lastname) : ''; ?>" id="lastname" name="lastname">
            </div>
That *should* do it. I've not tested it locally, but it should point you in the right direction.

Thanks,
Adam.
 
  • Like
Reactions: cr33p