Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
create rules by Juga's group.
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
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
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
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
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).
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;
}
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;
}
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5942
- Total Posts Today:
- 1
- User Info:
- Total Users:
- 7622
- Newest User:
- boestreecare
- Members Online:
- 2
- Guests Online:
- 134
- Online:
- boestreecare, musser4585
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked