[Mediawiki-l] Users can not 'talk'

Alexis Moinet alexis.moinet at fpms.ac.be
Thu Sep 14 07:16:35 UTC 2006


asselarain-mediawikil-/E1597aS9LQAvxtiuMwx3w at public.gmane.org a écrit :
> Hm...doesn't these two lines mean that "Users (logged in or not) can't edit PAGES"? I want that to be like that -- users should not edit pages since this is a web page, but they should be able to participate by contributing to 'talk' pages. 
> 

I think the 'talk' right doesn't exist in mediawiki default installation, you need to create it by changing a little bit the *isAllowed()* function in "includes/User.php " folder.

A few months ago, I found this on mediawiki.org (but I can't remember on which page) :

(it's for 1.5.8, but it shouldn't be too difficult to adapt it to 1.7.1)

change this :

	function isAllowed($action='') {
		$this->loadFromDatabase();
		return in_array( $action , $this->mRights );
	}

into this

	function isAllowed($action='', $title = NULL) {
                if( $title == NULL ) {
                        global $wgTitle;
                        $title = $wgTitle;
                }

                $this->loadFromDatabase();

                if( in_array( $action , $this->mRights ) ) {
                        return true;
                }

                // If user wants to edit a talk page and has the talk right, and the subject page exists, allow him to do so...
                if( $action == 'edit' && $title->isTalkPage() && in_array('talk', $this->mRights)) {
                        $subject_page = $title->getSubjectPage();
                        if ($subject_page->exists())
                        {
                                return true;
                        }
                }

                return false;
        }

Alexis




More information about the MediaWiki-l mailing list