===== Last Edit Action ===== In order to avoid clicking on RecentChanges to know //who// edited a page and //why//, here's an action which prints short lastedit infos in the page body: {{lastedit show="3"}} **Usage** ""{{lastedit}}"" **Optional parameter**: ##show## ""{{lastedit show="0"}}"" //show user only// {{lastedit show="0"}} ""{{lastedit}}"" or ""{{lastedit show="1"}}"" //show user and notes// (default) {{lastedit show="1"}} ""{{lastedit show="2"}}"" //show user, notes, date// {{lastedit show="2"}} ""{{lastedit show="3"}}"" //show user, notes, date and quickdiff link// {{lastedit show="3"}} ==##actions/lastedit.php##== %%(php) method == "show") { $page = $this->page; $pagetag = $page["tag"]; $user = ($this->LoadUser($page["user"]))? $this->Link($page["user"]) : "anonymous"; if (!($show == 0)) { $note = ($page["note"])? ":
".$page["note"]."" : ""; } if ($show == 2 || $show == 3) { list($day, $time) = explode(" ", $page["time"]); $dateformatted = date("D, d M Y", strtotime($day)); $timeformatted = date("H:i T", strtotime($page["time"])); } if ($show == 3) { $oldpage = $this->LoadSingle("SELECT * FROM ".$this->config["table_prefix"]."pages WHERE tag='".$this->GetPageTag()."' AND latest = 'N' ORDER BY time desc LIMIT 1"); $newid = $page["id"]; $oldid = $oldpage["id"]; $difflink = " [Href("diff", $pagetag, "a=".$page["id"]."&b=".$oldpage["id"]."&fastdiff=1")."\">diff]"; } $output = "
Last edited by ".$user.$note."
".$dateformatted." ".$timeformatted.$difflink."
"; print $output; } ?> %% Mods by JsnX: - Removed the line that loaded the current page. The current page is already loaded and stored in $this->page. - Moved test for show method to beginning. There's no point in running through the code if we're not going to do anything. - Oops, thanks: I had made both corrections on my machine and forgot to post the modifications :) ---- CategoryDevelopmentActions