Wikka Mod 025

Type: Feature Addition


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 WakkaAction http://christessmer.com/ahd/wiki/wakka.php?wakka=OwnedPages (archived)

Here's how to install it:

Create actions/ownedpages.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.

There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki