I have upgraded to IPB 4.6.2 and one of my custom script needs to get updated... After upgrade it is not working anymore... (Take latest 10 post and displays)
I need help
<?php
/////////////////////////////
// User Editable variables //
/////////////////////////////
// Change this to the number of posts you would like to show.
$numberOfPosts = 10;
// If you would like this mod to cut topics after a certain character length, leave this at 1. Otherwise, change it to 0.
$showtopiclength = 1;
// Length of title to display before cutting off. If topic title length exceeds this value, it is followed by ellipses (...)
// Only useful if the above varaible is set to 1.
$topiclength = 120;
// Add forumid's to exclude from. For example, you might want to exclude your private forums so that posts from it
// do not show up. Seperate each forumid by a comma and ensure there's no spaces in between.
$forumexclude = "785,182,815,293,288,289,191,771";
/*
* Formatting method to use
* LONG, SHORT, SHORT2, JOINED, DATE, TINY, TIME
*/
$dateFormat = 'DATE';
/*
* Set to 1 disable relative dates
*/
$noRelativeDate = 0;
/* Enabled full relative dates (Example: x minutes ago ) */
$fullRelative = 1;
/*
* Templates
*/
/*
* Use {$post['_last_post']} to show the time of the last post
*/
function postRowTemplate($topic)
{
return <<<EOF
<div style="padding: 2px">
• <a target="_top" title='{$topic->title}' href="{$topic->url()->setQueryString('do',
'getNewComment')}">{$topic->title}</a> Gönderen: {$topic->last_poster_name}
</div>
EOF;
}
function outputWrapper($output = '')
{
return <<<EOF
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<style type='text/css'>
body { background-color: #E9E9EA; font-family: Verdana; font-size: 10px; }
</style>
</head>
<body>
{$output}
</body>
</html>
EOF;
}
require 'init.php';
$whereClause = [];
$whereClause[] = ['approved = 1'];
$whereClause[] = ['forum_id NOT IN (' . $forumexclude . ')'];
$topics = \IPS\Db::i()->select('posts, last_poster_name, last_poster_id, title, title_seo, tid, forum_id, last_post',
'forums_topics', $whereClause, 'last_post desc', $numberOfPosts);
foreach (iterator_to_array($topics) as $t) {
$topic = \IPS\forums\Topic::load($t['tid']);
if ($showtopiclength === 1 && mb_strlen($topic->title) > $topiclength) {
$topic->title = mb_substr($topic->title, 0, $topiclength);
}
$output .= postRowTemplate($topic);
}
echo outputWrapper($output);
Any help apricated