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.

 

modify recipe to show a module only whit certain authors of K2 items

modify recipe to show a module only whit certain authors of K2 items

Hi, thanks for your great metamod, I'm trying to modify your recipe in order to show a module only with given K2 authors...this is what I did:

if ( $option == "com_k2" && $view == "article" ) {
$article_id = (int)$id;
$query = "SELECT created_by "
  . " FROM #__k2_items WHERE id = '$article_id' AND published = 1";
$db->setQuery( $query, 0, 1 );
$row = $db->loadObject();

if ( $row != null ) {
  $created_by = $row->created_by;

  /* now put your rules in here... */
  if ( $created_by == 10 ) return 101; /* module 101 for user #10 */
  if ( $created_by == 15 ) return 102; /* module 102 for user #15 */
}
}

Only thing I don't understand is that
$view == "article"
Does anyone who uses K2 know if it could work?
Thanks for your help!

teddy
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: modify recipe to show a module only whit certain authors of K2 items

Teddy,

I don't use K2 so can't comment on most of the recipe. However, the "$view == "article" " line at the top refers to the URL parameters. If you're using normal com_content then this parameter is set whenever you are viewing a content page.

If you turn on MetaMod Advanced Debug mode, then look at the debug output on the front end of the site when you are viewing some K2 pages. Is there any particular value of "view" mentioned on those pages? This can help to narrow down the pages on which your rule will be active.

Best regards,
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
3313 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5913
Dormant:
User Info:
 
Total Users:
10746
Newest User:
victor1234
Members Online:
0
Guests Online:
149

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