function add_follow_notification($args) { $follower = $args['follower']; $followed = $args['followed']; // Add custom notification message here $message = $follower->full_name . ' is now following you'; // Add notification to the database Phpfox::getService('notification.process')->add($followed['user_id'], $message); } // Register the callback function Phpfox::callback('friend.add_friend', 'add_follow_notification');
function add_custom_field_to_profile($args, $retval) { $user = $args['user']; $profile_fields = $retval['profile_fields']; // Add custom field to profile fields array $custom_field = array( 'title' => 'Custom Field', 'value' => $user['custom_field'] ); $profile_fields[] = $custom_field; // Return modified profile fields array $retval['profile_fields'] = $profile_fields; return $retval; } // Register the callback function Phpfox::callback('user.profile_viewer', 'add_custom_field_to_profile');Both examples use the Phpfox package library, which is a collection of pre-defined classes and functions for use in Phpfox software development.