Extension talk:Popup

From mediawiki.org
Latest comment: 11 years ago by Jperl

Hello. I want to show popup only for users that are not logged in. What should I add to the sourcecode? --Tarasius.ua (talk) 12:42, 31 July 2012 (UTC)Reply

You simply have to check wheter the user is logged in or not. Therefore add the $wgUser to the global statement (line 35) and then check if the user is logged in with the following code.
global $wgUser, $wgPopupPath, $wgPopupHeight, $wgPopupWidth, $wgPause, $wgCookieName, $wgPopupScript, $wgCookieExpire;

require_once('includes/StubObject.php');
if( StubObject::isRealObject( $wgUser ) &&  $wgUser->isLoggedIn()) //check if user is logged in
{
  // user is logged in, put remaining code in here

}
That should help. --Jperl (talk) 13:24, 31 July 2012 (UTC)Reply