Extending the user module

Author Message

Felix Laate

Tuesday 29 January 2008 2:42:27 pm

Hi all!

I'm looking into the possibility of extending the user module. Registering a user currently works like this:

- The user fills out a form
- The userobject is created and a verification email is sent
- The user confirms the registration

This way of doing things have two major drawbacks:

1) Sending emails from such a system can be hazardous. In my experience, on some sytems, up to a third of all such emails sent never reach their destinaton

2) It makes the registration-process difficult for dummies (which, believe it or not, make up most of the world population :-))

So what I want to do, is to do a rewrite and accomplish this:

- The user fils out a form
- A SMS is sent to the user with a 4-digit pincode
- The user enters the code and is ready to go

I had a look into the user module. It is by nature a part of the kernel, and I really don't want to mess it up. Even if a hack seems to be the quickest way to achieve things, I realy want to do this in an extension.

Is it possible to extend parts of a modue? Or do I need to make a new module, very similar to the original?

Any help is helpfull!

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Piotrek Karaś

Tuesday 29 January 2008 9:34:05 pm

My guess is that it is perfectly possible by setting up a new module extension (for example smsregister), with register view copied from the kernel and then modified according to your needs. A view is just an interface to certain system state, and I am pretty sure you can have multiple different interfaces, which are independent. You can also turn disable the standard register view without having to touch the kernel (ini).

I might be wrong here, but seems to me that a module is an abstract collection of views and fetches (and maybe some reusable parts of code), so creating a custom view for a module would actually extend module's functionality as such, but not affect anything 'in it'.

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Nathan Kelly

Monday 07 April 2008 7:47:51 pm

<i>Is it possible to extend parts of a modue? Or do I need to make a new module, very similar to the original?</i>

Hi, I'm in need of a similar solution and I'm with Felix, I don't want to mess with the kernel either. Is it possible to extend parts of a module? If so can someone maybe point me to some documentation that might explain how to do this?

The changes I need to make to the registration process are rather minor so it would be great if I didn't have to recreate the entire user module for the sake of 50 odd lines of code.

Cheers.

Pardon me while I burst into flames...

Felix Laate

Monday 07 April 2008 11:54:13 pm

@Nathan,

we are currently looking into the possibility of patching kernel/user/register.php to allow for other types of handling than the default one (email). More specifically we plan to add a custom handling method, defined in an ini-file, which lets you control the registration process and thus the feedback/activation methods.

If successful, we plan to kindly request for the adoption of this enhancement into ezpublish.

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

André R.

Wednesday 09 April 2008 5:20:32 am

Patch for letting you extend the user register code can be found here:
http://issues.ez.no/IssueView.php?Id=12835&activeItem=2

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Nathan Kelly

Wednesday 09 April 2008 5:44:00 am

Wow, that was a quicker response than I expected, thank André I'll check it out.

I must say it would be nice if this sort of action was possible with every core
module, I had to hack a kernel file for the browse function which simply added the
ability to specify the start node with a hidden input field in one of my
developments because the start node depended on the current user, this was a
function not achievable through ini settings and it wasn't worth developing an
entire extension for due to the fact it only needed three lines of code.

I would like to see the ability to extend all of the core modules and functions in
future versions, I think this will add yet another layer of flexibility to eZ and I
can't see it being a major issue to implement, simply add in a check if additional
functionality has been set in an extension and if so execute it within the current
action. This would basically be a plugin mechanism for core modules, the only issue
I can see would be executing multiple plugins/extra actions within one module action
instance, but you guys are pretty brainy ;).

I'll check this patch out, thanks André.

Pardon me while I burst into flames...

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

eZ debug

Timing: Jan 19 2025 20:10:53
Script start
Timing: Jan 19 2025 20:10:53
Module start 'layout'
Timing: Jan 19 2025 20:10:53
Module start 'content'
Timing: Jan 19 2025 20:10:54
Module end 'content'
Timing: Jan 19 2025 20:10:54
Script end

Main resources:

Total runtime0.9058 sec
Peak memory usage4,096.0000 KB
Database Queries70

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 589.1563152.6250
Module start 'layout' 0.00570.0031 741.781339.4453
Module start 'content' 0.00880.8954 781.2266673.0234
Module end 'content' 0.90420.0016 1,454.250020.1641
Script end 0.9058  1,474.4141 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.3502160.0002
Check MTime0.00120.1378160.0001
Mysql Total
Database connection0.00080.084110.0008
Mysqli_queries0.832791.9280700.0119
Looping result0.00080.0843680.0000
Template Total0.869596.020.4348
Template load0.00230.256620.0012
Template processing0.867295.734720.4336
Template load and register function0.00010.008610.0001
states
state_id_array0.00120.134910.0012
state_identifier_array0.00170.190220.0009
Override
Cache load0.00210.2301570.0000
Sytem overhead
Fetch class attribute can translate value0.00040.048840.0001
Fetch class attribute name0.00100.1124100.0001
XML
Image XML parsing0.00240.269640.0006
class_abstraction
Instantiating content class attribute0.00000.0026120.0000
General
dbfile0.00330.3625360.0001
String conversion0.00000.000940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 29
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs