Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » Chameleon / ChameleonLite
- » Chameleon
- » Run php rule
Run php rule
Run php rule
Hello,
I installed Chameleon and Easysocial (by Stackideas). I'd like set a php rule (Sql query) to apply a specific template style when user has selected some field value in his easysocial profile, for example "Green". Here is the structure of the table #_social_fields_data :
id
field_id
uid (id of user in joomla table)
type
datakey
data
params
raw
Please note that user must be logged in too, so i've just checked "All logged in" in Users and Groups tab.
I tried to set php rule below in Chameleon and i checked "true" in Default PHP return value. But it does not work.
if $user->uid > 0) {
$data = Green;
$query = "select uid from #_social_fields_data" where field_id = 72 and data = $data;
$db->setQuery( $query );
$yes = $db->loadResult();
if ($yes) return true;
}
Help please.
Re: Run php rule
Try this. I hope it will work - at least it fixes some syntax issues in your original code:
if ($user->id > 0) {
$query = "select uid from #_" . "_social_fields_data where field_id = 72 and data = 'Green' and uid = " . (int)$user->id;
$db->setQuery( $query );
$yes = $db->loadResult();
if ($yes) return true;
}
Re: Run php rule
- Index
- » Chameleon / ChameleonLite
- » Chameleon
- » Run php rule
Board Info
- Board Stats:
- Total Topics:
- 1699
- Total Polls:
- 6
- Total Posts:
- 5967
- Total Posts Today:
- 2
- User Info:
- Total Users:
- 8021
- Newest User:
- shrutihassan193
- Members Online:
- 0
- Guests Online:
- 194
- 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