- Posts: 5
COMMUNITY FORUM
Adding My-Page entry menu
- Andrep
- Topic Author
- Offline
- New Member
Less
More
13 years 5 months ago #97254
by Andrep
Adding My-Page entry menu was created by Andrep
Hello,
I'm new to K2 and wanted to add a "My Page" button like on this website.
How to?
Thanks in advance
Andrea
I'm new to K2 and wanted to add a "My Page" button like on this website.
How to?
Thanks in advance
Andrea
Please Log in or Create an account to join the conversation.
- Andrep
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
13 years 5 months ago #97255
by Andrep
Replied by Andrep on topic Adding My-Page entry menu
up
Please Log in or Create an account to join the conversation.
- Andrea Vigato
- Offline
- Senior Member
Less
More
- Posts: 50
13 years 5 months ago #97256
by Andrea Vigato
Replied by Andrea Vigato on topic Adding My-Page entry menu
hi,
<a href="<?php echo JRoute::_(K2HelperRoute::getUserRoute($user->id)); ?>"> </a>
this is the link to the account itemList page, maybe check if user is a guest and if so redirect him to the registration page, otherwise, if it's logged in, goes directly to the account main page.
Then edit your components\com_k2\templates\user.php to change layout of the page if you want...
<a href="<?php echo JRoute::_(K2HelperRoute::getUserRoute($user->id)); ?>"> </a>
this is the link to the account itemList page, maybe check if user is a guest and if so redirect him to the registration page, otherwise, if it's logged in, goes directly to the account main page.
Then edit your components\com_k2\templates\user.php to change layout of the page if you want...
Please Log in or Create an account to join the conversation.
- Andrep
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
13 years 5 months ago #97257
by Andrep
Replied by Andrep on topic Adding My-Page entry menu
cool grazie Andrea,
this helps me a lot
my problem now is to put this script into a joomla menu!
do you have any idea on how to do that?
thanks again for the great hint!
Andrea
this helps me a lot
my problem now is to put this script into a joomla menu!
do you have any idea on how to do that?
thanks again for the great hint!
Andrea
Please Log in or Create an account to join the conversation.
- Andrea Vigato
- Offline
- Senior Member
Less
More
- Posts: 50
13 years 5 months ago #97258
by Andrea Vigato
Replied by Andrea Vigato on topic Adding My-Page entry menu
You have two way, if you're using the joomla menu you have to catch the click on this unique <a> and control the user to redirect.
But i suggest you to use a "custom html module" instead of a joomla menu if it's not necessary...install a module that allow you to use php in custom modules, then just write down your html menu and check it directly with php.
Don't know exactly but maybe you will have to change the "a href" to something like:
index.php?option=com_k2&view=itemlist&task=user&id=<?php $user->id; ?>
But i suggest you to use a "custom html module" instead of a joomla menu if it's not necessary...install a module that allow you to use php in custom modules, then just write down your html menu and check it directly with php.
Don't know exactly but maybe you will have to change the "a href" to something like:
index.php?option=com_k2&view=itemlist&task=user&id=<?php $user->id; ?>
Please Log in or Create an account to join the conversation.
- Andrep
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
13 years 5 months ago #97259
by Andrep
Replied by Andrep on topic Adding My-Page entry menu
thanks Andrea,
I'll add a new template-position right next to the joomla menu just to publish the custom module along with your code.
Turned out something pretty easy "per fortuna"
Ciao da Berlino
Andrea
I'll add a new template-position right next to the joomla menu just to publish the custom module along with your code.
Turned out something pretty easy "per fortuna"
Ciao da Berlino
Andrea
Please Log in or Create an account to join the conversation.
- Andrea Vigato
- Offline
- Senior Member
Less
More
- Posts: 50
13 years 5 months ago #97260
by Andrea Vigato
Replied by Andrea Vigato on topic Adding My-Page entry menu
Yes, you can use a simple custom module just for this link..
$user = &JFactory::getUser();
if (!($user->guest)){
<a href="<?php echo JRoute::_(K2HelperRoute::getUserRoute($user->id)); ?>"> My Page </a>
else
<a href="THE REGISTRATION PAGE OR WHATEVER"> Something </a>
maybe, instead of JRoute you have to use a direct link so:
$user = &JFactory::getUser();
if (!($user->guest)){
<a href="index.php?option=com_k2&view=itemlist&task=user&id=<?php $user->id; ?>"> My Page </a>
else
<a href="THE REGISTRATION PAGE OR WHATEVER"> Something </a>
Saluti :)
Andrea
$user = &JFactory::getUser();
if (!($user->guest)){
<a href="<?php echo JRoute::_(K2HelperRoute::getUserRoute($user->id)); ?>"> My Page </a>
else
<a href="THE REGISTRATION PAGE OR WHATEVER"> Something </a>
maybe, instead of JRoute you have to use a direct link so:
$user = &JFactory::getUser();
if (!($user->guest)){
<a href="index.php?option=com_k2&view=itemlist&task=user&id=<?php $user->id; ?>"> My Page </a>
else
<a href="THE REGISTRATION PAGE OR WHATEVER"> Something </a>
Saluti :)
Andrea
Please Log in or Create an account to join the conversation.
- Andrep
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
13 years 5 months ago #97261
by Andrep
Replied by Andrep on topic Adding My-Page entry menu
omg didn't expect so mutch !
Thanks buddy
Thanks buddy
Please Log in or Create an account to join the conversation.