Share » Forums » Developer » No username required for user account...

No username required for user account use email only

No username required for user account use email only

Thursday 01 March 2007 8:16:46 pm - 5 replies

Author Message

Bruce Morrison

Thursday 01 March 2007 8:44:57 pm

Hi Nathan

No real quick fix for this. What you can do without hacking the kernel is hide the username form element in the signup and set the value to be the attribute_id ("user"+ attribute_id might be better esp. if there is a length limit on usernames)

standard/templates/content/datatype/edit/ezuser.tpl

...
{* Username. *}
<div class="element">
    {section show=$attribute.content.has_stored_login}
        <input type="hidden" name="{$attribute_base}_data_user_login_{$attribute.id}_stored_login" size="16" value="{$attribute.content.login}" disabled="disabled" />
        <input type="hidden" name="{$attribute_base}_data_user_login_{$attribute.id}" value="{$attribute.content.login}" />
    {section-else}
        <input id="ezcoa-{if ne( $attribute_base, 'ContentObjectAttribute' )}{$attribute_base}-{/if}{$attribute.contentclassattribute_id}_{$attribute.contentclass_attribute_identifier}_login" class="ezcc-{$attribute.object.content_class.identifier} ezcca-{$attribute.object.content_class.identifier}_{$attribute.contentclass_attribute_identifier}" type="hidden" name="{$attribute_base}_data_user_login_{$attribute.id}" size="16" value="user{$attribute.content.id}" />
    {/section}
</div>
...

To do this completly you'd need to override all templates that use the username and hide/remove it.

Hope this helps.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Nathan Kelly

Thursday 01 March 2007 8:59:33 pm

Thanks Bruce,

I actually had this in mind and I started to test it out, I think is the cleanest fix for my problem at this stage because it only involves overriding templates as opposed to hacking.

I'm assuming I'll need to override the Admin templates too?

Cheers!

Pardon me while I burst into flames...

Nathan Kelly

Thursday 01 March 2007 9:27:18 pm

Works like a charm, but if anyone else is looking at Bruce's example there is one change needed:

Change:
value="user{$attribute.content.id}"
To:
value="user{$attribute.content.contentobject_id}"

Thanks Bruce, you just saved my hide.

Cheers!

Pardon me while I burst into flames...

Bruce Morrison

Thursday 01 March 2007 11:05:21 pm

Hi Nathan

Opps. I had meant to write:

value="user{$attribute.id}"

as

value="user{$attribute.content.contentobject_id}"

Will cause issues if for some reason there are multiple user attributes as part of the one content object (umlikely I know)

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Fabricio Guerrero

Monday 05 March 2007 9:25:23 am

hi...

changing this post just a bit...

i have a request from a client wanting us to remove passwords and only want users to have to register/login with an username.

is their a clean way to go about this? or is this some dirty kernel hacking?

regarding no username... i had a similar request over a year ago from another client and what i did i guess is a bit dirty.. but i made the user field hidden and on the onSubmit method via javascript copied over the email into the user account field(hidden field)..

this way username and email was always the same and easy to remember.

http://www.solobromasychistes.com <<Joomla Site :P
http://www.recipesforhealthyfood.com/ <<Drupal Site :P
http://www.ezforge.com/ <<future ezCommunity, Articles, forums and more...

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu