=====Check of a page for recent edits===== I mentioned all of this in a response to comments made on another page....I thought I'd post the code so that people could play with it. Basically, if a page has been recently edited (by someone at a different IP....which makes it difficult to see how it works from a test implementation unless you go into the database table and edit the IP to a different one than the one you're at) then two red exclamation marks appear next to the page name at the top. Below is all the different pieces of code....the install was on a 1.1.4.0 version of wikka. It doesn't "lock" the page, just warns if recently edited (not even if still "open"....my interest was in warning about recent activity). Sorry the presentation of the code isn't "fancy" & well-laid out, but it's late and I have to teach tomorrow early in the morning. Here is a graphic of how it looks when it is showing a recent edit.... http://gmbtst.msvu.ca/wikitest/header.jpg (Note that you can't see the brilliant red floating tooltip when you hover over the exclamation marks...produced by the javascript I provided the link for below.) Oh, and there's a similar little "refresh" graphic beside the "edit" link in the footer as well. Have fun. ====TABLE CODE==== %% CREATE TABLE `wikka_usersonline` ( `ip` varchar(15) NOT NULL default '', `expire` int(10) unsigned NOT NULL default '0', `username` varchar(255) NOT NULL default '', `recentpage` varchar(50) NOT NULL default '', `recentpageedittime` int(10) unsigned default NULL, `recentpageeditname` varchar(50) default NULL, UNIQUE KEY `ip` (`ip`) ) TYPE=MyISAM; %% <getPageTag(); $usernameP = $this->GetUserName(); $table = $this->config["table_prefix"].usersonline; $output = "SELECT * FROM ".$table." WHERE recentpageeditname='$thispagename' AND username NOT LIKE '$usernameP' ORDER BY username"; $result = mysql_query($output); while ($row = mysql_fetch_array($result)) { extract ($row); if (($recentpage == $recentpageeditname) && (($expire-$recentpageedittime)<600)) { echo "!!"; echo ""; break; } } ?> %% <GetConfigValue("base_url").$this->MiniHref($method, $tag)."' title=\"Refresh this page to see if editing is safe.\">".$this->config["wakka_name"] ?> : GetPageTag(); ?> %% The wz_tooltip.js (referred to above), which allows "better" tooltips (in this case, more recognizable) is available at http://www.walterzorn.com/tooltip/tooltip_e.htm as a free download....put into actions directory <getPageTag(); $table = $this->config["table_prefix"]."usersonline"; $REMOTE_ADDR = getenv("REMOTE_ADDR"); mysql_query("UPDATE ".$table." SET expire = '".(time()+$time2wait)."', recentpage = '".$thispagenameX."', recentpageedittime = '".(time()+$time2wait)."', recentpageeditname = '".$thispagenameX."' WHERE ip='".$REMOTE_ADDR."'"); echo "
Make sure you save your file at least every 10 Minutes!
"; ?> %% <