Forums / Setup & design / Override template won't connect to custom user class

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 ...

eZ debug

Timing: Jan 18 2025 18:21:17
Script start
Timing: Jan 18 2025 18:21:17
Module start 'content'
Timing: Jan 18 2025 18:21:17
Module end 'content'
Timing: Jan 18 2025 18:21:17
Script end

Main resources:

Total runtime0.1404 sec
Peak memory usage4,096.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0048 587.9531180.8125
Module start 'content' 0.00480.0052 768.7656110.0703
Module end 'content' 0.01000.1303 878.8359539.1250
Script end 0.1403  1,417.9609 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00332.3808200.0002
Check MTime0.00120.8802200.0001
Mysql Total
Database connection0.00080.574110.0008
Mysqli_queries0.100971.86891410.0007
Looping result0.00110.74961390.0000
Template Total0.129892.510.1298
Template load0.00080.563610.0008
Template processing0.129091.904110.1290
Override
Cache load0.00050.350410.0005
Sytem overhead
Fetch class attribute can translate value0.00090.607610.0009
XML
Image XML parsing0.00020.177310.0002
General
dbfile0.00151.0697200.0001
String conversion0.00000.002930.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs