Database Field Name for images in CB Gallery

7 years 3 months ago #290478 by buyalong
I have a script that autopopulates CB database fields from input in cb registration to selected RSform fields. What is the database field name for images in CB Gallery? In other words, wat can I replace "cb_vendorcompany" with to fetch images from the gallery?
Here's the script:

//<code>
$user = JFactory::getUser();
$db = JFactory::getDbo();
$userId = $user->get('id');

// Is the user logged in?
if ($userId) {
// Grab the value from the database.
$db->setQuery("SELECT `cb_vendorcompany` FROM `#__comprofiler` WHERE `user_id`='".$userId."'");
return $db->loadResult();
}
//</code>

Please Log in to join the conversation.

7 years 3 months ago #290479 by buyalong
Replied by buyalong on topic Database Field Name for images in CB Gallery
This is the databade (Table?) where images are stored: nfojm_comprofiler_plugin_gallery_items

Please Log in to join the conversation.

7 years 3 months ago #290487 by krileon
Replied by krileon on topic Database Field Name for images in CB Gallery
Yes, gallery image rows are stored in _comprofiler_plugin_gallery_items. Why are you needing to do this? What are you trying to accomplish by directly accessing the gallery 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.

7 years 3 months ago #290491 by buyalong
Replied by buyalong on topic Database Field Name for images in CB Gallery
I have a service named Cloud Closet wherein customers store their travel items in our facility. The Rsform will allow the user to order service and select which items they want to travel with. I already hace a script that will autopopulate fields in my form from cb profile fields. I want users to upload their images to their profile and I want these images to autopopulate a checkbox field on the order form which would allow a seamless ordering experience.

Please Log in to join the conversation.

7 years 3 months ago #290506 by buyalong
Replied by buyalong on topic Database Field Name for images in CB Gallery
Is there a way to put the gallery data in a table?

Please Log in to join the conversation.

7 years 3 months ago #290541 by krileon
Replied by krileon on topic Database Field Name for images in CB Gallery

I have a service named Cloud Closet wherein customers store their travel items in our facility. The Rsform will allow the user to order service and select which items they want to travel with. I already hace a script that will autopopulate fields in my form from cb profile fields. I want users to upload their images to their profile and I want these images to autopopulate a checkbox field on the order form which would allow a seamless ordering experience.

That's a usecase that CB Gallery really does not cover. You also can not access the images directly. They have to be served through the plugin component URL as htaccess blocks their direct access on purpose for security. To load the profile gallery through API you'd have to do the following.

global $_PLUGINS;

if ( ( ! file_exists( JPATH_SITE . '/libraries/CBLib/CBLib/Core/CBLib.php' ) ) || ( ! file_exists( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' ) ) ) {
	echo 'CB not installed'; return;
}

include_once( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' );

cbimport( 'cb.html' );

$_PLUGINS->loadPluginGroup( 'user' );

if ( ! $_PLUGINS->getLoadedPlugin( 'user', 'cbgallery' ) ) {
	return;
}

$gallery	=	new Gallery( null, USER_ID_HERE );

$gallery->set( 'type', 'photos' );
$gallery->set( 'items_paging_limit', 0 );

$photos		=	$gallery->items();

$photos should be an array of the USER_ID_HERE users profile gallery. Note USER_ID_HERE must be an integer.

Is there a way to put the gallery data in a table?

It's already in a database table. As said in my previous reply that table is _comprofiler_plugin_gallery_items.


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.215 seconds

Facebook Twitter LinkedIn