>>  Site Map >>  Forums >>  Blocks 7x

Forum module - topics in forum:



Blocks 7x - Discussions regarding PHP-Nuke Blocks. 7x



ForumV2 not working after Migration to MySQL5

My host server has just migrated from MySQL4 to MySQL5. As a result, a center blcok called ForumV2 which used to list all the latest posts on the forum on my website www.wenhui.ch is no longer working.
This is the message sent by the hosting provider to all users:

Quote: :

"Subject: Migration of MySQL4 to MySQL5 ("wenhui.ch")

Dear Customers,

We will be updating the MySQL server that you use for your site wenhui.ch from version 4 to
version 5 on 26/03/2008 between 7h and 8h.

Version 5 offers much better performance, greater stability and is more secure. The developers of
this product are no longer providing support for version 4 as it has reached its end of life, and
compatibility with version 5 is almost complete.

Essentially there is only the order of precedence for the comma and the command "JOIN" which
has been modified (documentation available at: http://dev.mysql.com/doc/refman/5.0/en/join.html).
All the scripts and CMS available today have been adapted and are now fully functional with
version 5 of MySQL. Incidentally this would be the ideal occasion to make sure that you are fully
updated.

We encourage you to check your site out thoroughly after this change to make sure that
everything is OK and to contact us if there is any problem whatsoever.

Best regards,

Infomaniak Network SA
Hosting Team
"


The problem must be casued by some incompatibility.

The code for the affected block ForumVs is copied below:

Code: :

<?php
/************************************************************************/
/* ForumsV2 Block for phpBB 2.0.0-6 port to PHP Nuke 6.5+               */
/* ====================================================                 */
/* Copyright (c) 2003-2004 by Telli (telli@codezwiz.com)                */
/* http://codezwiz.com                                     */
/* Last Edited - 20 Aug 2004                              */
/*                                                         */
/* This Block shows the last x # topics where a message was posted,   */
/* along with the username of the last poster and the day and time   */
/* of the post.                                    */
/* It will also show smileys in the topic titles thanks to the      */
/* smileys.php file found in Leo Tan Block Forums version            */
/* (http://www.cybercomp.d2g.com).                           */
/* Used in Wenhui now!            */
/************************************************************************/

if (eregi("block-ForumsV2.php", $_SERVER['SCRIPT_NAME'])) {
    Header("Location: index.php");
    die();
}

//# TO SHOW
$toshow = 7;

define("_BBFORUM_TOTTOPICS","Topics ");
define("_BBFORUM_TOTPOSTS","Posts ");
define("_BBFORUM_TOTVIEWS","Views ");
define("_BBFORUM_TOTREPLIES","Replies ");
define("_BBFORUM_TOTMEMBERS","Members");
define("_BBFORUM_FORUM","Forums");
define("_BBFORUM_SEARCH","Search");

include_once ('blocks/smileys.php');
$cz_theme = get_theme();
global $prefix, $user_prefix, $db, $dbi, $sitename, $user, $cookie, $group_id;

$content .= "<br />";
$content .= "<table cellspacing=\"0\" cellpadding=\"2\" width=\"100%\">";
//1 QUERY
$result = $db->sql_query("SELECT t.topic_id, t.topic_last_post_id, t.topic_title, f.forum_name, f.forum_id, u.username, u.user_id, p.poster_id, FROM_UNIXTIME(p.post_time,'%b %d, %Y at %T') as post_time FROM ".$prefix."_bbtopics t, ".$prefix."_bbforums f LEFT JOIN ".$prefix."_bbposts p ON (p.post_id = t.topic_last_post_id) LEFT JOIN ".$prefix."_users u ON (u.user_id = p.poster_id) WHERE t.forum_id=f.forum_id AND f.auth_view=0 ORDER BY t.topic_last_post_id DESC LIMIT $toshow");
while(list($topic_id, $topic_last_post_id, $topic_title, $forum_name, $forum_id, $username, $user_id, $poster_id, $post_time) = $db->sql_fetchrow($result1)) {

$topic_title=parseEmoticons($topic_title);
$content .= "<tr><td width=\"100%\"><img src=\"themes/$cz_theme/forums/images/icon_minipost.gif\" border=\"0\" alt=\"\">&nbsp;&nbsp;<a href=\"modules.php?name=Forums&amp;file=viewtopic&amp;p=$topic_last_post_id#$topic_last_post_id\"><b>$topic_title</b></a>&nbsp; <A HREF=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$poster_id\">$username</a> <a href=\"modules.php?name=Forums&amp;file=viewforum&amp;f=$forum_id\">$forum_name</a> $post_time</font></td></tr>";
$count = $count + 1;
}
$content .= "</table>";
?>


I am now using another, less nice block to display latest posts on the website.
I am not a knowledgeable person about PHP codes and would be grateful if someone can lend a hand.







I saw the same problem on a site I look after, god knows why it stopped working, I tried quite a few others and they were all non functional except 1.

It's theme specific so it might need some modifying of theme paths but here you go.

It's virtually the same as the 1 on the front page of this site if you wanted an example of how it looks.

Code: :

<?php

########################################################################
# PHP-Nuke Block: fisubsilver Center Forum Block v.2              #
# Made for PHP-Nuke 6.5 and up                      #
#                                                                      #
# Made by mikem http://www.nukecops.com                                #
# This block is made only to match the fisubsilver Theme pack          #
########################################################################
# This program is free software. You can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License.       #
# If you modify this, let me know for fun. =)                          #
########################################################################

if (eregi("block-fisubsilver-Forum.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}
   
global $prefix, $dbi, $sitename, $admin;

$HideViewReadOnly = 1;
          
$Last_New_Topics  = 5;
$show = "  <tr>
    <td height=\"28\" colspan=\"6\" align=\"center\" class=\"catbottom\" background=\"themes/fisubsilver/forums/images/cellpic1.gif\">&nbsp;</td>
  </tr>
</table></td>
        </tr>
      </table></td>
  </tr>
</table>";

$Count_Topics = 0;
$Topic_Buffer = "";
$result = sql_query( "SELECT t.topic_id, f.forum_name, f.forum_id, t.topic_last_post_id, t.topic_title, t.topic_poster, t.topic_views, t.topic_replies, t.topic_moved_id FROM ".$prefix."_bbtopics t, ".$prefix."_bbforums f where t.forum_id=f.forum_id ORDER BY topic_last_post_id DESC", $dbi );
while( list( $topic_id, $forum_name, $forum_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_moved_id ) = sql_fetch_row( $result, $dbi ) )

{
   $skip_display = 0;
   if( $HideViewReadOnly == 1 )
   {
      $result1 = sql_query( "SELECT auth_view, auth_read FROM ".$prefix."_bbforums where forum_id = '$forum_id'", $dbi );
      list( $auth_view, $auth_read ) = sql_fetch_row( $result1, $dbi );
      if( ( $auth_view != 0 ) or ( $auth_read != 0 ) ) { $skip_display = 1; }
   }

   if( $topic_moved_id != 0 )
   {
     // Shadow Topic !!
      $skip_display = 1;
   }
   
   if( $skip_display == 0 )
   {
     $Count_Topics += 1;

$result2 = sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$topic_poster'", $dbi);
list($username, $user_id)=sql_fetch_row($result2, $dbi);
$avtor=$username;
$sifra=$user_id;

$result3 = sql_query("SELECT poster_id, FROM_UNIXTIME(post_time,'%m/%d/%Y at %H:%i') as post_time FROM ".$prefix."_bbposts where post_id='$topic_last_post_id'", $dbi);
list($poster_id, $post_time)=sql_fetch_row($result3, $dbi);

$result4 = sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$poster_id'", $dbi);
list($username, $user_id)=sql_fetch_row($result4, $dbi);

                         $viewlast .="  <tr>
    <td height=\"30\" nowrap bgcolor=\"#EAEFF6\" class=\"row1\"><img src=\"themes/fisubsilver/forums/images/folder_new.gif\" border=\"0\" /></td>
    <td width=\"100%\" bgcolor=\"#EAEFF6\" class=\"row1\">&nbsp;<b>$forum_name</b><br>&nbsp;&nbsp;<a href=\"modules.php?name=Forums&file=viewtopic&t=$topic_id#$topic_last_post_id\">$topic_title</a></td>
    <td align=\"center\" bgcolor=\"#DFE6EF\" class=\"row2\">$topic_replies</td>
    <td align=\"center\" bgcolor=\"#EAEFF6\" class=\"row3\"><a href=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$sifra\">$avtor</a></td>
    <td align=\"center\" bgcolor=\"#DFE6EF\" class=\"row2\">$topic_views</td>
    <td align=\"center\" nowrap bgcolor=\"#C2CFDF\" class=\"row3\"><font size=\"-2\"><i>&nbsp;&nbsp;$post_time&nbsp;</i></font><br>
      <a href=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$user_id\">$username</a>&nbsp;<a href=\"modules.php?name=Forums&file=viewtopic&t=$topic_id#$topic_last_post_id\"><img src=\"themes/fisubsilver/forums/images/icon_minipost_new.gif\" border=\"0\" alt=\"View Latest Post\"></a></td>
  </tr>";
}
   
   if( $Last_New_Topics == $Count_Topics ) { break 1; }
   
}

    $content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">
  <tr>
    <td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
        <tr>
          <td bgcolor=\"#006699\"><table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\">
  <tr>
    <th height=\"25\" colspan=\"2\" align=\"center\" nowrap background=\"themes/fisubsilver/forums/images/cellpic3.gif\" class=\"thcornerl\"><font color=\"#DEEEF3\"><strong>Forum/Topic</strong></font></th>
    <th width=\"50\" align=\"center\" nowrap background=\"themes/fisubsilver/forums/images/cellpic3.gif\" class=\"thtop\"><font color=\"#DEEEF3\"><strong>&nbsp;Replies&nbsp;</strong></font></th>
    <th width=\"100\" align=\"center\" nowrap background=\"themes/fisubsilver/forums/images/cellpic3.gif\" class=\"thtop\"><font color=\"#DEEEF3\"><strong>&nbsp;Author&nbsp;</strong></font></th>
    <th width=\"50\" align=\"center\" nowrap background=\"themes/fisubsilver/forums/images/cellpic3.gif\" class=\"thtop\"><font color=\"#DEEEF3\"><strong>&nbsp;Views&nbsp;</strong></font></th>
    <th align=\"center\" nowrap background=\"themes/fisubsilver/forums/images/cellpic3.gif\" class=\"thcornerr\"><font color=\"#DEEEF3\"><strong>&nbsp;Last Post&nbsp;</strong></font></th>
  </tr>";
    $content .= "$viewlast";

 $content .= "$show";

?>







Thanks for the reply. I will try it immediately and let you know the results.






Hi, Dar63,

I have succeeded in installing the block on my website. It looks nice. Many thanks.

FYI, I removed the blank row at the end of the block so as to show an extra new topic. Wink Very Happy




Attention! You are currently viewing sitemap page!
We strongly suggest to look at original content

Search from web

Valid HTML 4.01 Valid CSS