NP_Updated.php

Display a list with the latest updated blogs.

General Plugin info
Author: Rodrigo Moraes
Current Version: 0.1
Download: -
Code: plugin_code
Demo: -
Forum Thread: here

Instructions

  1. Save the code below as NP_Updated.php and upload it to your plugins directory.
  2. Install the plugin.
  3. Put <%Updated%> in your skin.
  4. Done!

Plugin code

<?php
class NP_Updated extends NucleusPlugin {
	function getName() { return 'Updated'; }
	function getAuthor()  { return 'Rodrigo Moraes'; }
	function getURL() {	return 'http://www.tipos.com.br/'; }
	function getVersion() {	return '0.1'; }
    function supportsFeature($SqlTablePrefix) {	return 1; }
	function getDescription() { return 'Show a list with the latest updated blogs.'; }
 
	function doSkinVar($skinType) {
	global $blog, $member;
 
		$timeNow = $blog->getCorrectTime();
 
		$query = "SELECT iblog, iauthor, itime FROM ".sql_table('item')." where idraft = 0 and itime<=". mysqldate($timeNow) ." ORDER BY itime DESC limit 60";
		$res = mysql_query($query);
 
		$updated = 1;
		while(($row = mysql_fetch_object($res)) && ($updated <= 30)) {
			$iblog = $row->iblog;
			$iauthor = $row->iauthor;
			$dateformat = date("d.m | H:i", strtotime($row->itime));
 
			$mem = new MEMBER;
			$mem->readFromID(intval($row->iauthor));
			$author = $mem->getDisplayName(); 
 
			$blogname = getBlogNameFromID($iblog);
			$blogname = htmlentities($blogname);
			$blogname = str_replace("'",'&#8217;',$blogname);
 
			if (!$iauthorcopy[$iauthor]) {
				$bloglink = createBlogLink($iblog, '');
				echo "<a href=\"".$bloglink."\" title=\"$blogname\">";
				echo $author." - ".$dateformat;
				echo "</a><br />";
 
				$updated++;
				$iauthorcopy[$iauthor] = $iauthor; 
			}
		}
	} // doSkinVar
} // class
?>

History

version 0.1: initial release (although I have been using it for years :-P).

Feedback

Post bug reports and suggestions here at the Nucleus forum: http://forum.nucleuscms.org/viewtopic.php?t=4833

updated.txt · Last modified: 2006/07/05 13:03 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki