CB Gallery multiple tabs/fields

10 months 2 weeks ago #334131 by activha
CB Gallery multiple tabs/fields was created by activha
Hello
Can I have two gallery tabs with two different configurations ?
One allowing users to upload and manage public files/urls which would appear in CB Activity
The second one allowing selected groups of users to upload and manage files/urls that would not appear in CB activity and have specific privacy settings ?

In my autoaction using gallery_onAfterCreateItem and gallery_onAfterEditItem, can I condition it against the second tab ?

Thanks on this

Please Log in to join the conversation.

10 months 2 weeks ago #334137 by krileon
Replied by krileon on topic CB Gallery multiple tabs/fields

Can I have two gallery tabs with two different configurations ?

Yup, create a new tab then add a Gallery field to it.

One allowing users to upload and manage public files/urls which would appear in CB Activity

Uploads to CB Activity right now have a very specific and unchangeable asset that's hardcoded into the integration. So those will always upload to profile.USER_ID.uploads, but in CB Activity 6.0.0 you'll be able to set the asset of that streams gallery to whatever you like.

The second one allowing selected groups of users to upload and manage files/urls that would not appear in CB activity and have specific privacy settings ?

By default only profile gallery uploads create activity so yes you could do this by just using a non-profile based asset for your second gallery.

In my autoaction using gallery_onAfterCreateItem and gallery_onAfterEditItem, can I condition it against the second tab ?

You'd just be conditioning against the media entries asset, but yes that's doable just not by tab id.


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.

10 months 2 weeks ago #334145 by activha
Replied by activha on topic CB Gallery multiple tabs/fields
Great ! Thanks

Can I also condition the number of files and their sizes against BCsubs plans ? And how ?

Say 10 files of 10mb max for plan A and up to 50 files of 20mb max for plan B for instance

Please Log in to join the conversation.

10 months 2 weeks ago #334146 by krileon
Replied by krileon on topic CB Gallery multiple tabs/fields

Can I also condition the number of files and their sizes against BCsubs plans ? And how ?

Yes, just set the create limit for media for that gallery to be a field then use CBSubs Fields to change the value of that field when they make a purchase.

Say 10 files of 10mb max for plan A and up to 50 files of 20mb max for plan B for instance

Only create limit can be changed per-user. File size limit cannot be changed per-user at this time.


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.

10 months 2 weeks ago #334153 by activha
Replied by activha on topic CB Gallery multiple tabs/fields
thanks, lastly is there a solution to delete all files of a cb gallery field at the same time ?
I'd like to call an autoaction to delete all files of a user

Please Log in to join the conversation.

10 months 2 weeks ago #334163 by krileon
Replied by krileon on topic CB Gallery multiple tabs/fields
There is no feature to mass delete an entire gallery. You'd have to query for the gallery media, construct media objects, and call their delete functions for that. Example as follows.
global $_CB_database;

// Delete all folders
$query				=	'SELECT *'
					.	"\n FROM " . $_CB_database->NameQuote( '#__comprofiler_plugin_gallery_folders' )
					.	"\n WHERE " . $_CB_database->NameQuote( 'asset' ) . " = " . $_CB_database->Quote( 'ASSET_HERE' );
$_CB_database->setQuery( $query );
$folders			=	$_CB_database->loadObjectList( null, '\CB\Plugin\Gallery\Table\FolderTable', array( $_CB_database ) );

/** @var FolderTable[] $folders */
foreach ( $folders as $folder ) {
	$folder->delete();
}

// Delete all items
$query				=	'SELECT *'
					.	"\n FROM " . $_CB_database->NameQuote( '#__comprofiler_plugin_gallery_items' )
					.	"\n WHERE " . $_CB_database->NameQuote( 'asset' ) . " = " . $_CB_database->Quote( 'ASSET_HERE' );
$_CB_database->setQuery( $query );
$items				=	$_CB_database->loadObjectList( null, '\CB\Plugin\Gallery\Table\ItemTable', array( $_CB_database ) );

/** @var ItemTable[] $items */
foreach ( $items as $item ) {
	$item->delete();
}

Replace ASSET_HERE with the asset you want to delete. This will delete all the folders and media items matching it. It needs to run the PHP delete function to clear out the files stored. You should be able to run this with a Code action and Method set to PHP.


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: activha

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.420 seconds

Facebook Twitter LinkedIn