'number of items to display');
var $default_context = LP_CONTEXT_AUTHOR;
var $description = 'Modify the posts\' appearance in author\'s pages';
var $active = true;
var $hooks = array('get_posts', 'parse_post');
var $posts_per_page = 30;
function AuthorIndex(&$frontend, $args, $dummy_run=false) {
$this->LightPressPlugin($frontend, $args, $dummy_run);
if (!$dummy_run) {
$this->posts_per_page = (int)$this->posts_per_page;
if ($frontend->context['type'] != 'author' || basename($_SERVER['PHP_SELF']) == 'feed.php') {
$this->active = false;
return;
}
$frontend->options['posts_per_page'] = $this->posts_per_page;
$tpl =& $frontend->tpl;
$db =& $frontend->db;
$db->query("select * from " . $frontend->tables['users'] . " where user_login='" . $frontend->context['filter'] . "'");
if ($db->count > 0) { // grab the first one, better than having none
$row =& $db->next();
$contacts = array();
if (isset($row['user_url']) && !empty($row['user_url']) && $row['user_url'] != 'http://')
$contacts[] = '' . $row['user_url'] . '';
if (isset($row['user_email']) && !empty($row['user_email']))
$contacts[] = '' . $row['user_email'] . '';
if (isset($row['user_icq']) && !empty($row['user_icq']))
$contacts[] = 'ICQ# ' . $row['user_icq'];
$row['user_contacts'] = implode(' ~ ', $contacts);
$tpl->setVar($row);
// build the feed URL
$context_url = $frontend->context['url'];
if ($frontend->raw_urls)
$feed_url = str_replace('index.php', 'feed.php', $context_url);
else
$feed_url = $context_url . '/rss2.xml';
$tpl->setVar('user_feed_url', $feed_url);
} else {
$this->hide();
}
}
}
function hide() {
$this->_frontend->tpl->setBlock('index', 'user_details');
$this->_frontend->tpl->setVar('USER_DETAILS', '');
}
function run($hook, &$post) {
if ($hook == 'get_posts')
return;
$content = '';
foreach (explode(' ', strip_tags($post['post_content'])) as $word) {
if (strlen("$content $word") > 204)
break;
$content .= " $word";
}
$post['post_content'] = $content;
$post['user_num_posts'] = $this->_frontend->num_posts;
}
}
?>