[SOLVED] Want to make Online Status searchable

14 years 1 month ago #126204 by rivers
Hi
I want to make the Online Status a searchable option

Like e.g: Online Status/User Online - YES/NO
or: Show only those who are online YES/NO

Could anyone support me on how to get this done? I have seen this question been asked in the forum before, but no reply.

Regards
Rivers
Norway:cheer:

Post edited by: krileon, at: 2010/06/01 15:03

Please Log in to join the conversation.

14 years 1 month ago #126275 by krileon
Replied by krileon on topic Re:Want to make Online Status searchable
Can't, the online status isn't an actual field value stored in the database; thus database searching and sorting on it won't work. You could try something like the following as an advanced filter to filter a userlist by Online or Offline.

Online:
[code:1]
( (SELECT MAX(time) FROM #__session WHERE userid = [user_id] AND guest = 0) > 0 )
[/code:1]

Offline:
[code:1]
( (SELECT MAX(time) FROM #__session WHERE userid = [user_id] AND guest = 0) <= 0 )
[/code:1]


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 1 month ago #126983 by rivers
Replied by rivers on topic Re:Want to make Online Status searchable
Hi again
I published these two sentences in to advanced filter in List management in CB 1.2.2, but when I updated user list in front-end I only got this message in the user list:

* Online nå!

No valid database connection You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '( (SELECT MAX(time) FROM jos_session WHERE userid = 132 AND guest = 0) <= 0 ) )' at line 9 SQL=SELECT COUNT(*) FROM jos_comprofiler ue, jos_users u WHERE u.block = 0 AND ue.approved = 1 AND ue.confirmed = 1 AND ue.banned = 0 AND u.gid IN ( 18, 19, 20, 21, 30, 23, 24, 25) AND u.`id` = ue.`id` AND (( (SELECT MAX(time) FROM jos_session WHERE userid = 132 AND guest = 0) > 0 ) ( (SELECT MAX(time) FROM jos_session WHERE userid = 132 AND guest = 0) <= 0 ) )
No valid database connection You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '( (SELECT MAX(time) FROM jos_session WHERE userid = 132 AND guest = 0) <= 0 ) ) ' at line 9 SQL=SELECT ue.*, u.*, '' AS 'NA' FROM jos_comprofiler ue, jos_users u WHERE u.block = 0 AND ue.approved = 1 AND ue.confirmed = 1 AND ue.banned = 0 AND u.gid IN ( 18, 19, 20, 21, 30, 23, 24, 25) AND u.`id` = ue.`id` AND (( (SELECT MAX(time) FROM jos_session WHERE userid = 132 AND guest = 0) > 0 ) ( (SELECT MAX(time) FROM jos_session WHERE userid = 132 AND guest = 0) <= 0 ) ) ORDER BY `username` ASC LIMIT 0, 30
There is an error in the database query. Site admin can turn site debug to on to view and fix the query.
Search Users
Online nå!
User(s):


How am I suppose to implement it in the advanced filter section?

Please Log in to join the conversation.

14 years 1 month ago #127075 by krileon
Replied by krileon on topic Re:Want to make Online Status searchable
Please try the following, note this is only tested working on Joomla 1.5.x.

ONLINE:
[code:1]
( ( SELECT MAX( s.time ) FROM #__session AS s WHERE s.userid = u.id AND s.guest = 0 ) IS NOT NULL )
[/code:1]

OFFLINE:
[code:1]
( ( SELECT MAX( s.time ) FROM #__session AS s WHERE s.userid = u.id AND s.guest = 0 ) IS NULL )
[/code:1]

The above I use on my very own website so you can see them in action there (link in signature).


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.

13 years 10 months ago #134377 by rivers
Replied by rivers on topic Re:Want to make Online Status searchable
SOLVED! =)

Post edited by: rivers, at: 2010/05/31 19:41

Please Log in to join the conversation.

13 years 10 months ago #134382 by pepperstreet
Replied by pepperstreet on topic Re:Want to make Online Status searchable
Thank you. It works! Never would have found the solution by myself.
From pure interest: What is in the field "onlinestatus"?

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.177 seconds

Facebook Twitter LinkedIn