CB Activity to GroupJive data

2 years 4 months ago - 2 years 4 months ago #327447 by activha
Replied by activha on topic CB Activity to GroupJive data
Well, that’s a pity because your whole system and auto actions typically would bring low tech users like me to develop small things easily with some kind of bricks brought together.

As I said I don’t have developers to do this at a reasonable price, that’s why I try myself.

For now it seems like all could be handled by CB and that would be great if I can achieve it without relying to external peoples

We’ll see if we grow and raise capital but for now I just cannot afford it

I’ll try to go the query way to add the multimedia files but in the meantime I may have another idea :


1 - Users add new activities with a button named 'campaign' allowing them to link multimedia video from external website. (I have already the button thanks to your guide)

2 - Then I have a query autoaction creating an event and adding the activity asset in the event params.

3 - Next step is to display the activity with gj_onDisplayEvent as a stream without creation abilities and the asset from point 3. The linked video is correctly shown in the footer of the event.

4 - Now, interested users subscribe to this event and I'd like to be able to display the linked video somewhere.

For now I have a CB query drop down field with :
SELECT e.* FROM `#__groupjive_plugin_events` AS e JOIN `#__groupjive_plugin_events_attendance` AS a on a.`user_id` = '[user_id]' AND a.`event` = e.`id` JOIN `#__groupjive_groups` AS b ON  b.`id` = e.`group` AND ( b.`category` = '13'  OR b.`id` = '56' ) ORDER BY e.`params`ASC

and when an activity with the activation button is done with a selected drop down, it is now registered in params event and displayed by :
$marketevents  = $action->string( $user,'[var1_params_event]');

		if ($marketevents > 0) {		
			$db = JFactory::getDbo();
			$query = $db->getQuery();
			$query="SELECT id FROM `yq0g1_groupjive_plugin_events_attendance` WHERE `user_id` = ".$user_id."  AND `event` = ".$marketevents;
			$db->setQuery($query);
			$eventat = $db->loadResult();
			if ($eventat) {
				$query = "SELECT * FROM `yq0g1_groupjive_plugin_events` WHERE `id` =". $marketevents;
				$db->setQuery($query);
				$event=$db->loadObject();
				print_r($event);
				$displayevent = $event->event;
				//Choose the right category if it's for individuals or pros.
				$cat = null;
				$cats = json_decode($event->params);
				$cat = $cats->drophscat;
//				print_r($cat);
				if ($cat == '10') $value = "Professionnels";
				if ($cat == '20') $value = "Particuliers";
				if ($cat == '30') $value = "Tout public";
				if ($cat == '50') $value = "Campagnes souhaitées";
				//set multiplier to default or check fo display
				$groups = JAccess::getGroupsByUser($event->user_id);
				if (in_array(18, $groups) && $event->group != 56){
				$mfl = $cbUser->replaceUserVars ('[cb:userdata field="cb_marketing_multiplier" user="' . $event->user_id . '" /]');
				} else $mfl = 2;
				
			}	
		}      
		<div class="row">
			<div class="col col-sm-11 col-md-10 col-lg-8 mx-auto mt-0 mb-5">
				<div class="mx-1">
<?php								
										//run the content through the onContentPrepare Joomla event,
										$params = new JRegistry();
										$params->loadString("");
										$content = new StdClass;
										$content->text = $event->event;
										JFactory::getApplication()->triggerEvent('onContentPrepare', array("", &$content, &$params, 0));
										echo $content->text;
										//echo $event->text;										 
?>					
				</div>	
			</div>	
		</div>

Starting from this point, how can I retrieve the first linked multimedia file added in the related activity to the event chosen instead of using the event content ?

If I can do this, that would simplify all and allow me to only use CB Activity combined with GroupJive for our entire process.

This whole step allows users to select an event with a linked video

The second step www.joomlapolis.com/forum/255-developer-members-support/244490-cb-activity-new-use-for-spots-display allows them to "activate" something with this chosen video.
This second step seems ok with all the information and help that you provided.
So I am only left with this first step to implement and some validations done with CB 6

Please Log in to join the conversation.

2 years 4 months ago #327453 by krileon
Replied by krileon on topic CB Activity to GroupJive data

Well, that’s a pity because your whole system and auto actions typically would bring low tech users like me to develop small things easily with some kind of bricks brought together.

I think here at Joomlapolis we've done that beyond what anyone else has and can provide, but there's always going to be a limit. You're trying to add an entirely new functionality to CB Activity. That's something I've always created a new plugin to do, because there isn't any other way to do it cleanly. It's not possible to create an entire CB plugins structure from CB Auto Actions yet. It just hasn't reached that level of potential yet, but it is going to continue to grow and improve over the years. Its rewrite for CB 3.x I am hoping to have a drag and drop interface to allow for "visual scripting", but that's a long way off.

In a future CB Activity release (NOT 6.0.0) I'd like to support custom fields for it. So you could in theory in backend setup a new feature button, create the fields for that button, and boom you've a new activity type, but that isn't coming anytime soon.

Starting from this point, how can I retrieve the first linked multimedia file added in the related activity to the event chosen instead of using the event content ?

You need the activity object because the gallery entries ids will be stored in its params as an array. You will not be able to get that information with a substitution since it's just an array of data. You need to use the API so you need the activity object. If you have the activity object then you'd access it with the following.

$uploads	=	cbToArrayOfInt( $row->params()->getRaw( 'gallery', array() ) );

With $row being the activity object (e.g. could be $variables). This is just a small part. The profile gallery object still needs build and the gallery filtered down to those IDs. The usage in CB Activity is not designed for what you're trying to do. It's a very specific implementation. At any rate you can find the code for CB Gallery integration into CB Activity below to see how it's done.

/components/com_comprofiler/plugin/user/plug_cbgallery/library/Trigger/ActivityTrigger.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.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.180 seconds

Facebook Twitter LinkedIn