media Posted June 27, 2021 Share Posted June 27, 2021 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 Link to comment Share on other sites More sharing options...
media Posted June 28, 2021 Author Share Posted June 28, 2021 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 Link to comment Share on other sites More sharing options...
Nathan Explosion Posted June 28, 2021 Share Posted June 28, 2021 Â Â Before this: require 'init.php'; Add this: $output = ''; Â Link to comment Share on other sites More sharing options...
media Posted June 28, 2021 Author Share Posted June 28, 2021 4 minutes ago, Nathan Explosion said: Â Â Before this: require 'init.php'; Add this: $output = ''; Â nope... did not work... Link to comment Share on other sites More sharing options...
Nathan Explosion Posted June 28, 2021 Share Posted June 28, 2021 Ok - how about telling us what the issue is? What errors are you getting? Link to comment Share on other sites More sharing options...
Nathan Explosion Posted June 28, 2021 Share Posted June 28, 2021 (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 June 28, 2021 by Nathan Explosion Link to comment Share on other sites More sharing options...
media Posted June 28, 2021 Author Share Posted June 28, 2021 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.... 🙂 Nathan Explosion 1 Link to comment Share on other sites More sharing options...
Recommended Posts