The Techjoomla Blog

Stay updated with all the latest happenings at Techjoomla. From news about the developments in your favourite extensions to Tips & Tricks about the Joomla CMS, Framework & Development.
Font size: +
1 minute reading time (187 words)

Catching JomSocial Ajax Calls for modifying flows

Catching-JomSocial-Ajax-Calls-for-modifying-flows

When you are custom developing on top of JomSocial, you sometimes need to Catch Ajax calls for modifications. This Quick tutorial will take you through how you can do this.

The OnAjaxCall Call Event

This is Jomsocial event will be triggered before any Ajax operation is performed. The plugin can decide whether to proceed with the Ajax operation by returning true or False. By using this event you can fetch ajax function name and also Id related to that. You can read more about this call in the JomSocial Docs

Sample Code for Catching Album Delete

Below is the example for fetching album 'delete' action with 'albumid' to perform some updating operations.
Make a plugin of the community with the code as below.

function onAjaxCall( $arrItems )
{
                //$v  =  var_export($arrItems, true); 
               //Outputs or returns a parsable string representation of a variable
               //So, print $v to check what exactly we get in ajax response .
             
             $fucn     = JRequest::getcmd('func'); //get exact function name here to catch
             $arg       =JRequest::getInt('arg2');  //In this case, get albumid here
 
       if($fucn == 'photosajaxRemoveAlbum'){                                                                                    
//Your code here.for updation or deletion or whatever
               }
return false;
}
0
×
Stay Informed

When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.

JTicketing version 1.4.4 is here!
Performance Tips: Indexing your Joomla tables

Related Posts

 

Blog Topics