Extension:Guestbook

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced.svg
Guestbook
Release status: unmaintained
Implementation Special page
Description Adds a guestbook as a special page.
Author(s) Tino Reichardt
Latest version 0.17a (2013-09-28)
MediaWiki 1.6.0+
License GNU General Public License 2.0
Download gbook.tar.bz2
README
Translate the Guestbook extension if it is available at translatewiki.net
Check usage and version matrix.

This Guestbook' extension adds a guestbook to your wiki installation.

It uses the following user preferences:

  • language of currently logged in user
  • the guestbook entry count per page is defined with the setting of:
preferences -> search -> Hits per page

Installation

The installation requires following steps:

  1. extracting gbook.tar.gz to "$wiki/extensions/"
  2. enabling the extension in LocalSettings.php
  3. integrate Special:Guestbook into the MediaWiki:Sidebar or create some link

Installing the files

change to the /extensions/ directory

cd /home/www/example.org/Wiki/extensions/

download the tarball:

wget http://www.mcmilk.de/projects/wiki-gbook/dl/gbook.tar.bz2

extract the archiv and delete it:

tar xjvf gbook.tar.bz2
rm -f gbook.tar.bz2

Adjust LocalSettings.php

Add this line at the end of LocalSettings.php:

require_once("extensions/gbook/gbook.php");

You can also adjust the moderating rights for the guestbook to some user groups. The default defines, that the user of the group sysop have the ability to moderate/delete guestbook entries. As default exist this setting in gbook.php.

$wgGroupPermissions['sysop']['gbook'] = true;

Adjust variables in gbook.php

You can adjust several variables in the beginning of the file gbook.php. Each one is elucidated with a comment:

/* if set to false, no captcha is needed! */
$want_captcha = true;

/**
 * when these two variables are set, google's re-captcha is used, in favor
 * of the included captcha class (captcha-class.php)
 */
//$recaptcha_pubkey  = "aWNoIGJpbiBrZWluIGtvcnJla3RlciBwdWJrZXkK";
//$recaptcha_privkey = "aWNoIGJpbiBrZWluIGtvcnJla3RlciBwcnZrZXkK";

/* you can define the number of entries per page here */
$EntriesPerPage = 8; /* default: $wgUser->getOption('rows'); */

/* mostly '&' or '?' */
$GetRequestSeperator = "?";

/* bad data (will be ignored or replaced) */
$BadRequestStrings = array("<", ">", "%");

/* define here some regex for catching spammers */
$wgSpamRegex = "/(naughty|spam|viagra)/i";

/* you can specify multiple guestbook aliases here */
//$GuestbookHeadline['1'] = "first special headline"; /* gbReplyto=-1 */
//$GuestbookAlias['book1'] = 1; // -> .../Special:Guestbook/book1
//$GuestbookAlias['lala'] = 1; // -> .../Special:Guestbook/lala

//$GuestbookHeadline['2'] = "SECONDS special headline"; /* gbReplyto=-2 */
//$GuestbookAlias['lalü2'] = 2; // -> .../Special:Guestbook/blubb
//$GuestbookAlias['blubb'] = 3; /* gbReplyto=-3 */

/* gbReplyto=-3 */
$GuestbookMaxID = 3;

/* sysops can moderate the guestbook */
$wgGroupPermissions['sysop']['gbook'] = true;

Linking the Special:Guestbook

The guestbook is a special page, which is not shown is the Special:Specialpages overview. You can create a link to the guestbook with [[Special:Guestbook]]... that's it ;)

Styling

The guestbook uses the following css styles:

  • class successbox (creating a new entry was successful)
  • class errorbox (for all error messages)
  • class visualClear (directly after some error/success box)
  • class gbook
    • DIV Layer, which will be used around each entry
    • the class gbook is is defined in "$wiki/extensions/gbook.css" and should be adjusted
    • $wiki/extensions/gbook1.css will override the default style for the first guestbook, you can use this feature, if you have more then one guestbook

Problems / FAQ

The Captcha isn't shown or some error message is there.

  • this problem was reported by a lot of users
  • it isn't the guestbook, its a missing function within PHP
  • solution: build PHP yourself or install the appropriate GD package of your distribution

Links