I need to add data to each activity (wall status). Adding new dropbox to status.form.php, populating with data and creating new DB field are not a problem and easy to maintain when update to JomSocial is published.
Where is located code that is triggered when Post button is pressed? bundle.js in release_32? Where is code for collecting data from from and writing it to DB?
Hi Vladimir,
You can modify this file components/com_community/assets/release_32/js/bundle.src.js, find this function "onPost: function() {" then you need minify to bundle.js.. actaully I dont recommended you to do this hack, because this is not easy, but if you can do it by yourself, go ahead.. but we cant help you too much.
thank you!
After getting my data from form status.form.php and adding in bundle.js to existing data it looks like all that data is passed to system.php ajaxStreamAdd for additional filtering. I cannot find where is that data saved to DB. Any help?
If someone needs this here it is:
1) Go to status.form.php (.../com_community/templates/jomsocial/layouts/) and add html elements that you need to supply additional data with each post. Element need to have id like <div id="additional-data"> ... </div>
2) Go to bundle.js (.../com_community/assets/release_32/js/) and find "onPost: function () {". After "e = this.value();" add
var z = document.getElementById("additional-data");
var zValue = z.options[z.selectedIndex].value;
I used dropbox so this example is for that element.
go to line "window.joms_filter_params && e.push(JSON.stringify(window.joms_filter_params))" and add "&& e.push(zValue)" so it looks like:
window.joms_filter_params && e.push(JSON.stringify(window.joms_filter_params)) && e.push(zValue),
3) Go to system.php (.../com_community/controllers/) and change 806 line to look like
public function ajaxStreamAdd($message, $attachment, $streamFilter = FALSE, $myadditionaldata)
then find
$act = new stdClass(); line 893
and add new line something like
$act->myadditionaldata = $myadditionaldata;
4) Go to activity.php (.../com_community/libraries/) and after line 116 add new
$this->def('myadditionaltablefield', 'myadditionaldata');
5) Don't forget to add new field in db/table #__community_activities that is named "myadditionaltablefield" with properties that you need.
If you need additional data for other types of post you need to add more lines in other parts of bundle.js and system.php since this is just for regular Status posts/activities.
Since my next question is related to this discussion I will post it here :)
Where can be found JS joms.view.stream.save that is called from
...\components\com_community\templates\jomsocial\layouts\stream\status.php
<button class="joms-button--primary joms-button--small" onclick="joms.view.stream.save('<?php echo $activity->get('id'); ?>', this);"><?php echo JText::_('COM_COMMUNITY_SAVE'); ?></button>
so I can add more data to be processed on
...\components\com_community\controllers\activities.php
public function ajaxSaveStatus ...
Hi,
Please check controllers/system.php functino ajaxStreamAdd()
thank you!
controllers/system.php and ajaxStreamAdd() are responsable for creating new activities as far I can tell and that part I have figured out :)
I'm interested in function that is responsible for editing existing (already displayed) activities on wall.
OK, good luck, if you have another questions please let me know..