Skip to Content Skip to Menu

Create Linked CB Gallery Media Items

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
1 year 1 month ago #335321 by krileon
Replied by krileon on topic Create Linked CB Gallery Media Items
I'm not sure. I've just tested the above and it's working perfectly fine in my tests. Specifically I created the below test.

Global
Triggers: None
Type: CB Gallery
User: Self
Access: Everybody
Action
Mode: Item
Method: Create
Asset: profile.[user_id]
Link: LIVE_IMAGE_PATH_HERE
Title: Test
Owner: [user_id]
Load: By Asset, Link, and Owner
Output
Display: JSON
Layout:
Code:
if ( ! $actiondata['data1'] ) { return []; } return [ 'id' => $actiondata['data1']->getInt( 'id' , 0 ), 'user_id' => $actiondata['data1']->getInt( 'user_id' , 0 ), 'asset' => $actiondata['data1']->getString( 'asset' , '' ), 'date' => $actiondata['data1']->getString( 'date' , '' ), ];
Method: PHP

This then gave me the following results.
Code:
{"id":30655,"user_id":1090,"asset":"profile.1090","date":"2023-09-18 14:15:01"}

So it seams to be working.


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.

  • PaceOnline
  • PaceOnline
  • OFFLINE
  • Posts: 104
  • Thanks: 2
  • Karma: 0
1 year 1 month ago #335323 by PaceOnline
Replied by PaceOnline on topic Create Linked CB Gallery Media Items
I have copied exactly that and I still get "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data"

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
1 year 1 month ago - 1 year 1 month ago #335325 by krileon
Replied by krileon on topic Create Linked CB Gallery Media Items
My guess is you've a JSON error coming from something else or something is messing with the output buffer data maybe. Is the gallery media item being created?

It's possible something installed on your site could be messing with headers. Try adding &format=json or &format=raw to your auto action URL.

Aside from that I recommend checking your server error log to see if there's any further details regarding your error as without a callstack showing where it's coming from there's nothing more I can suggest and since tests can't reproduce it it seams to be a problem in the environment and not a bug in CB Auto Actions.


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.
Last edit: 1 year 1 month ago by krileon.
The following user(s) said Thank You: PaceOnline

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

Moderators: beatnantkrileon
Powered by Kunena Forum