<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Never Use This Font &#187; mediawiki</title>
	<atom:link href="http://neverusethisfont.com/blog/tags/mediawiki/feed/" rel="self" type="application/rss+xml" />
	<link>http://neverusethisfont.com/blog</link>
	<description>Aaron Parecki is the co-founder of Geoloqi.com, and specializes in backend systems development.</description>
	<lastBuildDate>Mon, 11 Jul 2011 22:50:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Hiding text from non-registered users in MediaWiki</title>
		<link>http://neverusethisfont.com/blog/2008/09/hiding-text-from-non-registered-users-in-mediawiki/</link>
		<comments>http://neverusethisfont.com/blog/2008/09/hiding-text-from-non-registered-users-in-mediawiki/#comments</comments>
		<pubDate>Wed, 03 Sep 2008 01:10:33 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[Website Development]]></category>
		<category><![CDATA[mediawiki]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[wiki]]></category>

		<guid isPermaLink="false">http://blog.neverusethisfont.com/2008/09/hiding-text-from-non-registered-users-in-mediawiki/</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>In a semi-private wiki I maintain, we are using whitelisting to make some pages visible to the public but not others. Authentication is done off of an IMAP server, and only registered users have full access tothe wiki. We still run in to the occasional page where most info should be public, but only certain bits should not appear to the public. Things like server passwords, or phone numbers should be hidden except to registered users. I created this plugin so that we can hide bits and pieces of pages from non-registered users, while making the rest of the page public. Just add a &lt;private&gt; tag around the text you want hidden, and you&#8217;re good to go.</p>
<p>Copy this code to a &#8220;extensions/PrivateBlocks.php&#8221;, and add the following line to LocalSettings.php:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'extensions/PrivateBlocks.php'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><span id="more-53"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000088;">$wgExtensionFunctions</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;wfPrivateBlocks&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$wgExtensionCredits</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'parserhook'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'PrivateBlocks'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'author'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Aaron Parecki'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'description'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Adds &lt;nowiki&gt;&lt;private&gt;&lt;/nowiki&gt; tag for hiding text to non-registered users'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'url'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'http://blog.neverusethisfont.com/2008/09/hiding-text-from-non-registered-users-in-mediawiki/'</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> wfPrivateBlocks<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wgParser</span><span style="color: #339933;">;</span>    
    <span style="color: #000088;">$wgParser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setHook</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;private&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;privateBlock&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># The callback function for converting the input text to HTML output
</span><span style="color: #000000; font-weight: bold;">function</span> privateBlock<span style="color: #009900;">&#40;</span><span style="color: #000088;">$input</span><span style="color: #339933;">,</span> <span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'wsUserID'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> 
	<span style="color: #b1b100;">else</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$input</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://neverusethisfont.com/blog/2008/09/hiding-text-from-non-registered-users-in-mediawiki/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

