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;