Skip to Content Skip to Menu

[SOLVED] Send email on visit

  • chanteur94
  • chanteur94
  • OFFLINE
  • Posts: 302
  • Thanks: 13
  • Karma: 1
9 years 7 months ago - 9 years 7 months ago #261444 by chanteur94
[SOLVED] Send email on visit was created by chanteur94
Hi

I would like to send an email to the user who is visited by another one.
I thought using CB Auto Action but there is no trigger on visit.
How can I do that simply ?

Thank you.
Last edit: 9 years 7 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
9 years 7 months ago #261448 by krileon
Replied by krileon on topic Send email on visit
I really really suggest you don't do this. You'll be spamming people with emails. Your domain will be forever blacklisted by mail servers and all your emails will go to spam folder. At any rate yes it's doable with CB Auto Actions and its Email action on the before or after profile display triggers.


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.

  • chanteur94
  • chanteur94
  • OFFLINE
  • Posts: 302
  • Thanks: 13
  • Karma: 1
9 years 7 months ago #261453 by chanteur94
Replied by chanteur94 on topic Send email on visit
Thank you. You're right but i will do this on 'unique' case (only the first time user visits another one)

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

  • chanteur94
  • chanteur94
  • OFFLINE
  • Posts: 302
  • Thanks: 13
  • Karma: 1
9 years 7 months ago - 9 years 7 months ago #261466 by chanteur94
Replied by chanteur94 on topic Send email on visit
To do that, I create a query field cb_visitors with this query :

SELECT profile_id FROM `jsor_comprofiler_views` AS v WHERE v.`viewer_id` = [id]
I've tried also SELECT profile_id FROM `jsor_comprofiler_views` AS v WHERE v.`viewer_id` = '[user_id]'


Then, in CB AutoAction this condition :

[cb_visitors] Does Not Contain [cb:userdata field="user_id" user="#displayed" /]


Unfortunitly It doesn't work.

Can you help me on my error ?

thank you.
Last edit: 9 years 7 months ago by chanteur94.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
9 years 7 months ago #261494 by krileon
Replied by krileon on topic Send email on visit
Your query is just checking that the profile user has viewed themselves. You need to check if the viewing user has viewed the displayed user. Substitutions by default are always for the displayed user when used in a CB Query Field. To get the user id of the viewing user you need to use [cb:userdata field="user_id" user="#me" /]. When acting on the profile display triggers with User set to Automatic your subscriptions in that action will also target the displayed user and not the viewing user so your substitutions need to use user="#me" to get viewing user profile data.


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.
The following user(s) said Thank You: nant

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

  • chanteur94
  • chanteur94
  • OFFLINE
  • Posts: 302
  • Thanks: 13
  • Karma: 1
9 years 7 months ago - 9 years 7 months ago #261562 by chanteur94
Replied by chanteur94 on topic Send email on visit
I have no problem with the 'action'.
(I would like to send email (the action) before profile display (the trigger), only if it is the first time that the viewer visit the profile)

So, i try a new cb query cb_visitors :

( SELECT  COUNT(*) FROM `#__comprofiler_views` AS v WHERE v.`profile_id`= '[cb:userdata field="user_id" user="#displayed" /]' AND v.`viewer_id` = '[cb:userdata field="user_id" user="#me" /]')

This, return 0 if no visit between the viewer and the profile, and return 1 if already a visit between us (this seems to work)


and in the CB AutoAction CONDITIONS :

[cb:userdata field="cb_visitors" user="#displayed" /] equal 0
and it doesn't work.

So I try to understand the reason, I put on my email these data :
[cb:userdata field="cb_visitors" user="#me" /]
[cb:userdata field="cb_visitors" user="#displayed" /]
[cb:userfield field="cb_visitors" user="#me" /]
[cb:userfield field="cb_visitors" user="#displayed" /]
[cb_visitors]
With trigger BeforeProfileDisplay All are equal to 0 and with trigger AfterProfileDisplay All are equal to 1.
How to test (condition) the good value (real result of the query) ?
Last edit: 9 years 7 months ago by chanteur94.

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

Moderators: beatnantkrileon
Powered by Kunena Forum