I don't understand how this works with $wgLocalDatabases in order to set user rights on other wikis I operate. Is there a step-by-step guide and preequisites? Does the database username and password have to be the same on all? Does the Makesysop extension need to be installed on all wikis? Please help if you can.
Thanks.
Gary Kirk wrote:
I don't understand how this works with $wgLocalDatabases in order to set user rights on other wikis I operate. Is there a step-by-step guide and preequisites? Does the database username and password have to be the same on all? Does the Makesysop extension need to be installed on all wikis? Please help if you can.
It's a bit of a freaky hack, so it's not well documented. :)
Roughly...
* Database username and password should be the same. * Avoid using table prefixes, they probably would explode. * List all controllable database names in $wgLocalDatabases array. * If not all databases are on the same server, add entries to $wgAlternateMaster indicating which dbs are on which hosts. * Makesysop extension should be enabled at least available at a master location, but doesn't necessarily have to be everywhere.
Good luck!
-- brion vibber (brion @ wikimedia.org)
On 06/09/07, Brion Vibber brion@wikimedia.org wrote:
Gary Kirk wrote:
I don't understand how this works with $wgLocalDatabases in order to set user rights on other wikis I operate. Is there a step-by-step guide and preequisites? Does the database username and password have to be the
same on
all? Does the Makesysop extension need to be installed on all wikis? Please help if you can.
It's a bit of a freaky hack, so it's not well documented. :)
Roughly...
- Database username and password should be the same.
- Avoid using table prefixes, they probably would explode.
- List all controllable database names in $wgLocalDatabases array.
- the value listed in $wgDBname in the other wiki's LocalSettings.php?
* If not all databases are on the same server, add entries to
$wgAlternateMaster indicating which dbs are on which hosts.
- Makesysop extension should be enabled at least available at a master
location, but doesn't necessarily have to be everywhere.
Good luck!
-- brion vibber (brion @ wikimedia.org)
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
OK, in wiki1 where Makesysop is installed and shares the DB username and password I have: $wgLocalDatabases = array('gkirk_mwSVN' => 'garykirk'); where gkirk_mwSVN is the name of the database of wiki2. On wiki1 at Special:Makesysop I type Test2@garykirk and get:
*User rights for "Test2@garykirk" could not be set. (Did you enter the name correctly?)*
On 06/09/07, Gary Kirk gary.kirk@gmail.com wrote:
On 06/09/07, Brion Vibber brion@wikimedia.org wrote:
Gary Kirk wrote:
I don't understand how this works with $wgLocalDatabases in order to
set
user rights on other wikis I operate. Is there a step-by-step guide
and
preequisites? Does the database username and password have to be the
same on
all? Does the Makesysop extension need to be installed on all wikis? Please help if you can.
It's a bit of a freaky hack, so it's not well documented. :)
Roughly...
- Database username and password should be the same.
- Avoid using table prefixes, they probably would explode.
- List all controllable database names in $wgLocalDatabases array.
- the value listed in $wgDBname in the other wiki's LocalSettings.php?
- If not all databases are on the same server, add entries to
$wgAlternateMaster indicating which dbs are on which hosts.
- Makesysop extension should be enabled at least available at a master
location, but doesn't necessarily have to be everywhere.
Good luck!
-- brion vibber (brion @ wikimedia.org )
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
-- Gary Kirk
Oh hold on. How do I make myself in to part of the group "stewards"?
On 06/09/07, Gary Kirk gary.kirk@gmail.com wrote:
OK, in wiki1 where Makesysop is installed and shares the DB username and password I have: $wgLocalDatabases = array('gkirk_mwSVN' => 'garykirk'); where gkirk_mwSVN is the name of the database of wiki2. On wiki1 at Special:Makesysop I type Test2@garykirk and get:
*User rights for "Test2@garykirk" could not be set. (Did you enter the name correctly?)*
On 06/09/07, Gary Kirk gary.kirk@gmail.com wrote:
On 06/09/07, Brion Vibber <brion@wikimedia.org > wrote:
Gary Kirk wrote:
I don't understand how this works with $wgLocalDatabases in order to
set
user rights on other wikis I operate. Is there a step-by-step guide
and
preequisites? Does the database username and password have to be the
same on
all? Does the Makesysop extension need to be installed on all wikis? Please help if you can.
It's a bit of a freaky hack, so it's not well documented. :)
Roughly...
- Database username and password should be the same.
- Avoid using table prefixes, they probably would explode.
- List all controllable database names in $wgLocalDatabases array.
- the value listed in $wgDBname in the other wiki's LocalSettings.php?
- If not all databases are on the same server, add entries to
$wgAlternateMaster indicating which dbs are on which hosts.
- Makesysop extension should be enabled at least available at a master
location, but doesn't necessarily have to be everywhere.
Good luck!
-- brion vibber (brion @ wikimedia.org )
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
-- Gary Kirk
-- Gary Kirk
On 06/09/07, Gary Kirk gary.kirk@gmail.com wrote:
Oh hold on. How do I make myself in to part of the group "stewards"?
The account you created during installation should already be a crat and can give permissions to anyone on the local wiki.
Ah, maybe I was using my non-crat account? I'll check, thanks :).
On 9/6/07, Thomas Dalton thomas.dalton@gmail.com wrote:
On 06/09/07, Gary Kirk gary.kirk@gmail.com wrote:
Oh hold on. How do I make myself in to part of the group "stewards"?
The account you created during installation should already be a crat and can give permissions to anyone on the local wiki.
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
I used a 'crat account and at Special:Userrights was told the action I requested was limited to the group 'Stewards'.
On 9/6/07, Gary Kirk gary.kirk@gmail.com wrote:
Ah, maybe I was using my non-crat account? I'll check, thanks :).
On 9/6/07, Thomas Dalton thomas.dalton@gmail.com wrote:
On 06/09/07, Gary Kirk gary.kirk@gmail.com wrote:
Oh hold on. How do I make myself in to part of the group "stewards"?
The account you created during installation should already be a crat and can give permissions to anyone on the local wiki.
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
-- Gary Kirk
On 06/09/07, Gary Kirk gary.kirk@gmail.com wrote:
I used a 'crat account and at Special:Userrights was told the action I requested was limited to the group 'Stewards'.
Only stewards can appoint stewards? That could be an issue. You might need to change something in LocalSettings.php.
On 06/09/07, Thomas Dalton thomas.dalton@gmail.com wrote:
On 06/09/07, Gary Kirk gary.kirk@gmail.com wrote:
I used a 'crat account and at Special:Userrights was told the action I requested was limited to the group 'Stewards'.
Only stewards can appoint stewards? That could be an issue. You might need to change something in LocalSettings.php.
I've just checked. The default seems to be to let crats do whatever they like. Have you set $wgAddGroups in LocalSettings.php? If so, you'll need to add steward to the array.
On 06/09/07, Gary Kirk gary.kirk@gmail.com wrote:
Ah, maybe I was using my non-crat account? I'll check, thanks :).
Remember, you want Special:Userrights, not Special:Makesysop.
On 06/09/07, Thomas Dalton thomas.dalton@gmail.com wrote:
On 06/09/07, Gary Kirk gary.kirk@gmail.com wrote:
Ah, maybe I was using my non-crat account? I'll check, thanks :).
Remember, you want Special:Userrights, not Special:Makesysop.
The Makesysop extension disables Special:Userrights for non-stewards. You need to grant yourself steward rights in advance via direct manipulation of the user_rights table in the database.
Rob Church
The Makesysop extension disables Special:Userrights for non-stewards. You need to grant yourself steward rights in advance via direct manipulation of the user_rights table in the database.
Ah. It should say that on http://www.mediawiki.org/wiki/Extension:Makesysop
Can usernames be changed? I know users cannot be deleted and I do not want to do that, but we have a situation where the authentication mechanism is moving from local accounts created in the wiki to an external authentication mechanism, so, for example, user "joe" is user "joed" in the external authentication mechanism. Is there a way to change the user "joe" to "joed" in the wiki database? The page histories can show either user ID, that is not important. Also, I'll need to set all the user passwords to null. I suspect I'll need to do that through an SQL routine but if there is a better way...
Thanks in advance for any help or ideas...
-Jim
Bureaucrats can remand users if you install the Renameuser extension from mediawiki.org/wiki/Extension:Renameuser Hope this helps, I don't know about passwords. Gary
On 9/6/07, Sullivan, James (NIH/CIT) [C] sullivan@mail.nih.gov wrote:
Can usernames be changed? I know users cannot be deleted and I do not want to do that, but we have a situation where the authentication mechanism is moving from local accounts created in the wiki to an external authentication mechanism, so, for example, user "joe" is user "joed" in the external authentication mechanism. Is there a way to change the user "joe" to "joed" in the wiki database? The page histories can show either user ID, that is not important. Also, I'll need to set all the user passwords to null. I suspect I'll need to do that through an SQL routine but if there is a better way...
Thanks in advance for any help or ideas...
-Jim
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Apologies, I meant rename not remand :S.
On 9/6/07, Gary Kirk gary.kirk@gmail.com wrote:
Bureaucrats can remand users if you install the Renameuser extension from mediawiki.org/wiki/Extension:Renameuser Hope this helps, I don't know about passwords. Gary
On 9/6/07, Sullivan, James (NIH/CIT) [C] sullivan@mail.nih.gov wrote:
Can usernames be changed? I know users cannot be deleted and I do not want to do that, but we have a situation where the authentication mechanism is moving from local accounts created in the wiki to an external authentication mechanism, so, for example, user "joe" is user "joed" in the external authentication mechanism. Is there a way to change the user "joe" to "joed" in the wiki database? The page histories can show either user ID, that is not important. Also, I'll need to set all the user passwords to null. I suspect I'll need to do that through an SQL routine but if there is a better way...
Thanks in advance for any help or ideas...
-Jim
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
-- Gary Kirk
On 06/09/07, Sullivan, James (NIH/CIT) [C] sullivan@mail.nih.gov wrote:
Can usernames be changed? I know users cannot be deleted and I do not want to do that, but we have a situation where the authentication mechanism is moving from local accounts created in the wiki to an external authentication mechanism, so, for example, user "joe" is user "joed" in the external authentication mechanism. Is there a way to change the user "joe" to "joed" in the wiki database? The page histories can show either user ID, that is not important. Also, I'll need to set all the user passwords to null. I suspect I'll need to do that through an SQL routine but if there is a better way...
The RenameUser extension is the "correct" method to rename user accounts and update all the various page histories, etc. You'd need to resort to a bit of manual SQL to reset the passwords, though.
Rob Church
Hello list,
I want to show a different page content depending on the login state of an user, i.e. similar to extension ParserFunctions {{#If <user is logged in> | content for logged in users | content for unknown users }}
Is there any possibility to determine from within a wiki page if an user is logged on or not?
If the user is logged in, I want to address this user with the real/login name.
I remember there's at least a solution for part 2 of my question. But I can't find it.
I'm using wikis with version 1.6.10, 1.9.x, 1.10.x.
Thanks for your help
Wolfgang
$wgUser->isLoggedIn()
but you'll run into page caching issues.
Jim
On Oct 4, 2007, at 5:23 AM, Schmid, Wolfgang wrote:
Hello list,
I want to show a different page content depending on the login state of an user, i.e. similar to extension ParserFunctions {{#If <user is logged in> | content for logged in users | content for unknown users }}
Is there any possibility to determine from within a wiki page if an user is logged on or not?
If the user is logged in, I want to address this user with the real/login name.
I remember there's at least a solution for part 2 of my question. But I can't find it.
I'm using wikis with version 1.6.10, 1.9.x, 1.10.x.
Thanks for your help
Wolfgang
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
===================================== Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054
There is a way to deal 'parser cache' issue with this: [[Extension:ParserPhase2]] jld.
Jim Hu wrote:
$wgUser->isLoggedIn()
but you'll run into page caching issues.
Jim
On Oct 4, 2007, at 5:23 AM, Schmid, Wolfgang wrote:
Hello list,
I want to show a different page content depending on the login state of an user, i.e. similar to extension ParserFunctions {{#If <user is logged in> | content for logged in users | content for unknown users }}
Is there any possibility to determine from within a wiki page if an user is logged on or not?
If the user is logged in, I want to address this user with the real/login name.
I remember there's at least a solution for part 2 of my question. But I can't find it.
I'm using wikis with version 1.6.10, 1.9.x, 1.10.x.
Thanks for your help
Wolfgang
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
===================================== Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
@Jim what you propose is a php based solution but I'm a beginner in php programming and I'm looking for a wiki based solution without programming own php code if possible.
@Jean-Lou I took a look at your Extension:ParserPhase2, but I don't understand how to use it to solve my problem. Could you send me a short example. There's another problem too, this extention works with MW 1.10, 1.11, but I'm using some older wikis with version 1.6 (php4) and 1.9.x. Does this extentsion need php5 and did you try to implement it under older wiki versions?
-----Original Message----- From: Jean-Lou Dupont [mailto:jeanlou.dupont@gmail.com] Sent: Thursday, October 04, 2007 7:11 PM To: MediaWiki announcements and site admin list Subject: Re: [Mediawiki-l] Conditional page content depending on user is logged in or not
There is a way to deal 'parser cache' issue with this: [[Extension:ParserPhase2]] jld.
Jim Hu wrote:
$wgUser->isLoggedIn()
but you'll run into page caching issues.
Jim
On Oct 4, 2007, at 5:23 AM, Schmid, Wolfgang wrote:
Hello list,
I want to show a different page content depending on the login state of an user, i.e. similar to extension ParserFunctions {{#If <user is logged in> | content for logged in users |
content for
unknown users }}
Is there any possibility to determine from within a wiki
page if an
user is logged on or not?
If the user is logged in, I want to address this user with the real/login name.
I remember there's at least a solution for part 2 of my question. But I can't find it.
I'm using wikis with version 1.6.10, 1.9.x, 1.10.x.
Thanks for your help
Wolfgang
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
===================================== Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Yes it need PHP5. sorry, Jean-Lou Dupont.
Schmid, Wolfgang wrote:
@Jim what you propose is a php based solution but I'm a beginner in php programming and I'm looking for a wiki based solution without programming own php code if possible.
@Jean-Lou I took a look at your Extension:ParserPhase2, but I don't understand how to use it to solve my problem. Could you send me a short example. There's another problem too, this extention works with MW 1.10, 1.11, but I'm using some older wikis with version 1.6 (php4) and 1.9.x. Does this extentsion need php5 and did you try to implement it under older wiki versions?
-----Original Message----- From: Jean-Lou Dupont [mailto:jeanlou.dupont@gmail.com] Sent: Thursday, October 04, 2007 7:11 PM To: MediaWiki announcements and site admin list Subject: Re: [Mediawiki-l] Conditional page content depending on user is logged in or not
There is a way to deal 'parser cache' issue with this: [[Extension:ParserPhase2]] jld.
Jim Hu wrote:
$wgUser->isLoggedIn()
but you'll run into page caching issues.
Jim
On Oct 4, 2007, at 5:23 AM, Schmid, Wolfgang wrote:
Hello list,
I want to show a different page content depending on the login state of an user, i.e. similar to extension ParserFunctions {{#If <user is logged in> | content for logged in users |
content for
unknown users }}
Is there any possibility to determine from within a wiki
page if an
user is logged on or not?
If the user is logged in, I want to address this user with the real/login name.
I remember there's at least a solution for part 2 of my question. But I can't find it.
I'm using wikis with version 1.6.10, 1.9.x, 1.10.x.
Thanks for your help
Wolfgang
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
===================================== Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
I can upgrade wikis from 1.9 to 1.10 (not the 1.6). If this is done how can I use this extension for these wikis to fulfill my desire?
-----Original Message----- From: Jean-Lou Dupont [mailto:jeanlou.dupont@gmail.com] Sent: Friday, October 05, 2007 1:19 PM To: MediaWiki announcements and site admin list Subject: Re: [Mediawiki-l] Conditional page content depending on user is logged in or not
Yes it need PHP5. sorry, Jean-Lou Dupont.
Schmid, Wolfgang wrote:
@Jim what you propose is a php based solution but I'm a beginner in php programming and I'm looking for a wiki based solution without programming own php code if possible.
@Jean-Lou I took a look at your Extension:ParserPhase2, but I don't
understand
how to use it to solve my problem. Could you send me a short example. There's another problem too, this extention works with MW
1.10, 1.11,
but I'm using some older wikis with version 1.6 (php4) and 1.9.x. Does this extentsion need php5 and did you try to implement it under older wiki versions?
-----Original Message----- From: Jean-Lou Dupont [mailto:jeanlou.dupont@gmail.com] Sent: Thursday, October 04, 2007 7:11 PM To: MediaWiki announcements and site admin list Subject: Re: [Mediawiki-l] Conditional page content depending on user is logged in or not
There is a way to deal 'parser cache' issue with this: [[Extension:ParserPhase2]] jld.
Jim Hu wrote:
$wgUser->isLoggedIn()
but you'll run into page caching issues.
Jim
On Oct 4, 2007, at 5:23 AM, Schmid, Wolfgang wrote:
Hello list,
I want to show a different page content depending on the login state of an user, i.e. similar to extension ParserFunctions {{#If <user is logged in> | content for logged in users |
content for
unknown users }}
Is there any possibility to determine from within a wiki
page if an
user is logged on or not?
If the user is logged in, I want to address this user with the real/login name.
I remember there's at least a solution for part 2 of my
question.
But I can't find it.
I'm using wikis with version 1.6.10, 1.9.x, 1.10.x.
Thanks for your help
Wolfgang
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
===================================== Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Schmid, Wolfgang wrote:
@Jim what you propose is a php based solution but I'm a beginner in php programming and I'm looking for a wiki based solution without programming own php code if possible.
The following code included from LocalSettigns.php would do:
$wgExtensionFunctions[] = 'wfIsLoggedFunctions';
function wfIsLoggedFunctions() { global $wgParser, $wgExtIsLoggedFunctions;
$wgExtIsLoggedFunctions = new ExtIsLoggedFunctions();
$wgParser->setFunctionHook( 'iflogged', array( &$wgExtIsLoggedFunctions , 'ifLogged' ) ); $wgParser->setFunctionHook( 'islogged', array( &$wgExtIsLoggedFunctions , 'isLogged' ) );
}
class wgExtIsLoggedFunctions { function ifLogged( &$parser, $then = '', $else = '' ) { global $wgUser; $parser->disableCache(); if ($wgUser->isLoggedIn()) { return $then; } else { return $else; } }
function isLogged( &$parser, $then = '', $else = '' ) { global $wgUser; $parser->disableCache(); return $wgUser->isLoggedIn(); } }
?>
Usage: {{#iflogged: Congratulations, you're a registered user.|You're anonymous. Go to create an account!}}
I also added #islogged to return the raw boolean value.
I think this is really what I want.
I added this 'extension' on test installations MW 1.8.2 and 1.11.0. Both wikis are installed on a windows host.
Calling the wikis results in the following php warning: Warning: array_slice() [function.array-slice]: The first argument should be an array in ...\languages\Language.php on line 1153 (for MW 1.11.0)
This warning occurs in function getMagic: function getMagic( &$mw ) { ... line 1153: $mw->mSynonyms = array_slice( $rawEntry, 1 ); }
Creating a test page with {{#iflogged: A | B }} the 'iflogged' function is not recognized but treated as normal text. Therefore it doesn't show the wanted result 'A' or 'B' but the raw page content '{{#iflogged: A | B }}'.
May be there's something missing in the code. Do you have further hints what's going wrong.
-----Original Message----- From: Platonides [mailto:Platonides@gmail.com] Sent: Saturday, October 06, 2007 11:41 PM To: mediawiki-l@lists.wikimedia.org Subject: Re: [Mediawiki-l] Conditional page content depending on user is logged in or not
Schmid, Wolfgang wrote:
@Jim what you propose is a php based solution but I'm a beginner in php programming and I'm looking for a wiki based solution without programming own php code if possible.
The following code included from LocalSettigns.php would do:
$wgExtensionFunctions[] = 'wfIsLoggedFunctions';
function wfIsLoggedFunctions() { global $wgParser, $wgExtIsLoggedFunctions;
$wgExtIsLoggedFunctions = new ExtIsLoggedFunctions(); $wgParser->setFunctionHook( 'iflogged', array(
&$wgExtIsLoggedFunctions , 'ifLogged' ) ); $wgParser->setFunctionHook( 'islogged', array( &$wgExtIsLoggedFunctions , 'isLogged' ) );
}
class wgExtIsLoggedFunctions { function ifLogged( &$parser, $then = '', $else = '' ) { global $wgUser; $parser->disableCache(); if ($wgUser->isLoggedIn()) { return $then; } else { return $else; } }
function isLogged( &$parser, $then = '', $else = '' ) { global $wgUser; $parser->disableCache(); return $wgUser->isLoggedIn(); }
}
?>
Usage: {{#iflogged: Congratulations, you're a registered user.|You're anonymous. Go to create an account!}}
I also added #islogged to return the raw boolean value.
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
The magic words has to define still
$wgHooks['LanguageGetMagic'][] = 'wfIsLoggedFunctionsMagic';
function wfIsLoggedFunctionsMagic( &$magicWords, $langCode ) { $magicWords['iflogged'] = array(0,'iflogged'); $magicWords['islogged'] = array(0,'islogged'); return true; }
Now it works as desired.
-----Original Message----- From: Schmid, Wolfgang Sent: Monday, October 08, 2007 10:12 AM To: mediawiki-l@lists.wikimedia.org Subject: Re: [Mediawiki-l] Conditional page content depending on user islogged in or not
I think this is really what I want.
I added this 'extension' on test installations MW 1.8.2 and 1.11.0. Both wikis are installed on a windows host.
Calling the wikis results in the following php warning: Warning: array_slice() [function.array-slice]: The first argument should be an array in ...\languages\Language.php on line 1153 (for MW 1.11.0)
This warning occurs in function getMagic: function getMagic( &$mw ) { ... line 1153: $mw->mSynonyms = array_slice( $rawEntry, 1 ); }
Creating a test page with {{#iflogged: A | B }} the 'iflogged' function is not recognized but treated as normal text. Therefore it doesn't show the wanted result 'A' or 'B' but the raw page content '{{#iflogged: A | B }}'.
May be there's something missing in the code. Do you have further hints what's going wrong.
-----Original Message----- From: Platonides [mailto:Platonides@gmail.com] Sent: Saturday, October 06, 2007 11:41 PM To: mediawiki-l@lists.wikimedia.org Subject: Re: [Mediawiki-l] Conditional page content depending on user is logged in or not
Schmid, Wolfgang wrote:
@Jim what you propose is a php based solution but I'm a beginner in php programming and I'm looking for a wiki based solution without programming own php code if possible.
The following code included from LocalSettigns.php would do:
$wgExtensionFunctions[] = 'wfIsLoggedFunctions';
function wfIsLoggedFunctions() { global $wgParser, $wgExtIsLoggedFunctions;
$wgExtIsLoggedFunctions = new ExtIsLoggedFunctions(); $wgParser->setFunctionHook( 'iflogged', array(
&$wgExtIsLoggedFunctions , 'ifLogged' ) ); $wgParser->setFunctionHook( 'islogged', array( &$wgExtIsLoggedFunctions , 'isLogged' ) );
}
class wgExtIsLoggedFunctions { function ifLogged( &$parser, $then = '', $else = '' ) { global $wgUser; $parser->disableCache(); if ($wgUser->isLoggedIn()) { return $then; } else { return $else; } }
function isLogged( &$parser, $then = '', $else = '' ) { global $wgUser; $parser->disableCache(); return $wgUser->isLoggedIn(); }
}
?>
Usage: {{#iflogged: Congratulations, you're a registered user.|You're anonymous. Go to create an account!}}
I also added #islogged to return the raw boolean value.
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Gary Kirk wrote:
OK, in wiki1 where Makesysop is installed and shares the DB username and password I have: $wgLocalDatabases = array('gkirk_mwSVN' => 'garykirk');
Wikis are identified by the database name.
Try: $wgLocalDatabases = array('gkirk_mwSVN');
where gkirk_mwSVN is the name of the database of wiki2. On wiki1 at Special:Makesysop I type Test2@garykirk and get:
*User rights for "Test2@garykirk" could not be set. (Did you enter the name correctly?)*
Test2@gkirk_mwSVN
That mixed case might give you trouble, too.
- -- brion @ wikimedia.org)
mediawiki-l@lists.wikimedia.org