Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] how to ensure the result of the query

  • krileon
  • krileon
  • ONLINE
  • Posts: 48464
  • Thanks: 8280
  • Karma: 1443
11 years 4 months ago #229335 by krileon
Replied by krileon on topic how to ensure the result of the query
You can't, it doesn't log the number of views since last period. It logs view total. The column the views count is stored to is "viewscount"; adjust the query as needed.


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 or Create an account to join the conversation.

  • mfe13
  • mfe13
  • OFFLINE
  • Posts: 572
  • Thanks: 26
  • Karma: 5
11 years 4 months ago #229447 by mfe13
Replied by mfe13 on topic how to ensure the result of the query
Ok,

Well, I've:
- 1 query field whith single row:
Code:
SELECT COUNT(viewer_id) AS nombrevisiteurs FROM #__comprofiler_views WHERE profile_id=[user_id] AND DAY(NOW()) - DAY(lastview) < 3 AND viewer_id!=0 LIMIT 30

- 1 query fiedl whith multiple row:[column_viewer_id],
Code:
SELECT viewer_id FROM #__comprofiler_views WHERE profile_id=[user_id] AND DAY(NOW()) - DAY(lastview) < 3 AND viewer_id!=0 ORDER BY lastview DESC LIMIT 3

- 1 delimiter to show result in user profile:
Code:
[cb_nombrevisiteurs] [cb:if cb_nombrevisiteurs="0" && user_id="myid"]Nouvelles visites[/cb:if][cb:if cb_nombrevisiteurs>0 && cb_nombrevisiteurs!="" && user_id="myid"]Nouvelles visites[/cb:if]

Now, is possible to reset the result when user logout ?

Thanks

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48464
  • Thanks: 8280
  • Karma: 1443
11 years 4 months ago #229489 by krileon
Replied by krileon on topic how to ensure the result of the query

Now, is possible to reset the result when user logout ?

Create a Query action within CB Auto Actions on the after logout trigger to clear all the profile view entries for the user.


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 or Create an account to join the conversation.

  • mfe13
  • mfe13
  • OFFLINE
  • Posts: 572
  • Thanks: 26
  • Karma: 5
11 years 4 months ago #229647 by mfe13
Replied by mfe13 on topic how to ensure the result of the query
Thanks but ... I didn't create this query!

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48464
  • Thanks: 8280
  • Karma: 1443
11 years 4 months ago #229661 by krileon
Replied by krileon on topic how to ensure the result of the query
I'm not sure what you want to delete. All the users views or all the users hits. Please see the below example queries for CB Auto Actions to use in your Query action on the after logout trigger.

Delete Hits:
Code:
DELETE FROM `#__comprofiler_views` WHERE `profile_id` = '[user_id]';

Delete Views:
Code:
DELETE FROM `#__comprofiler_views` WHERE `viewer_id` = '[user_id]'


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 or Create an account to join the conversation.

  • mfe13
  • mfe13
  • OFFLINE
  • Posts: 572
  • Thanks: 26
  • Karma: 5
11 years 4 months ago #229669 by mfe13
Replied by mfe13 on topic how to ensure the result of the query
Not the views of the tab.
I want to keep the views in the tab, but the value that I define the fields that account visits 3 days is reset to zero with onAfterLogout.
It's possible ?

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum