Override template won't connect to custom user class

Author Message

Martin Crockett

Thursday 20 January 2005 4:59:07 am

Hi,

I wonder if someone can shed some light on a tricky problem I have come across.

I have created a custom user class to store registered users who wish to receive a newsletter.

I have overridden 'user/register.tpl' using:

	[register_form]
	Source=user/register.tpl
	MatchFile=register_form.tpl
	Subdir=templates

in my override.ini.append.php file.

and:

	[UserSettings] # {I think this was correct)
	RegistrationEmail=enabled
	DefaultUserPlacement=25
	UserClassID=25

in my site.ini.append.php file.

All that gets displayed in my '/index.php/user/register' file is the standard form. The overridden form is ignored.

I have read http://ez.no/ez_publish/documentation/incoming/tutorial_using_user_register but am no closer to solving the problem.

The documentation seems very sparse on the subject and the legacy forum messages fail to shed light on the subject.

Using: eZ Publish 3.5 - Cache has been cleared.

Help me please before all my hair turns grey! :-)

Thanks in advance,

Martin

Łukasz Serwatka

Thursday 20 January 2005 5:07:56 am

Hi,

Try this ...

[register_form]
Source=user/register.tpl
MatchFile=register_form.tpl
Subdir=templates
Match[class]=25

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Balazs Halasy

Thursday 20 January 2005 5:26:38 am

Hi,

An easier way to do this:

Create your own register.tpl and place it in /design/<your_design>/templates/user/register.tpl - eZ publish will automatically use it because it is there (and thus it will not fallback to the register template that lives in the standard design).

Allman

Clive Flatau

Thursday 20 January 2005 6:50:29 am

Are you suggesting that the override mechanism detailed above does not work?

What happens when you have more than one type of user registration requiring more than one type of template/form?

Clive Flatau

Thursday 20 January 2005 7:06:45 am

By the way. If we take out the Match[class]=25 line then them register_form.tpl is used. Otherwise it falls back to register.tpl ...

Łukasz Serwatka

Thursday 20 January 2005 7:19:00 am

If you going to use only one tpl for user class, Allmans example is very good.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Martin Crockett

Thursday 20 January 2005 7:24:42 am

It's a custom user class for public website visitors to sign-up for a news alert.

It will require a separate registration form.

Martin Crockett

Thursday 20 January 2005 8:14:24 am

[register_form]
Source=user/register.tpl
MatchFile=register_form.tpl
Subdir=templates
Match[class]=25

Doesn't work either, unfortunately.

Łukasz Serwatka

Thursday 20 January 2005 8:44:49 am

[register_form]
Source=user/register.tpl
MatchFile=register_form.tpl
Subdir=templates 

I ve test this code and works fine on default settings in site.ini. Clear the all cache or delete /var/cache and /var/prefix/cache. If still doesn`t work, reset your settings to default in site.ini.

EDIT:

I ve also test

[register_form]
Source=user/register.tpl
MatchFile=register_form.tpl
Subdir=templates 
Match[class_identifier]=user

and

[register_form]
Source=user/register.tpl
MatchFile=register_form.tpl
Subdir=templates 
Match[class]=4

Both works too :-)

I think that you have problem with cache.

[UserSettings] 
RegistrationEmail=enabled
DefaultUserPlacement=  //place where new user will be created! (usualy user group)
UserClassID=25 //your user class

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Clive Flatau

Thursday 20 January 2005 9:32:58 am

Hi Luke,

Thanks for your interest so far. Martin and I are working together on this.

In your last post you are using the base user class User whose id is 4.

What we to do is use our own user class with it's own attributes e.g. a class called Subscriber with an id of 25 and still be able to interface it to the User module:

[UserSettings]
RegistrationEmail=enabled
DefaultUserPlacement=367 // yes - this is the id of the user group 
UserClassID=25

We override the user/register.tpl,

[register_form]
Source=user/register.tpl
MatchFile=register_form.tpl
Subdir=templates

but use the same script to extract the class attributes.

The problem is that the attributes that are displayed are for the base class User (4) and not Subscriber (25) which is the one we want to use for registration.

I hope this is clear.

Clive

Łukasz Serwatka

Thursday 20 January 2005 9:41:39 am

# Where to send email of newly registered users
RegistrationEmail=

Why you set value "enabled" ? Can you paste your all configs for user registartion?

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Clive Flatau

Thursday 20 January 2005 9:45:55 am

Basically that was it, the [UserSettings] are in settings/<our site>/site.append.ini.php and [register_form] is at the botton of settings/<our site>/override.ini.php.

The RegistrationEmail=enabled was probably copied in from somewhere by default would this cause a problem?

Clive

Clive Flatau

Friday 21 January 2005 6:13:52 am

Ok - by random exercising we got it to work.

Basically if you submit the form to register a user (this using the base register.tpl), the next time you go to the registration form it has now switched to register_form.tpl and (the important thing) it uses the new user class's (id 25) attributes to build the form.

This seems to be a caching problem, although we deleted all caches in between attempts. It would be good if someone could explain this behaviour to us.

On to the next problem ...

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.