Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated
Welcome the Technical Support section. Help us in assisting you by providing us with a concise and descriptive elaboration of your issues. Be specific and if possible, provide us with a step-by-step instruction in replicating your problem.

What is best way to add data to status form?

7 years 6 months ago
  • Vladimir's Avatar
    Topic Author
  • Vladimir
  • Offline
  • Junior Boarder
  • Posts: 283
  • Thank you received: 40
Licenses:
JomSocial Active

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?

7 years 6 months ago
  • Dimas's Avatar
  • Dimas
  • Visitor
  • Thank you received: 0
Licenses:

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!

7 years 6 months ago
  • Vladimir's Avatar
    Topic Author
  • Vladimir
  • Offline
  • Junior Boarder
  • Posts: 283
  • Thank you received: 40
Licenses:
JomSocial Active

That is exactly the info I needed.
Thank you very much!

7 years 6 months ago
  • Vladimir's Avatar
    Topic Author
  • Vladimir
  • Offline
  • Junior Boarder
  • Posts: 283
  • Thank you received: 40
Licenses:
JomSocial Active

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?

7 years 6 months ago
  • Vladimir's Avatar
    Topic Author
  • Vladimir
  • Offline
  • Junior Boarder
  • Posts: 283
  • Thank you received: 40
Licenses:
JomSocial Active

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.

6 years 7 months ago
  • Vladimir's Avatar
    Topic Author
  • Vladimir
  • Offline
  • Junior Boarder
  • Posts: 283
  • Thank you received: 40
Licenses:
JomSocial Active

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

6 years 7 months ago
  • Dimas's Avatar
  • Dimas
  • Visitor
  • Thank you received: 0
Licenses:

Hi,

Please check controllers/system.php functino ajaxStreamAdd()

thank you!

6 years 7 months ago
  • Vladimir's Avatar
    Topic Author
  • Vladimir
  • Offline
  • Junior Boarder
  • Posts: 283
  • Thank you received: 40
Licenses:
JomSocial Active

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.

6 years 7 months ago
  • Dimas's Avatar
  • Dimas
  • Visitor
  • Thank you received: 0
Licenses:

OK, good luck, if you have another questions please let me know..

Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW