Forums / Developer / Extending the user module

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

eZ debug

Timing: Jan 31 2025 04:35:25
Script start
Timing: Jan 31 2025 04:35:26
Module start 'content'
Timing: Jan 31 2025 04:35:26
Module end 'content'
Timing: Jan 31 2025 04:35:26
Script end

Main resources:

Total runtime0.2015 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0107 587.9297180.8359
Module start 'content' 0.01080.0052 768.7656101.8672
Module end 'content' 0.01590.1855 870.6328531.7734
Script end 0.2014  1,402.4063 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00462.3055200.0002
Check MTime0.00190.9593200.0001
Mysql Total
Database connection0.00130.633310.0013
Mysqli_queries0.150574.68121410.0011
Looping result0.00120.58001390.0000
Template Total0.185291.910.1852
Template load0.00070.354310.0007
Template processing0.184491.545510.1844
Override
Cache load0.00050.263110.0005
Sytem overhead
Fetch class attribute can translate value0.00070.358910.0007
XML
Image XML parsing0.00020.121210.0002
General
dbfile0.00502.4791200.0002
String conversion0.00000.003330.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