Registration form

Registration form is redesigned in version 4.4.3 and uses collection of new Saurus API tags as {init_profile}, {save_profile}, {save_sso} and {save_mailinglist}.
NB! We strongly suggest not to use old Saurus API tag {print_users_form} anymore.


{**
 * Registration and users profile form, content template
 * Date: 27.07.07
 *
 * @package saurus4
 *
 * @author Saurus <saurus@saurus.info>
 *
 *}

<div id="RegisterContainer">

{************ Check if site visitors are allowed to register? (site configuration) ********}

{* if user is not logged in and registering is not allowed then show error message for editors *}
{if !$user && !$conf.users_can_register}
    <h1>Site visitors are not allowed to register by site's configuration.</h1>
{else}

    {assign var="show_form" value=1}
   
    {if $smarty.post.save == 1}
       
        {if $userdata->user_id}
            {*************** UPDATE USER DATA ************}
            {save_profile name="user_id" profile_id=$userdata->profile_id id=$userdata->user_id fields=$smarty.post username=$userdata->all.username password=$smarty.post.password confirm_password=$smarty.post.confirm_password}
           
            {if $user_id}
               
                {save_sso user=$user_id fields=$smarty.post.sso}
                {save_mailinglist user=$user_id fields=$smarty.post.mailinglist_sections}
               
                {assign var="show_form" value=0}
               
                {init_article name="art" system_message="art_kasutaja_uuendatud_id"}
               
                {if $art->show_headline}
                    <h1>{$art->buttons}{$art->title}</h1>
                {/if}
               
                <div>
                    {$art->lead}<br>{$art->body}
                </div>
            {/if}
        {else}
            {*************** SAVE NEW USER DATA ************}
            {save_profile name="user_id" profile="contact" fields=$smarty.post password=$smarty.post.password confirm_password=$smarty.post.confirm_password}
           
            {if $user_id}
                {save_sso user=$user_id fields=$smarty.post.sso}
                {save_mailinglist user=$user_id fields=$smarty.post.mailinglist_sections}
               
                {assign var="show_form" value=0}
               
                {init_article name="art" system_message="art_kasutaja_registreeritud_id"}
               
                {if $art->show_headline}
                    <h1>{$art->buttons}{$art->title}</h1>
                {/if}
               
                <div>
                    {$art->lead}<br>{$art->body}
                </div>
            {/if}
        {/if}
       
    {/if}
   
    {*************** THE USER FORM ************}
    {if $show_form}
        {if $userdata->user_id}
            {init_profile name="register" profile_id=$userdata->profile_id id=$userdata->user_id readonly_fields="username"}
            <h1>{sysword word="profile" type="saurus4"}</h1>
        {else}
            {init_profile name="register" profile="contact"}
           
            <h1>{sysword word="register" type="saurus4"}</h1>
        {/if}
       
        <form method="POST" name="frmEdit">
       
            <table>
                {foreach from=$register->data item="profile_field"}
                <tr>
                    <td>{$profile_field->label}{if $profile_field->is_required} *{/if}</td>
                    <td>{$profile_field->html}</td>
                </tr>
                {* special fields after username for password and confirm password *}
                {if $profile_field->name == 'username'}
                <tr>
                    <td>{sysword word="password" type="users"} *</td>
                    <td><input type="password" name="password">{if $smarty.post.form_error.password}<br><font color="red"><b>{$smarty.post.form_error.password}</b></font>{/if}</td>
                </tr>
                <tr>
                    <td>{sysword word="password confirmation" type="users"} *</td>
                    <td><input type="password" name="confirm_password"></td>
                </tr>
                {/if}
                {/foreach}
            </table>
           
            {*************** SSO APPLICATIONS ************}
            {init_sso name="sso_apps"}
            {if $sso_apps > 0}
            {********** TITLE **********}
            <p class="separator">{sysword word="applications login info" type="saurus4"}</p>
           
            <table>
                <tr>
                    <td>{sysword word="application name" type="saurus4"}</td>
                    <td>{sysword word="username" type="saurus4"}</td>
                    <td>{sysword word="password" type="editor"}</td>
                </tr>
                {********** PRINT SSO NAMES **********}
                {foreach from=$sso_apps item=sso}
                <tr>
                    <td><input type="checkbox" name="sso[{$sso->id}][id]" value="{$sso->id}" {if $sso->user_registered == 1} checked="checked"{/if}>{$sso->app_name}</td>
                    <td><input type="text" name="sso[{$sso->id}][user_value]" value="{$sso->user_value}"  class="FormText"></td>
                    <td><input type="password" name="sso[{$sso->id}][pwd_value]" value="{if $sso->pwd_value}******{/if}" class="FormText"></td>
                </tr>
                {/foreach}
            </table>
            {/if} {* SSO *}
           
            {*************** MAILINGLISTS ************}
            {init_mailinglist name="list"}
            {if $list_count > 0}
            {********** TITLE **********}
            <p class="separator">{sysword word="mailinglists" type="saurus4"}</p>
            <table>
                {********** PRINT CHECKBOXES AND SECTION NAMES **********}
                {foreach from=$list item=section}
                    <tr>
                        <td>
                            <input type="checkbox" name="mailinglist_sections[]" value="{$section->id}" {if $section->user_subscribed == 1} checked="checked"{/if}>
                            <a href="?id={$section->id}" target="_blank">{$section->title}</a>
                        </td>
                    </tr>
                {/foreach}
                </table>
            {/if}
           
            <input type="hidden" name="id" value="{$id}">
            <input type="hidden" name="save" value="1">
            <input type="hidden" name="op" value="{$op}">
            <input type="submit" value="{sysword word="send" type="saurus4"}">
           
        </form>
    {/if}

{/if}

</div><!-- / RegisterContainer -->

Registration form (Saurus 3)

{* Saurus CMS default user registration form, written in Saurus API *}

<form method="post" name="regvorm" action="{$self}">

{************ TITLE ********}

<font class="pealkiri">
{if $user}
 {sysword word="Profile" type="kujundus"}
{else}
 {sysword word="Registreerimisvorm" type="kujundus"}
{/if}
</font>
<br>

{************ HIDDEN FIELDS ********}

<input type=hidden name=id value="{$id}">
<input type=hidden name=op value="register">
{if $user}<input type=hidden name=op2 value="change_confirm">
{else}<input type=hidden name=op2 value="register_confirm">
{/if}

{************ EXPIRED PASSWORD MESSAGE ********}

{if $user->pass_expired}
  <b><font class=txt><font color=red>{sysword word="Password expired message" type="kasutaja"}</font></font></b>
  <br>
{/if}

{************ TABLE ********}
{get_fields name="fields" table="kasutaja"}

<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="20%">&nbsp;</td>
<td width="80%">&nbsp;</td>
</tr>

{foreach from=$fields item=field}

 {*********** VISIBLE FIELDS *********}

 {if $field == 'eesnimi' || $field == 'perenimi' || $field == 'user' || $field == 'pass' || $field == 'email' || $field == 'tiitel' || $field == 'postiaadress' || $field == 'postiindeks' || $field == 'telefon'}

  {*********** REQUIRED FIELDS *********}
  {if $field == 'user' || $field == 'pass' || $field == 'email'}
   {assign var="required" value="1"}
  {else}
   {assign var="required" value="0"}
  {/if}

  {*********** PRINT ROW *********}
   <tr {cyclevalues="bgcolor=#F5F5F5,''"}>
   <td class="txt" valign="top">{sysword word=$field type="Reg.users"}{if $required}*{/if}:</td>
   <td class="txt">
  {*********** FIND FIELD VALUE *********}
   {assign var="value" value=""}
   {if $user}
   {* set password empty *}
   {if $field == "pass"}
    {assign var="value" value=""}
   {* show previous values OR saved field value *}
   {else}
    {if $smarty.post.op2 == "error"}
     {assign var="value" value=$form_data.$field}
    {else}
     {assign var="value" value=$userdata->all.$field}
    {/if}
   {/if} 
  {* set last post value for new registration*}
  {else}
    {assign var="value" value=$form_data.$field}
  {/if} {*user*}

   {*********** PRINT TEXTBOX *********}
  {if $user && $field == 'user'} {* username is not changeable *}
    {$value}
  {else}
   <INPUT type="{if $field = = "pass"}password{else}text{/if}" class="searchbox" name="{$field}" value="{$value}">
  {/if} 

  {*********** PRINT REQUIRED HIDDEN FIELD *********}
  <INPUT type="hidden" name="required_{$field}" value="{$required}">

  {*********** ERROR MESSAGE ************}
  {if $form_error.$field}<font color=red>{$form_error.$field}</font>{/if}
  </td>
  </tr>

  {*********** AFTER PASSWORD: PASSWORD CONFRIMATION ROW ************}
  {if $field == 'pass'}
    <tr {cyclevalues="bgcolor=#F5F5F5,''"}>
    <td class="txt" valign="top">{sysword word="password confirmation" type="Reg.users"}{if $required}*{/if}:</td>
    <td class="txt"><INPUT type="password" class="searchbox" name="{$field}_check" value="{$value}">  <INPUT type="hidden" name="required_{$field}_check" value="{$required}"></td>
   </tr>
  {/if}

 {/if}
{/foreach}

{*************** MAILINGLISTS ************}
{init_mailinglist name="list"}
{if $list_count > 0}
 {********** TITLE **********}
 <tr>
 <td colspan=2><br><font class="pealkiri">{sysword word="mailinglists" type="Reg.users"}</font></td>
 </tr>
 {********** PRINT CHECKBOXES AND SECTION NAMES **********}
 {foreach from=$list item=section}
  <tr>
   <td colspan=2><input type=checkbox name="rubriik[]" value="{$section->id}" {if $section->user_subscribed == 1} checked{/if}> <ahref="?id={$section->id}" target="_new" class="navi2_on">{$section->title}</a></td>
  </tr>
 {/foreach}
{/if}

<tr>
<td width="10%">&nbsp;</td>
<td width="20%">&nbsp;</td>
<td width="80%">&nbsp;</td>
</tr>
</table>
{************ / TABLE ********}


{*************** SAVE BUTTON ************}
<input type="submit" value='{sysword word="Saada" type="kasutaja"}' class="searchbtn">

 

</form>