insert a "view your order history" and "view [username]s store" link
description
Inserts a simple "view your order history" and "View [username]s store" link in the user profile page. Requires the store.module to be enabled and setup. The store.module is part of the ecommerce.module suite of modules.
Usage
- For use in your user profile page override
- Using a text editor like NOTEPAD.EXE or an equivalent, copy and paste the code into your user_profile.tpl.php file
- Tested and works with Drupal 4.5 and 4.6
- Change the div class name or the link text to suit.
View order history link
<?php if ($GLOBALS['user']->uid == $user->uid): /* check to see if it is the owner of the profile before displaying this link */ ?>
<div class="orders">
<?php print l(t('View your order history'), "store/history/$user->uid")
</div>
<?php endif; /* end of snippet */ ?> View [username]s store link
<div class="storelink">
<?php print l('view '. $user->name. 's store', 'store/'. $user->uid); ?>
</div>
Strange side-effect
I pasted the 'View order history link'-code' as explained in node/45627 . It works, but it has a strange side effect. When one opens the page as the user himself there is no problem, but when I open the profile as another user the layout is destroyed. It is obvious that other users should not be allowed to see this information (and it indeed cannot), but now it also does the following: it wraps the two blocks in my two right columns to the lower left corner of the page, below everything else.
It is a side effect of this string: if ($GLOBALS['user']->uid == $user->uid): . When I removce that piece of PHP the page is displayed properly (including the link, accessible to the world - which we do not want).
So I wonder what could be done about this?
Many thanks
Theo Richel