call_integration_hook on whos online

Started by asmith, May 04, 2014, 02:16:57 AM

Previous topic - Next topic

asmith

Hello,

SMF 2.0.7

The call_integration_hook() in Who.php, line 425, takes the $actions in each loop. But there are $profile_ids, $board_ids and $topic_ids which we don't have any control over via call_integration_hook(). (I'm trying to avoid modifying SMF source files directly as much as possible)

Say I want to redefine 'profile' action and use my own. Maybe base it on the areas of profile the user is viewing. $profile_ids later in the script (after the integration), it overwrites $data. So no matter what I do in call_integration_hook(), if they are profile related to a user, they will be overwritten.

Currently I'm doing my custom area like this:

I've made $profile_ids global in the determineActions() and this is my custom function:

<?php
function custom_whos_online($actions)
{
   global
$profile_ids;

   if (
$actions['action'] == 'profile' && !empty($actions['area']) && $actions['area'] == 'custom_area')
   {
       
// in determineActions(), we are already assigning $actions['u']. So we have it here.

       
$k = end(array_keys($profile_ids[(int) $actions['u']]));
       
$profile_ids[(int) $actions['u']][$k] = 'My own text!!';

       
//$profile_ids[(int) $actions['u']][$k] = $actions['action'] == 'profile' ? $txt['who_viewprofile'] : $txt['who_profile'];

       
return array('My own text!!'); // Won't have any effect

   
}
   
}
?>



I'm suggesting to pass $profile_ids, $board_ids and $topic_ids to call_integration_hook() as well.

Thanks for your attention

Advertisement: