allwiki首页  
天下维客 你可以修改的网络知识库
首页最近更改优秀条目专题展示电脑科技词典软件学习网络知识电脑安全明星时尚天下百科
 

MediaWiki扩展:编辑前确认Email

天下维客,你可以修改的网络知识库

Jump to: navigation, search

本文取自元维基,欢迎共同翻译、整理与大家共享,促进中文wiki发展^_^

This describes my hack that requires email authentication before editing for Wiki 1.5. - Tbsmith

This hack is for 1.5.

If you are using 1.6, just add '$wgEmailConfirmToEdit = true;' to the end of your LocalSettings.php file.

For those with 1.5, first add this code to includes/EditPage.php (~line 158):

....
        if (!$wgUser->isAllowed('edit') ){
            if ( $wgUser->isAnon() ) {
                $this->userNotLoggedInPage();
                return;
            } else {
                $wgOut->readOnlyPage( $this->mArticle->getContent( true ), true );
                return;
            }
        }
        ## Add this for email authentication before editing#
        if (!$wgUser->getEmailAuthenticationTimestamp() ) {
            $this->userHasNotAuthenticatedEmailPage();
            return;
        }
        #################################################
        if ( wfReadOnly() ) {
....

Put this code in the same file above the userNotLoggedInPage function on about line 858:

#### Add this function for Email Authentication before editing ###
    function userHasNotAuthenticatedEmailPage() {
        global $wgOut;

        $wgOut->setPageTitle( wfMsg( 'noemailauthtitle' ) );
        $wgOut->setRobotpolicy( 'noindex,nofollow' );
        $wgOut->setArticleRelated( false );

        $wgOut->addWikiText( wfMsg( 'noemailauthtext' ) );
        $wgOut->returnToMain( false );
    }
###################################################################
   function userNotLoggedInPage() {
....

Add this to languages/Language.php line 692: (for 1.6 seems like context is in languages/Messages.php (-- added edit)


'whitelistedittitle' => 'Login required to edit',
'whitelistedittext' => 'You have to [[Special:Userlogin|login]] to edit pages.',
###### Add for email auth before editing ###############
'noemailauthtitle' => 'Email Authentication Required',
'noemailauthtext' => 'You have to [[Special:Confirmemail|confirm]] your email address to edit pages.',
########################################################

原文参见: Email authentication before editing

Personal tools
工具
金银币拍卖 金币拍卖预展  金银币网店 熊猫金银币 生肖金银币