Forums / General / User's Objects on Profile

User's Objects on Profile

Author Message

kracker (the)

Friday 22 April 2005 12:01:42 pm

Hey Joanie,

Fyi this is a side step reply to Joanie Chembars'
http://ez.no/community/forum/general/3_4_4_showing_user_posted_article_links_on_profile_page
But the forums won't let anyone reply to it because of a forum thread reply template subject length bug (ez crew ...)

I too saw Paul's contribution today and though it would be fun to test drive it ;)

What I'd to use it was override the default design/standard/user/edit.tpl to include the following:

<div style="font-weight:bold;">My Posts</div>

{default current_user_id=$userAccount.contentobject_id
     my-limit=25
     mine=fetch(content,tree,hash(parent_node_id,2, attribute_filter, array(and,array('owner','=',$current_user_id ) ) ) )
     my-count=$mine|count()
}

<b>Total:</b> {$my-count}

  {section show=$my-count|gt(0)}
    <ul>
      {section var=it loop=$mine}
        <li><a href={$it.url_alias|ezroot}>{$it.name}</a></li>
      {/section}
     <ul>
  {/section}

The trick is how many objects do you want to show. I have over a hundred on my installation so I put a lmit in in the code like so ...

<div style="font-weight:bold;">My Posts</div>

{default current_user_id=$userAccount.contentobject_id
     my-limit=25
     mine=fetch(content,tree,hash(parent_node_id,2, limit,$my-limit, attribute_filter, array(and,array('owner','=',$current_u\
ser_id ) ) ) )
     mine-total=fetch(content,tree,hash(parent_node_id,2, attribute_filter, array(and,array('owner','=',$current_user_id ) ) \
) )
     my-count=$mine-total|count()
}

<b>Total:</b> {$my-count}

  {section show=$my-count|gt(0)}
    <ul>
      {section var=it loop=$mine}
        <li><a href={$it.url_alias|ezroot}>{$it.name}</a></li>
      {/section}
     <ul>
  {/section}

There are still lots more ways to better use this functionality. This is just a simple example that worked for me.

Might want to brush up on the documentation at the same time, tho :)

References:
http://ez.no/community/forum/setup_design/letting_users_edit_their_profile
http://ez.no/community/contribs/hacks/more_attribute_filter_operators_and_fetch_by_owner_id
http://ez.no/ez_publish/documentation/reference/data_fetching/content/tree

Cheers,
//kracker

311 : Seems Uncertain (String Quartet Mix)

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

kracker (the)

Friday 22 April 2005 12:29:24 pm

And it's worth pointing out here that user_statistics is also a popular extension which can also be used on the user's profile:

http://ez.no/community/contribs/template_plugins/user_statistics

cheers,
//kracker

salvia : your disease

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

Joanie Chembars

Thursday 05 May 2005 3:42:06 am

Kracker -
Thanks so much for the links and sample code. I hope to try this today if I can find some spare time..........
Joanie

Joanie Chembars

Friday 06 May 2005 5:18:02 am

Hey -
Code works great with one edit........

this line

<li><a href={$it.url_alias|ezroot}>{$it.name}</a></li>

should say ezurl and not ezroot

Joanie

kracker (the)

Friday 06 May 2005 5:24:11 am

Joanie,

While <i>ezurl</i> may be the correct choice for your situation.

Others who have configured eZ publish urls to omit the /index.php/designname/ from urls generated by eZ publish. Instead they would use <i>ezroot</i>

Here is an example of a nice url using <i>ezroot</i>

http://example.org/news/fsf/jobs

It is often common when a site is in initial development to use the default configuration which includes the index.php and siteaccess in the urls eZ publish generates.

This is because you can setup and start using eZ publish in a non-virtual host environment. This can make getting a default eZ publish installation running, configured and branded very quickly without a lot of web server configuration.

Yet when moving the site from development to production it is a widely known and accepted fact that your web site users will benefit greatly from you switching from using ezurl to ezroot in your design/ templates.

This is because it makes urls and bookmarks simpler to read, understand, remember, advertise, type from memory, use, look at,etc.

I guess it's what I would call one of my favorite, <b>eZ publish Best Practices</b>

Cheers,
//kracker

Dark City : (Hughes Hall) : Sleep Now

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

eZ debug

Timing: Jan 18 2025 19:24:05
Script start
Timing: Jan 18 2025 19:24:05
Module start 'content'
Timing: Jan 18 2025 19:24:05
Module end 'content'
Timing: Jan 18 2025 19:24:05
Script end

Main resources:

Total runtime0.2186 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.0093 587.7031180.8438
Module start 'content' 0.00930.0146 768.5469101.9609
Module end 'content' 0.02390.1947 870.5078533.2734
Script end 0.2185  1,403.7813 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00421.9433200.0002
Check MTime0.00150.6798200.0001
Mysql Total
Database connection0.00100.444210.0010
Mysqli_queries0.155471.06751410.0011
Looping result0.00251.14471390.0000
Template Total0.194188.810.1941
Template load0.00130.606510.0013
Template processing0.192888.183610.1928
Override
Cache load0.00080.346710.0008
Sytem overhead
Fetch class attribute can translate value0.00220.985610.0022
XML
Image XML parsing0.00040.196210.0004
General
dbfile0.00271.2269200.0001
String conversion0.00000.005030.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