How to make messenger show up in a quick popup with this code?

I am using @AQB Soft advanced menu. With the messenger button on the profile card, how do I make this code open up a popup messenger so it doesn't redirect me to the actual messenger? I need a way for people to send a quick message and still stay on the same page.



if (

!isset($aContentData['profile_id']) || 

($sModule != 'bx_persons' && $sModule != 'bx_organizations') || 

$aContentData['profile_id'] == bx_get_logged_profile_id()) 

return ' ';

return $oMenuObject->getUnitMetaItemButton(

'Message', 

['onclick' => "window.location.href = sUrlRoot+'page/messenger?profile_id=".$aContentData['profile_id']."';"]

);

  • 165
  • More
Replies (3)
    • Also interested

      • The problem is that in UNA messenger doesn't work in popups. It works on a dedicated page.

        It is possible to modify the code above to force it to open a page in a new popup window - but nowadays such popups are being blocked by modern browsers by default (asking for permission first to show a popup) so that will be a bad user experience.

        Another alternative is to have a link instead of a button, which will open a messenger in a new tab. So you can try this code instead:

        if (
            !isset($aContentData['profile_id']) ||
            ($sModule != 'bx_persons' && $sModule != 'bx_organizations') ||
            $aContentData['profile_id'] == bx_get_logged_profile_id())
        return ' ';
        return $oMenuObject->getUnitMetaItemLink(
            'Message',     
            ['href' => BX_DOL_URL_ROOT.'page/messenger?profile_id='.$aContentData['profile_id'], 'target' => '_blank']
        );
        
        • Yes it works

          Login or Join to comment.