Skip to Content Skip to Menu

Create CBSubs subscription using Auto Action from Fabrik

  • 3by400Inc
  • 3by400Inc
  • ONLINE
  • Posts: 119
  • Thanks: 11
  • Karma: 0
2 years 9 months ago #328489 by 3by400Inc
In a Fabrik application on Joomla 3.10.5 using CB 2.7.1 and Auto Actions 9.0.0 we have a need to create a CBSubs subscription for a specified user.

I've created an auto action:

Global
Type: CB Paid Subscriptions
Triggers: none
User: Code
Access: Everybody
Allow Direct Access: Yes

User
Code:
return [post_users];
(Intended to get the user_id from the URL parameter 'users'.)

Conditions - none

Action
Mode: Subscribe
Renew: No
Plans: our designated plan
User: field is blank

Output
Display: none

Parameters
Translate: yes
Substitutions: yes
Format Functions: no
Content Plugins: no
References: none
Debug: yes

I am trying to test this by submitting the actions's Internal Action URL as [our site]/index.php?option=com_comprofiler&view=pluginclass&plugin=cbautoactions&action=action&actions=53&Itemid=2055 and appending that with "&users=xxxxx" with 'xxxxx' being an actual existing user_id. There is no subscription created for that user for the indicated plan.

I'm new to Auto Actions so I am likely missing something.

At present I want to initiate the URL from Fabrik. Later I may try to use the CB API, if possible, from within Fabrik to create a new user and then use a normal trigger rather than the URL. For now I need the action to work first just via the URL.

Any and all help would be appreciated.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
2 years 9 months ago #328496 by krileon

User

return [post_users];
(Intended to get the user_id from the URL parameter 'users'.)

That's not valid PHP so that won't work. Substitutions must always be treated as strings. The below would be valid.

Code:
return '[post_users]';

This also isn't necessary as CB Auto Actions automatically handles "users" input data. You can send it as an array or as a comma list of user ids. Be sure to leave User on Automatic for it to parse this.

It's likely not working for you right now since your User usage is causing a fatal PHP error. Try the above suggestion of using Automatic and see if that works for you.


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.

  • 3by400Inc
  • 3by400Inc
  • ONLINE
  • Posts: 119
  • Thanks: 11
  • Karma: 0
2 years 9 months ago #328499 by 3by400Inc
I modified the return in the User tab field to be a string as suggested, but still no subscription occurs.

The reason I'm trying to pass the user_id is that the single user to be subscribed is never going to be the logged in user. It is always a third party.

Thanks,

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
2 years 9 months ago #328503 by krileon
You don't need to use the User parameter at all. Leave it as Automatic. CB Auto Actions automatically handles being passed a user id. This is done by adding &users=USER_IDS to your auto action URL. Example as follows.

URL Structure
Code:
index.php?option=com_comprofiler&view=pluginclass&plugin=cbautoactions&action=action&actions=ACTION_ID&users=USER_IDS
Example: Single User
Code:
index.php?option=com_comprofiler&view=pluginclass&plugin=cbautoactions&action=action&actions=12&users=60
Example: Multiple Users
Code:
index.php?option=com_comprofiler&view=pluginclass&plugin=cbautoactions&action=action&actions=12&users=60,43,98
Example: Anywhere Supporting Substitutions
Code:
index.php?option=com_comprofiler&view=pluginclass&plugin=cbautoactions&action=action&actions=12&users=[user_id]

This also does not have to be a part of the URL. If you're using a custom HTML form then you can have an input with the name of "users" where you supply the users id and submit that to the auto action.


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.

  • 3by400Inc
  • 3by400Inc
  • ONLINE
  • Posts: 119
  • Thanks: 11
  • Karma: 0
2 years 9 months ago #328512 by 3by400Inc
And, like magic, that works as advertised. Thanks.

Is it possible to send something in the URL (and change things in the Auto Action) in order to set a custom expiration date overriding the date the CBSubs plan would apply?

Thanks again. Much appreciated.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
2 years 9 months ago #328525 by krileon

Is it possible to send something in the URL (and change things in the Auto Action) in order to set a custom expiration date overriding the date the CBSubs plan would apply?

You can send additional form POST data or add to the URL to send additional GET data. You can access that data using the below substitution usages.

POST
Format: [post_INPUTNAME]
Example: [post_name]

GET
Format: [get_URLPARAM]
Example: [get_id]

As for your specific question no you won't be able to override the subscription date since the auto action does not provide support for that. The date will always be the date the auto action was triggered.


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: 3by400Inc

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

Moderators: beatnantkrileon
Powered by Kunena Forum