Jump to content

Recommended Posts

Posted

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">
			&#8226; <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 

Posted

I have 3 small scripts (They all look like above) needs to be updated for IPB 4.6.2 (It was working with previous version of IPB which was 4.5), I will pay for it if someone will fix these?

Please PM if you interested

Thanks

Posted
4 minutes ago, Nathan Explosion said:

  

Before this:

require 'init.php';

Add this:

$output = '';

 

nope... did not work...

Posted (edited)

Threw it on a test site...

After this:

require 'init.php';

Add this:

\IPS\Dispatcher\External::i();

That should sort it - if the offer of payment stands, my beer fund will be very happy 😄

Edited by Nathan Explosion
Posted
1 hour ago, Nathan Explosion said:

Threw it on a test site...

After this:

require 'init.php';

Add this:

\IPS\Dispatcher\External::i();

That should sort it - if the offer of payment stands, my beer fund will be very happy 😄

That did the trick.... 🙂 All 3 scripts are working again...

Please send me PayPal email....

Thank you so much.... 🙂

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...