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.

 

create rules by Juga's group.

create rules by Juga's group.

Hi, i must make an rule for every Juga group... i.e. for Group "XXX" in Juga, template change in "Template A"... How is possible? I must create a PHP code?
Thank you in advance,
Best Regards.

Thomas Cappelletti

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

Re: create rules by Juga's group.

Hi Thomas,

I haven't used JUGA so I am not sure... but I would have hoped that JUGA would add the new groups into the standard Joomla groups table, so they would show up in the Groups selector in MetaTemplate Pro. But I'm guessing that this didn't work, right?

So yes, that's going to require some PHP coding; probably not much. I've sent you an e-mail about it.

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: create rules by Juga's group.

Hi Thomas,

this works for me:

if ((int)$user->id > 0) {
  $group_id = 1; // the one to search for
  $query = 'select user_id from #__juga_u2g where group_id = $group_id and user_id = ' . (int)$user->id;
  $db->setQuery( $query );
  $yes = $db->loadResult();
  if ($yes) return true;
}


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: create rules by Juga's group.

Hi Stephen, thank your for help! I copied php code in metatemplate, put number group, but no effect!


if ((int)$user->id > 0) {
  $group_id = 6;
  $query = 'select user_id from #_juga_u2g where group_id = $group_id and user_id = ' . (int)$user->id;
  $db->setQuery( $query );
  $yes = $db->loadResult();
  if ($yes) return true;
}

"6" is number of group of interest (from Juga -> Dashboard -> Group)

Thank you in advance!

Regards,
Thomas

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

Re: create rules by Juga's group.

Hi Thomas,

as I said, the rule itself worked for me, so it's probably just something in the setup of your rule.

Can I suggest that you unpublish the rule that you have at the moment, and make a brand new rule, just so you know that all the settings are "clean".

Then paste this into the main PHP box on the left at the bottom (not in the SUCCEED or FAIL actions).

One other thing I noticed: you need 2 x "_" after the "#", not one. In fact that may be the main problem. Sorry that this stupid forum doesn't allow me to type that directly for you to copy and paste!

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
3329 Posts
User info in posts
Administrator has disabled public posting

Re: create rules by Juga's group.

Hi,

I paste the php code into the Advanced PHP box on the left at the bottom and put the number group (id), but no effect...

I use Chameleon1-19, is this code for Metatemplate only ?

Thank you in advance!

Best regards,

lorachats

lorachats
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: create rules by Juga's group.

Can you tell me the version of Joomla and JUGA you are using?

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: create rules by Juga's group.

p.s. the rule above should work on Chameleon as well as the old MetaTemplate, providing JUGA has not changed in the meantime.

Also remember that the PHP above was missing one "_" after the "#" (there should be 2 of them).

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: create rules by Juga's group.

I'm using Joomla Version 1.5.26 and Juga 2.30

Here the code :

if ((int)$user->id > 0) {
  $group_id = 36;
  $query = 'select user_id from #__juga_u2g where group_id = $group_id and user_id = ' . (int)$user->id;
  $db->setQuery( $query );
  $yes = $db->loadResult();
  if ($yes) return true;
}

lorachats
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: create rules by Juga's group.

oh, just spotted another problem with the SQL - hope it's right this time!

if ((int)$user->id > 0) {
  $group_id = 36;
  $query = "select user_id from #_" . "_juga_u2g where group_id = $group_id and user_id = " . (int)$user->id;
  $db->setQuery( $query );
  $yes = $db->loadResult();
  if ($yes) return true;
}

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:
1685
Total Polls:
6
Total Posts:
5940
Total Posts Today:
1
User Info:
 
Total Users:
5186
Newest User:
Totosite
Members Online:
0
Guests Online:
161

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