cheeta
Thu 30th Dec '04, 1:23pm
At the moment i'm working with my forum but now i also have phpbb running.
but the problem is phpbb has 2 extra fields called first_postid & last_postid
this also have to be updated when someone posts a thread @ vbulletin.
now someone created this script for me that fill in the correct postids. But that means I have to update every seconde. (run the file).
Is there no way to fit in something that generates the codes immedantly if you post @ the vbulletin??? So phpbb can also read the posts?
<?php
/************************************************** *************************
* fix.php
************************************************** *************************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
$page_title = 'FIX';
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
//-----
$sql = "SELECT forumid
FROM " . FORUMS_TABLE . "";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain topic1 information', '', __LINE__, __FILE__, $sql);
}
$forumidrow = array();
while( $row = $db->sql_fetchrow($result) )
{
$forumidrow[] = $row;
}
$db->sql_freeresult($result);
for($i = 0; $i < count($forumidrow); $i++)
{
$forumid = $forumidrow[$i]['forumid'];
$sql = "SELECT t.threadid, MAX(p.postid) AS topic_last_postid, MIN(p.postid) AS topic_first_postid
FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
WHERE t.forumid = $forumid
AND t.threadid = p.threadid
GROUP BY t.threadid
ORDER BY t.lastpost DESC";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain topic2 information', '', __LINE__, __FILE__, $sql);
}
$threadidrow = array();
while( $row = $db->sql_fetchrow($result) )
{
$threadidrow[] = $row;
}
$db->sql_freeresult($result);
for($j = 0; $j < count($threadidrow); $j++)
{
$threadid = $threadidrow[$j]['threadid'];
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_first_postid = " . $threadidrow[$j]['topic_first_postid'] . ", topic_last_postid = " . $threadidrow[$j]['topic_last_postid'] . "
WHERE threadid = " . $threadid;
if ( !$db->sql_query($sql, END_TRANSACTION) )
{
message_die(GENERAL_ERROR, "Could not insert ids", "", __LINE__, __FILE__, $sql);
}
echo('Thread ' . $threadid . ' geupdate<br />');
}
echo('Forum ' . $forumid . ' geupdate<br /><br />');
}
//----
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
this is the script he gave to me. Maybe you have something at it? I'm using 3.0.0 vbulletin. the correct file is at the bottem of this post
i hope someone can help me out
but the problem is phpbb has 2 extra fields called first_postid & last_postid
this also have to be updated when someone posts a thread @ vbulletin.
now someone created this script for me that fill in the correct postids. But that means I have to update every seconde. (run the file).
Is there no way to fit in something that generates the codes immedantly if you post @ the vbulletin??? So phpbb can also read the posts?
<?php
/************************************************** *************************
* fix.php
************************************************** *************************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
$page_title = 'FIX';
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
//-----
$sql = "SELECT forumid
FROM " . FORUMS_TABLE . "";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain topic1 information', '', __LINE__, __FILE__, $sql);
}
$forumidrow = array();
while( $row = $db->sql_fetchrow($result) )
{
$forumidrow[] = $row;
}
$db->sql_freeresult($result);
for($i = 0; $i < count($forumidrow); $i++)
{
$forumid = $forumidrow[$i]['forumid'];
$sql = "SELECT t.threadid, MAX(p.postid) AS topic_last_postid, MIN(p.postid) AS topic_first_postid
FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
WHERE t.forumid = $forumid
AND t.threadid = p.threadid
GROUP BY t.threadid
ORDER BY t.lastpost DESC";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain topic2 information', '', __LINE__, __FILE__, $sql);
}
$threadidrow = array();
while( $row = $db->sql_fetchrow($result) )
{
$threadidrow[] = $row;
}
$db->sql_freeresult($result);
for($j = 0; $j < count($threadidrow); $j++)
{
$threadid = $threadidrow[$j]['threadid'];
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_first_postid = " . $threadidrow[$j]['topic_first_postid'] . ", topic_last_postid = " . $threadidrow[$j]['topic_last_postid'] . "
WHERE threadid = " . $threadid;
if ( !$db->sql_query($sql, END_TRANSACTION) )
{
message_die(GENERAL_ERROR, "Could not insert ids", "", __LINE__, __FILE__, $sql);
}
echo('Thread ' . $threadid . ' geupdate<br />');
}
echo('Forum ' . $forumid . ' geupdate<br /><br />');
}
//----
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
this is the script he gave to me. Maybe you have something at it? I'm using 3.0.0 vbulletin. the correct file is at the bottem of this post
i hope someone can help me out