Yes, but so far it doesn't work. I don't know, maybe I'm doing something
wrong. Here is my exact code (from the end of LocalSettings.php):
global $wgHooks;
$wgHooks['ParserAfterTidy'][] = 'hideeditlinks';
function hideeditlinks(&$parser, &$text) {
global $wgUser;
if( $wgUser->isAnon() ) {
$text = eregi_replace(
"<a href=[^>]+action=edit[^>]+>([^<]+)</a>",
"<b>\\1</b>",
$text);
}
return true;
}
It doesn't replace anything, in fact I have no idea if it is ever called.
Btw: I am running the most current version of mediawiki (downloaded last
week) and php 4.3.7 using apache for windows on my desktop machine for
testing.
-----Original Message-----
From: mediawiki-l-bounces(a)Wikimedia.org
[mailto:mediawiki-l-bounces@Wikimedia.org] On Behalf Of Rob Church
Sent: Donnerstag, 26. Januar 2006 14:23
To: MediaWiki announcements and site admin list
Subject: Re: [Mediawiki-l] Question about Links
Yes, that's simpler and cleaner. Should have thought of that. :-)
global $wgUser;
if( $wgUser->isAnon() ) {
/* strip things */
}
Rob Church
On 26/01/06, seanizer(a)gmx.net <seanizer(a)gmx.net> wrote:
OK,
I looked into the parser, but fortunately there seems to be an easier way
through hooks. Correct me if I'm wrong, but one way to do it seems to be
to
add a hook to the ParserAfterTidy event
(
http://www.mediawiki.org/wiki/Help:MediaWiki_hooks/ParserAfterTidy), that
replaces
<a href="[^>]+&action=edit">([^<]+)</a>
with
<b>$1</b>
If the user is not logged in. But how do I find out whether he is logged
in?
Do I have access to a user object for the current
user?
Sean
-----Original Message-----
From: mediawiki-l-bounces(a)Wikimedia.org
[mailto:mediawiki-l-bounces@Wikimedia.org] On Behalf Of Rob Church
Sent: Donnerstag, 26. Januar 2006 11:12
To: MediaWiki announcements and site admin list
Subject: Re: [Mediawiki-l] Question about Links
I don't know of a standard hack. You'd want to look at changing the
parser's link section, and disabling the parser cache, which could
lead to a performance drain on a larger site.
Rob Church
On 26/01/06, seanizer(a)gmx.net <seanizer(a)gmx.net> wrote:
> Hello,
>
> I am a new User of mediawiki, and I am planning to put it up on my
martial
arts related
site. Being a wiki newbie, I don't know if and how I can do
the
> following:
> When I write something like [[mypage]] and "mypage" doesn't exist yet,
I
> would like registered users to get a link to the edit screen for mypage
> (standard behaviour), but unregistered readers should receive only an
> emphasized version of "mypage", e.g. <b>mypage</b>. That way,
I could
> include lots of terminology in my site and gradually fill it up with
> contents without going public with dozens of broken links (I know this
is
> not exactly the wiki way, but it is a business
site, and I'd prefer not
> having everybody editing it).
>
> So basically: If a user is logged in, [[mypage]] would translate to <a
> href="/wiki/index.php?title=mypage&action=edit">mypage</a>,
otherwise it
> would translate to <b>mypage</b>. I am a programmer geek :-), so I guess
I
could
eventually come up with a solution for this myself, but I was
wondering if there is a "standardized hack" for such a behavior. Many
thanks
in advance,
Sean Floyd
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l(a)Wikimedia.org
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l(a)Wikimedia.org
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l(a)Wikimedia.org
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l(a)Wikimedia.org
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l