Where to add code after every "Un-Friend" Action

Hi All, I have some code cleanup I would like to perform after every "un-friend" action on my site ( I have Modzzz's circle mod and I would like to remove the user from circles if they unfriend) but I'm not sure where to put the code.  I've narrowed it down to : 

1. _deleteRequest in BxDolCommunicator.php

 

Question: Is there anywhere else I need to put code for the "Un-Friend" action? Also, any issues with adding code here? Please let me know your thoughts/ideas about this. Thanks.

Quote · 10 Apr 2020

Ideally, you need to modify the "My Circle" modules and use the Alerts system to do this instead of making adjustments to Dolphin core code.

Paypal email is jeromemingo@gmail.com - http://www.boonex.com/market/posts/modzzz
Quote · 11 Apr 2020

@Modzzz 

 

Have you seen my inquiry? I send here with the boonex system and an email.

Quote · 11 Apr 2020

Putting solution here to help anybody that runs into same issue: 

 

Problem: I have some code I would like to run after every "un-friend" action on my site ( This is in relation to @Modzzz Circle mod, I would like to remove the user from circle if they un-friend each other) . As mentioned above, it is not recommended to alter core code but make the changes in the module itself. So I need to use Dolphins event subscription service which uses "alerts" to pass event notifications which I can handle in my module.

 

Solution: 

1. Create the alert handler method. 

 

Inserted the following into the sys_alerts_handlers table in database:

 

INSERT INTO `sys_alerts_handlers` VALUES (NULL, 'modzzz_circle_friend_delete', '', '', 'BxDolService::call(''circle'', ''response_friend_delete'', array($this));');

 

Create the corresponding method in BxCircleModule.php: 

 

function serviceResponseFriendDelete ($oAlert)

    {

        ....

    }

    

2. Create an alert that will receive event notification and call up alert handler method

 

Inserted the following into the sys_alerts table in database:

 

INSERT INTO `sys_alerts` VALUES (NULL , 'friend', 'delete', {Must be id of the corresponding row in sys_alerts_handlers table});

 

Note: I got the name for the un-friend action event from BxDolCommunicator.php : line 261.

case 'sys_friend_list':
                $oZ = new BxDolAlerts('friend', 'delete', $iID, $iProfile);
                $oZ -> alert();
                break;

If anyone has anything to add, please feel free. Especially about how the BxDolAlerts work exactly, thanks. 

 

Quote · 23 Apr 2020

The following function should work to remove both from each other's circle :

 

    function serviceResponseFriendDelete ($oAlert)
    { 
        if (!($iProfileId = (int)$oAlert->iObject))
            return false;

        $iAssociateId = $oAlert->iSender;
 
        $this->_oDb->removeFromCircle($iAssociateId, $iProfileId);
        $this->_oDb->removeFromCircle($iProfileId, $iAssociateId);

        return true;
    }
Paypal email is jeromemingo@gmail.com - http://www.boonex.com/market/posts/modzzz
Quote · 25 Apr 2020
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.