[solved] My account menu for users (same as admin)

[solved] My account menu for users (same as admin)

Thursday 24 November 2005 9:02:41 pm - 4 replies

Modified on Monday 28 November 2005 6:53:55 pm by Nathan Kelly

Author Message

Mark Marsiglio

Saturday 26 November 2005 6:48:51 am

There are some built in user modules that might accomplish what you need...

http://yourdomain.com/notification/settings
http://yourdomain.com/content/draft
http://yourdomain.com/content/pendinglist
http://yourdomain.com/content/bookmark
http://yourdomain.com/collaboration/view/summary
http://yourdomain.com/user/password
http://yourdomain.com/shop/basket
http://yourdomain.com/shop/wishlist

You can create manual links to these modules from your "user account" section, and they will have access to the same modules that you can get in the admin.

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

Nathan Kelly

Sunday 27 November 2005 2:37:42 pm

Thanks Mark, I'll look into these, I have already set up a couple of manual links, the main issue is showing the menu in the right locations though.

I don't want the menu to be present on every page, only the pages that relate to the user account. Do you have any ideas how I might accomplish this?

Cheers!

Pardon me while I burst into flames...

Nathan Kelly

Monday 28 November 2005 6:53:09 pm

Ok I solved it, I thought the answer was in this doc:
http://ez.no/download/changelogs/ez_publish_3_5/ui_context_variables
And it was. The ui_context and ui_component variable were the key.

My code:

{def $this_user=fetch('user','current_user')}
{if $this_user.is_logged_in}

{def 
	$acc1=and($ui_component|eq('user'), $ui_context|eq('edit') ) 
	$acc2=and($ui_component|eq('content'), $ui_context|eq('edit') ) 
	$acc3=$ui_component|eq('notification')
}

{if or( $acc1, $acc2, $acc3 ) }
	
					<ul>
						<li><a{if $acc1} class="current"{/if} href={concat('/user/edit/', $this_user.contentobject_id)|ezurl}>{'My Account Details'|i18n("design/ccts")}</a></li>
						<li><a{if $acc2} class="current"{/if} href={concat('/content/edit/', $this_user.contentobject_id)|ezurl}>{'Change Account Details'|i18n("design/ccts")}</a></li>
						<li><a{if $acc3} class="current"{/if} href={'/notification/settings/'|ezurl}>{'My Notification Settings'|i18n("design/ccts")}</a></li>
					</ul>

{else}
{* context and component don't match so don't show the menu *}
{/if}

{undef $acc1 $acc2 $acc3}

{else}
{* this user is not logged in so don't show them anything at all *}
{/if}
{undef $this_user}

I know there may be a cleaner way to do this, but it works for now, if anyone has any ideas how I might simplify this code please make a suggestion.

Cheers!

Pardon me while I burst into flames...

esperion H

Tuesday 14 February 2006 12:17:43 pm

Hi Nathan,

Did you only use the code in your last post in the end?

Did you put it in pagelayout.tpl? Did you use it as is?

Regards Esperion

You must be logged in to post messages in this topic!

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