/** * Overrides the default chooseNameForm for FBConnect extension so that * we can use a custom one for Wikia. */ function wikia_fbconnect_chooseNameForm(&$specialConnect, &$messageKey) { global $wgOut, $wgUser, $wgRequest; wfProfileIn(__METHOD__); if (!$wgUser->isAllowed('createaccount')) { // TODO: Some sort of error/warning message. Can probably re-use an existing message. } else { // If it is not the default message, highlight it because it probably indicates an error. $style = $messageKey == "fbconnect-chooseinstructions" ? "" : " style='background-color:#faa;padding:5px'"; $wgOut->addHTML("<strong{$style}>" . wfMsg($messageKey) . "</strong>"); $form = new ChooseNameForm($wgRequest, 'signup'); $form->mainLoginForm($specialConnect, ''); $tmpl = $form->getAjaxTemplate(); ob_start(); $tmpl->execute(); $html = ob_get_clean(); $wgOut->addHTML($html); } wfProfileOut(__METHOD__); return false; // prevent default form from showing. }
function ajaxModalChooseName() { global $wgRequest; $response = new AjaxResponse(); $specialConnect = new SpecialConnect(); $form = new ChooseNameForm($wgRequest, 'signup'); $form->mainLoginForm($specialConnect, ''); $tmpl = $form->getAjaxTemplate(); $tmpl->set('isajax', true); ob_start(); $tmpl->execute(); $html = ob_get_clean(); $response->addText($html); return $response; }