Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Menu link checks ID of logged on user

Menu link checks ID of logged on user

Hi,

As part of a current project I need certain menu links to check the ID of the logged on user and re-direct them accordingly.

For exmaple, using jDownloads I would like users to see a link called 'My Documents' which will link to their own personal folder. But because Joomla creates static menu links I'm struggling to achieve this.

Is there anyway I could do that using Metamod?

Any suggestions would be very much appreciated.

Thanks,
Paul.

pjbursnall
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: Menu link checks ID of logged on user

Hi Paul,

Can I ask what the URLs are for the jDownloads folders for individual users? Do the links for the downloads folders have the user id in them?

If so, then you could use MetaMod to simply create an HTML link directly, rather than include a module. That link could include the user id in it. But this really depends on the structure of the URLs that you need to generate.

So can you give some examples of the jDownloads URLs that you want to generate dynamically?

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Re: Menu link checks ID of logged on user

Hi Stephen, thanks for your reply. The links for jdownloads to a specific user folder are in the following format:

https://*****/index.php?option=com_jdownloads&Itemid=20&view=viewcategory&catid=37

The catid number is the individual identifier. Not sure if this could be used in the same manner as a userid?

I've found a work around for the issue using the catid in a custom module to identifier the correct folder. I intend to use this in a seperate 'quick link' module to things like My Docs, My Performance Review etc.

But if I could tie this into a menu system that would be a bit tidier.

Thanks.

pjbursnall
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: Menu link checks ID of logged on user

Hi Paul,

The category id for jDownloads isn't going to correspond to the user id, so there will have to be a different way of associating the two things.

1 - how are you creating the jDownloads categories? Are you creating these manually every time you get a new user? If so, I guess you're working with a smallish number of users (not open registration). This implies it could be feasible to maintain a list that maps user ids onto jDownloads category ids. That could just live inside the MetaMod.

2 - do jdownload categories have a comments field or "alias" field or even metakeywords/metadescription? If so, perhaps when you create a new category for a new user, you could include the user id number in the alias field (or some other suitable field in the category edit screen). Then, the MetaMod could do a quick database search for "a jdownload category that has user id {n} in it", then use that category id in a hyperlink.

If #2 isn't going to work, then I'd do something like this in the MetaMod. Then you just have to maintain the array of mapping at the start of the rule:


$users_to_download_categories = array(
  62=>37,
  63=>38,
  64=>39
);
// etc etc. The last item on the list should NOT
// have a comma at the end.
// The first number in each pair is the user id, and the second
// is the jdownloads category id.
$cat = @$users_to_download_categories[ $user->id ];
if ($cat) {
  echo '<a href="' . JRoute::_("index.php?option=com_jdownloads&Itemid=20&view=viewcategory&catid=$cat") . '">View Downloads</a>';
}


So this recipe simply creates a hyperlink inside the module, with whatever text you choose, and pointing to the appropriate jDownloads category for the current user.

Hope that helps,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1686
Total Polls:
6
Total Posts:
5940
Total Posts Today:
1
User Info:
 
Total Users:
5198
Newest User:
Paramountdental
Members Online:
0
Guests Online:
166

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked