[SOLVED] Itemid and Modules

12 years 10 months ago - 12 years 9 months ago #168741 by boyjahq
[SOLVED] Itemid and Modules was created by boyjahq
I'm having some inconsistencies with modules being displayed.

If a user is logged in, an Itemid is correctly assigned to a profile when clicked on from a user list.

If no user is logged in, no Itemid is assigned.

I do have a user profile set up. Could anyone tell me what am I missing?

Please Log in to join the conversation.

12 years 10 months ago #168745 by krileon
Replied by krileon on topic Re: Itemid and Modules
That would indicate your menu link to CB is not public, please match the Itemid you're seeing while logged in to the Joomla menu link you've created and set access topublic.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

12 years 9 months ago #169157 by boyjahq
Replied by boyjahq on topic Re: Itemid and Modules
Hey Krileon,

I appreciate your help. I had two links going to two different user profiles in both of the languages for my site: 1 English and 1 Japanese, both public. I found that once I removed the Japanese profile menu item and created a user list menu item for each language instead, that the Itemids were correctly pulled for non-logged in users.

However, Itemids stopped working correctly for logged in users. The Japanese profiles are assigned the single Itemid for the English user profile menu item. Even after I created another profile (two again) menu item for the Japanese side, the English profile's Itemid was assigned.

What do you think?

Please Log in to join the conversation.

12 years 9 months ago #169257 by krileon
Replied by krileon on topic Re: Itemid and Modules
CB uses the first menu link Itemid it finds. It can't distinguish between languages and doesn't care if there are multiple copies of the menu links, it can only use 1 of them and the first one it finds is the one it uses. You can have the menu links to profiles and to userlists, but the API will still use whichever it finds first. Perhaps some sort of redirect, either with incubator project CB Redirect or htaccess rewrite, to send users to the appropriate page would be best? For CB Redirect for example you could use the on before profile display trigger, check a field; such as a switch field to be either English or Japanese.. if Japanese redirect to XYZ, etc..


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

12 years 9 months ago #169626 by boyjahq
Replied by boyjahq on topic Re: Itemid and Modules
Hey Kyle,

Thanks for the suggestion. The working solution is below.

I hard coded the menu items and languages in, but someone else might make them parameters to the plugin.
class BBJoomlaLanguage {

  static public function whatIsIt(){
    jimport('joomla.language.helper');
    $languages = JLanguageHelper::getLanguages('lang_code');
    $lang_code = JFactory::getLanguage()->getTag();
    return $languages[$lang_code]->sef;
  }

}


class BBProfileItemIdSetter extends cbPluginHandler {

  public function onAfterUserProfileDisplay(){
    $lang = BBJoomlaLanguage::whatIsIt();
    if($lang === 'en'){
      JRequest::setVar('Itemid', '514');
    } else {
      JRequest::setVar('Itemid', '532');
    }
  }

}

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.193 seconds

Facebook Twitter LinkedIn