forumObj = new e107forum; $this->plugPref = e107::pref('forum'); // general forum preferences. $this->menuPref = e107::getMenu()->pref();// ie. popup config details from within menu-manager. $this->render(); } function getQuery() { $max_age = vartrue($this->menuPref['maxage'], 0); $max_age = ($max_age == 0) ? '' : '(p.post_datestamp > '.(time()-(int)$max_age*86400).') AND '; $forumList = implode(',', $this->forumObj->getForumPermList('view')); $qry = " SELECT p.post_user, p.post_id, p.post_datestamp, p.post_user_anon, p.post_entry, t.thread_id, t.thread_datestamp, t.thread_name, u.user_id, u.user_name, u.user_image, u.user_currentvisit, f.forum_sef FROM `#forum_post` as p LEFT JOIN `#forum_thread` AS t ON t.thread_id = p.post_thread LEFT JOIN `#forum` as f ON f.forum_id = t.thread_forum_id LEFT JOIN `#user` AS u ON u.user_id = p.post_user WHERE {$max_age} p.post_forum IN ({$forumList}) ORDER BY p.post_datestamp DESC LIMIT 0, ".vartrue($this->menuPref['display'],10); return $qry; } // TODO: cache menu. function render() { $tp = e107::getParser(); $sql = e107::getDb('nfp'); $pref = e107::getPref(); $qry = $this->getQuery(); $ns = e107::getRender(); $list = null; $text = null; if($results = $sql->gen($qry)) { if($tp->thumbWidth() > 250) // Fix for unset image size. { $tp->setThumbSize(40,40,true); } $list = "
"; $text = $list; } else { $text = LAN_FORUM_MENU_002; } if(!empty($this->menuPref['caption'])) { $caption = !empty($this->menuPref['caption'][e_LANGUAGE]) ? $this->menuPref['caption'][e_LANGUAGE] : $this->menuPref['caption']; } else { $caption = LAN_PLUGIN_FORUM_LATESTPOSTS; } // e107::debug('menuPref', $this->menuPref); $ns->tablerender($caption, $text, 'nfp_menu'); } } new forum_newforumposts_menu;