Creating new group photo uploads

3 months 3 days ago #330524 by PaceOnline
Creating new group photo uploads was created by PaceOnline
We are struggling to create an auto action that can create a photo upload in a specific group from an internal url. We have the group id but we don't have the photo id or activity id because neither have been created. (We are hoping to create get them from return $actiondata; but we can't configure the action to create the activity or upload the photo.

Please Log in to join the conversation.

3 months 3 days ago #330525 by krileon
Replied by krileon on topic Creating new group photo uploads
You can't create an upload from the CB Gallery auto action type. You can only create linked media. Uploads require the transfer of data. It only supports native PHP uploads and image data strings. To perform an upload you would need to deal with writing all that PHP yourself using a Code action and a CB Gallery media item object class.

For example the below would add linked media to a group.

Mode: Item
Method: Create
Asset: groupjive.group.GROUP_ID_HERE
Link: URL_TO_MEDIA

That should be all you need unless you don't have a user object for the auto action then you need to also specify Owner.


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 to join the conversation.

3 months 2 days ago #330537 by PaceOnline
Replied by PaceOnline on topic Creating new group photo uploads
If we specify a remote location in the code action instead of a local location will it work?

Please Log in to join the conversation.

3 months 2 days ago #330544 by krileon
Replied by krileon on topic Creating new group photo uploads
As long as whatever URL you supply is accessible over the web (e.g. URL works in your browser) then sure it doesn't matter where it's stored.


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 to join the conversation.

3 months 1 day ago #330551 by PaceOnline
Replied by PaceOnline on topic Creating new group photo uploads
I want to add a photo from a remote location so i have used code action but issue is that there is no option to set remote file location on database table, can you provide code or just inform me in which column i can add remote file location?

Please Log in to join the conversation.

3 months 1 day ago #330555 by krileon
Replied by krileon on topic Creating new group photo uploads
Set the "file" column as empty and the "value" column to the URL of whatever you're trying to link to. The CB Gallery auto action can already handle creating new linked gallery entries. If you insist on doing this with a Code action then you should build a media item object to work with. Example as follows.
$media	=	new \CB\Plugin\Gallery\Table\ItemTable()

$media->set( 'user_id', USER_ID_THIS_BELONGS_TO_HERE ); // e.g.42, 38, 91
$media->set( 'asset', 'ASSET_THIS_MEDIA_BELONGS_TO_HERE' ); // e.g. profile.42, cbgroupjive.group.4, article.3, etc..
$media->set( 'type', 'MEDIA_TYPE_HERE' ); // stricly one of the following: photos, videos, files, music
$media->set( 'value', 'URL_OF_MEDIA_HERE' ); // e.g. http://www.example.com/my_photo.jpg
$media->set( 'published', 1 );

$media->store(); // saves all of the above to 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 to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.229 seconds

Facebook Twitter LinkedIn