Hi,
I am playing with the addNewAccount function in SpecialUserlogin.php.
The extra form fields that are created need to be e-mailed to a sysop
and it worked fine for a day, but the mails are not delivered anymore.
Could someone advice on what the problem might be (except for coding in
the core)?
---
function addNewAccount() {
global $wgUser, $wgEmailAuthentication;
# Create the account and abort if there's a problem doing so
$u = $this->addNewAccountInternal();
if( $u == NULL )
return;
# If we showed up language selection links, and one was in use, be
# smart (and sensible) and save that language as the user's
preference
global $wgLoginLanguageSelector;
if( $wgLoginLanguageSelector && $this->mLanguage )
$u->setOption( 'language', $this->mLanguage );
# Send out an email authentication message if needed
if( $wgEmailAuthentication && User::isValidEmailAddr(
$u->getEmail() ) ) {
global $wgOut;
$error = $u->sendConfirmationMail();
if( WikiError::isError( $error ) ) {
$wgOut->addWikiMsg( 'confirmemail_sendfailed',
$error->getMessage() );
} else {
$wgOut->addWikiMsg( 'confirmemail_oncreate' );
}
}
# Save settings (including confirmation token)
$u->saveSettings();
# If not logged in, assume the new account as the current one
and set session cookies
# then show a "welcome" message or a "need cookies" message as
needed
if( $wgUser->isAnon() ) {
$wgUser = $u;
$wgUser->setCookies();
wfRunHooks( 'AddNewAccount', array( $wgUser ) );
if( $this->hasSessionCookie() ) {
return $this->successfulLogin( 'welcomecreation',
$wgUser->getName(), false );
} else {
return $this->cookieRedirectCheck( 'new' );
}
} else {
# Confirm that the account was created
global $wgOut;
$self = SpecialPage::getTitleFor( 'Userlogin' );
$wgOut->setPageTitle( wfMsgHtml( 'accountcreated' ) );
$wgOut->setArticleRelated( false );
$wgOut->setRobotPolicy( 'noindex,nofollow' );
$wgOut->addHtml( wfMsgWikiHtml( 'accountcreatedtext',
$u->getName() ) );
$wgOut->returnToMain( false, $self );
wfRunHooks( 'AddNewAccount', array( $u ) );
$topic = "Application from user " . $this->mName ."\n";
$text = $this->mName ." wants ... \n\n";
$text .= "Real name: " .$this->mRealName . "\n";
$text .= "Business name: " . $this->mBusinessName . "\n";
$text .= "Address: " . $this->mAddress . "\n";
$text .= "Business type: " . $this->mBusinessType . "\n";
$text .= "Interests: " . $this->mInterests . "\n";
$text .= "Affiliations: " . $this->mAffiliations . "\n";
$text .= "Specific interests: " . $this->mSpecificInterests . "\n";
$text .= "Published work: " . $this->mPublishedWork . "\n";
mail("myemail(a)somesite.com", $topic, $text, "From:myemail@somesite.com",
"-f myemail(a)somesite.com");
return true;
}
}
---
Thanks,
Alain