Forums

Failure con php conditions CCv5

Kronosites 04 Mar, 2017
Hello,

Using CCv5, I'm trying to use the next condition to filter only articles from logged user and from specific categories.
Nevertheless,categories are filtering OK but user->id are not working, and CCv5 is showing items from all the users.

What I'm doing wrong?
<?php
$user =& JFactory::getUser();
return array('UPNoticias.created_by' => $user->id, 'UPNoticias.catid' => ('4','6','27','36','69'));
?>
GreyHead 04 Mar, 2017
Hi Kronosites ,

If you add a Debugger action you will see the MySQL query that is being created - really useful when you need to debug the code.

The first condition looks OK to me though is should now be $user = \JFactory::getUser();

The second condition is broken as there is no IN there. Please try 'UPNoticias.catid IN' => ('4','6','27','36','69')

Bob
Kronosites 04 Mar, 2017
1 Likes
Hi again GreyHead,

Using it doesn't work.
I was searching through the FAQs more harder (https://www.chronoengine.com/faqs/72-ccv5/5215-how-do-i-build-a-where-statement-in-ccv5.html)and I found the solution:

return array('created_by' => $user->id, 'UPNoticias.catid' => array('4','6','27','36','69'));


Thanks for all!
Your FAQs are really great😉
Max_admin 04 Mar, 2017
Hi Kronosites,

It's also advised to use v6 instead of v5 for more features and flexibility.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.