Automatic virtual url for users

Author Message

Siw Helen Thorslund

Tuesday 30 May 2006 5:07:08 am

We have a customer who want a solution that will give the registered users an automatic virtual url like this:

     http://domain.com/firstname_lastname
 

Today the url is like this:

     http://domain.com/siteaccess/users/user_group/firstname_lastname
 

This is a portal site, so a manual job for doing this is not possible.

Anyone done something like this before?

Thanx in advance for any help...

www.VZT.no ( http://www.VZT.no )
VZT References ( http://http://vzt.no/index.php/vzt_eng/referanser )
VZT Extensions ( http://vzt.no/index.php/vzt_eng/extensions )
www.MediaBase.no ( http://www.MediaBase.no )

Ɓukasz Serwatka

Tuesday 30 May 2006 11:44:08 pm

Hi Siw,

You can write simple workflow event (triggered after publish) then setup new virtual forwarding (look on code in the kernel/content/urltranslator.php). The process will be automaticaly. But when portal will have 20 000 registered users the list can be quite long ;)

mod_rewrite should do the trick. With one additional rule you can redirect users to the user group:

RewriteRule ^(/+[a-z]+\_+[a-z]+)$ /users/administrator_users$1 [R=301,L]

 

http://example.com/administrator_user -> http://example.com/users/administrator_users/administrator_user

This will work but can cause problem when you have e.g folder with the same name pattern (aaa_bbb), so unique pattern for user object name should solve it (and pattern for re_write which match it). Try extend this example.

Good luck!

Cheers,
Lukasz

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

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 04:30:15
Script start
Timing: Jan 19 2025 04:30:15
Module start 'layout'
Timing: Jan 19 2025 04:30:15
Module start 'content'
Timing: Jan 19 2025 04:30:16
Module end 'content'
Timing: Jan 19 2025 04:30:16
Script end

Main resources:

Total runtime0.9772 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0078 589.1563152.6250
Module start 'layout' 0.00780.0043 741.781339.4609
Module start 'content' 0.01210.9636 781.2422540.7813
Module end 'content' 0.97570.0015 1,322.023412.1641
Script end 0.9772  1,334.1875 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.3621160.0002
Check MTime0.00140.1481160.0001
Mysql Total
Database connection0.00090.090110.0009
Mysqli_queries0.923994.5429540.0171
Looping result0.00050.0556520.0000
Template Total0.937896.020.4689
Template load0.00240.244220.0012
Template processing0.935495.722420.4677
Template load and register function0.00010.013510.0001
states
state_id_array0.00090.090210.0009
state_identifier_array0.00170.169320.0008
Override
Cache load0.00200.2005250.0001
Sytem overhead
Fetch class attribute can translate value0.00060.065920.0003
Fetch class attribute name0.00110.108340.0003
XML
Image XML parsing0.00090.096720.0005
class_abstraction
Instantiating content class attribute0.00000.000740.0000
General
dbfile0.00200.2035240.0001
String conversion0.00000.001140.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
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 18
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs