Skip to Content Skip to Menu

Custom email links that initiate an Auto Action?

  • bascherz
  • bascherz
  • OFFLINE
  • Posts: 228
  • Thanks: 29
  • Karma: 11
3 years 7 months ago - 3 years 7 months ago #324387 by bascherz
Our site sends emails to our users. They agree to this when they register. However, there are apparently always "those users" who don't want to receive a particular email and their way of dealing with it when there's no opt-out link in the email is to mark it as SPAM. That comes back to us in a bad way. Sooooo, I was wondering if there is any CB feature to deal with custom links that are similar to a registration confirmation but in a more customizable way? I know it's a longshot, but thought I'd ask anyway. Is there a way to use a Request type Auto Action to do this?

Thanks in advance,
Bruce

Bruce S - Vienna, VA
Last edit: 3 years 7 months ago by bascherz.

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

  • krileon
  • krileon
  • OFFLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
3 years 7 months ago #324397 by krileon
Suggest using a newsletter extension so they can opt out/in of marketing emails. You do not need to provide opt out/in for critical site function emails (e.g. password changed) or one off emails (e.g. pending/welcome emails).

Yes, you can execute an auto action from a URL. Doesn't matter what the action type is just leave Triggers as None and you can access it directly via its URL under its Global tab.


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.

  • bascherz
  • bascherz
  • OFFLINE
  • Posts: 228
  • Thanks: 29
  • Karma: 11
3 years 7 months ago #324399 by bascherz
These emails are not sent in bulk. They are sent individually based on account or membership status changes. Though I do plan to implement choices for each type of message as profile fields, what I'd like is a way to put a link in the email for one-click unsubscription (equiv to selecting "No" at the profile field). To protect against spoofing, I thought generation of a large random string comprising the link and inserted into a custom database table record along with date/time, user_id, action, and parameters would make sense. It actually looks like it might be easier to write a custom Joomla module to handle the link as described in the following example.

docs.joomla.org/Retrieving_request_data_using_JInput

I had no luck getting a simple URL-triggered AA to just output some HTML. Plus, I didn't see how to get the URL parameters into the PHP code to act on them, but doing what's described at the link above might work.

Bruce S - Vienna, VA

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

  • krileon
  • krileon
  • OFFLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
3 years 7 months ago #324401 by krileon
That's doable with CB Auto Actions. Example as follows would change a field value from direct access to the auto actions URL.

Global
Triggers: None
Type: Field
User: Automatic
Access: Everybody
Action
Field: cb_sendemails
Operator: Set
Value: 1
Output
Display: Redirect
URL: index.php
Message: You have been unsubscribed from emails.

This auto action would have the following URL for example and is available on the global tab of the auto action.

index.php?option=com_comprofiler&view=pluginclass&plugin=cbautoactions&action=action&actions=ACTION_ID_HERE

To execute it on a specific user you'd use the following.

index.php?option=com_comprofiler&view=pluginclass&plugin=cbautoactions&action=action&actions=ACTION_ID_HERE&users=USER_ID_HERE

There's no security here though so someone could technically unsubscribe other users if they knew their user id and the URL. There's several ways to secure it. You could have a hash table with user ids and add custom User parsing to compare the hash and return the user id. You could encode (e.g. openssl_encrypt) the user and decode (e.g. openssl_decrypt) it in the custom User parsing.

It's basically a lot of work to make a fake newsletter extension though.

I had no luck getting a simple URL-triggered AA to just output some HTML.

Auto Actions output nothing by default. If you need it to output something then set the parameters under the Output tab. For direct access both Echo and Return outputs will work fine. You can even use a Redirect output to redirect after the auto action is done performing its behavior.


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.

  • bascherz
  • bascherz
  • OFFLINE
  • Posts: 228
  • Thanks: 29
  • Karma: 11
3 years 7 months ago #324404 by bascherz
I was trying to make my PHP code action output the message. I also tried using the "echo" method. Neither worked. Your Redirect/Message did and that's perfect.

How about having in the link a parameter like "key=<some long, random string>". How could, say, a Code/PHP action access that parameter value?

Bruce S - Vienna, VA

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

  • krileon
  • krileon
  • OFFLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
3 years 7 months ago #324407 by krileon

How about having in the link a parameter like "key=<some long, random string>". How could, say, a Code/PHP action access that parameter value?

Yes, User parameter supports Code and Query usages so you can use PHP to have custom user object parsing for the auto action to reverse whatever hashing your using or lookup whatever you may need in the database.


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.

Moderators: beatnantkrileon
Powered by Kunena Forum