Wiki source for Mod025fOwnedPages


Show raw source

==== Wikka Mod 025 ====
Type: Feature Addition
----
===Credit:===
**[[http://web.archive.org/web/20040820215257/http://www.wakkawiki.com/ChrisTessmer | ChrisTessmer]]**
[[http://web.archive.org/web/20040823065613/http://www.wakkawiki.com/OwnedPages | OwnedPages @ WakkaWiki]]
----

OwnedPages is an action that lets your users check how many pages they own. It's a fun little tool that users enjoy, even though the data is absolutely meaningless if you think about it (who cares how many pages you own; on a wiki, it's how much and how well you contribute that counts). A comparative ranking version of this idea is found in the HighScores action.

You can see this [[http://web.archive.org/web/20040811013910/http://www.wakkawiki.com/WakkaActions | WakkaAction]] [[http://web.archive.org/web/20040823123754/http://christessmer.com/ahd/wiki/wakka.php?wakka=OwnedPages | http://christessmer.com/ahd/wiki/wakka.php?wakka=OwnedPages]] //(archived)//
~&This wiki is no longer publicly accessible; the only access I could get was at the root: http://christessmer.com/; link changed to archived version --JavaWoman

== Here's how to install it: ==

Create ''actions/ownedpages.php'':

%%(php)
<?php
# ownedpages.php {{OwnedPages}}
# author: Chris Tessmer
# date: 19 Dec 2002
# license: [[GPL]]

$str = 'SELECT COUNT(*) FROM '.$this->config["table_prefix"].'pages WHERE `owner` ';
$str .= "= '" . $this->UserName() . "' AND `latest` = 'Y' AND `comment_on` = '' ";
$countQuery = $this->Query( $str );

# get the total # of pages
$str = 'SELECT COUNT(*) FROM '.$this->config["table_prefix"].'pages WHERE `latest` = \'Y\' AND `comment_on` = \'\' ';
$totalQuery = $this->Query( $str );

$count = mysql_result($countQuery, 0);
$total = mysql_result($totalQuery, 0);

$percent = round( ($count/$total )*100, 2 ) ;

print( "You own <strong>$count</strong> pages out of the <strong>$total</strong> pages on this Wiki.");
print( "<br>That means you own <strong>$percent%</strong> of the total." );
?>
%%

To use it, just type ##""{{OwnedPages}}""## wherever you want the information to show up.

--[[http://web.archive.org/web/20040820215257/http://www.wakkawiki.com/ChrisTessmer | ChrisTessmer]]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki