user list advanced filter - another table?

14 years 4 months ago #121720 by maddunr
Hi,

Can the advanced filter in a CB user list be used to filter users by data from another table (from another component)?

For example, lets say I have a column where a user's downloads are stored in columns jos_downloads.userid, jos_downloads.filename where jos_downloads.userid = jos_comprofiler.user_id.

Would it be possible to show just the users who've downloaded something in the user list?

Thanks,
V

Please Log in to join the conversation.

14 years 4 months ago #121756 by krileon
Replied by krileon on topic Re:user list advanced filter - another table?
Hmm you could try something like the following:

[code:1]
( ( SELECT COUNT( `id` ) FROM `#__downloads` WHERE `userid` = [user_id] ) > 0 )
[/code:1]

Haven't tested it or anything, but it might work. The best way to manipulate it is probably a new CB Plugin using Triggers (see tutorials in signature for trigger information and usage).

Post edited by: krileon, at: 2010/01/14 14:34


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

14 years 4 months ago #121890 by maddunr
Replied by maddunr on topic Re:user list advanced filter - another table?
kyle,

thanks! this worked perfectly! for anyone else looking for a solution, here's the code i used in the advanced filter:

[code:1]( ( SELECT COUNT( `userid` ) FROM `#__acctexp_subscr` WHERE `userid` = u.`id` AND `status` = 'Active' ) > 0 )[/code:1]
(i was using it to list users who are considered active by the AEC component).

- V

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.143 seconds

Facebook Twitter LinkedIn