Мод некорректно работает с MySQL 5.0.*
При добавлении/удалении сообщений/тем выползает ошибка
Error geting users post stat
Вот участки кода, где может быть ошибка:
Код: Выделить всё
#
#-----[ OPEN ]------------------------------------------
#
includes/functions_post.php
#
#-----[ FIND ]------------------------------------------
#
return;
}
//
// Delete a post/poll
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$sql = "SELECT ug.user_id, g.group_id as g_id, u.user_posts, g.group_count, g.group_count_max FROM " . GROUPS_TABLE . " g, ".USERS_TABLE." u
LEFT JOIN ". USER_GROUP_TABLE." ug ON g.group_id=ug.group_id AND ug.user_id=$user_id
WHERE u.user_id=$user_id
AND g.group_single_user=0
AND g.group_count_enable=1
AND g.group_moderator<>$user_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error geting users post stat', '', __LINE__, __FILE__, $sql);
}
while ($group_data = $db->sql_fetchrow($result))
{
$user_already_added = (empty($group_data['user_id'])) ? FALSE : TRUE;
$user_add = ($group_data['group_count'] == $group_data['user_posts'] && $user_id!=ANONYMOUS) ? TRUE : FALSE;
$user_remove = ($group_data['group_count'] > $group_data['user_posts'] || $group_data['group_count_max'] < $group_data['user_posts']) ? TRUE : FALSE;
if ($user_add && !$user_already_added)
{
//user join a autogroup
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
VALUES (".$group_data['g_id'].", $user_id, '0')";
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error insert users, group count', '', __LINE__, __FILE__, $sql);
}
} else
if ( $user_already_added && $user_remove)
{
//remove user from auto group
$sql = "DELETE FROM " . USER_GROUP_TABLE . "
WHERE group_id=".$group_data['g_id']."
AND user_id=$user_id";
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not remove users, group count', '', __LINE__, __FILE__, $sql);
}
}
}
Код: Выделить всё
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php
#
#-----[ FIND ]------------------------------------------
#
$email_template = 'user_welcome';
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
$sql = "SELECT ug.user_id, g.group_id as g_id, g.group_name , u.user_posts, g.group_count FROM " . GROUPS_TABLE . " g, ".USERS_TABLE." u
LEFT JOIN ". USER_GROUP_TABLE." ug ON g.group_id=ug.group_id AND ug.user_id=$user_id
WHERE u.user_id=$user_id
AND ug.user_id is NULL
AND g.group_count=0
AND g.group_single_user=0
AND g.group_moderator<>$user_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error geting users post stat', '', __LINE__, __FILE__, $sql);
}
while ($group_data = $db->sql_fetchrow($result))
{
//user join a autogroup
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
VALUES (".$group_data['g_id'].", $user_id, 0)";
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error inserting user group, group count', '', __LINE__, __FILE__, $sql);
}
}
Код: Выделить всё
#
#-----[ OPEN ]------------------------------------------
#
modcp.php
#
#-----[ FIND ]------------------------------------------
#
$count_sql = array();
#
#-----[ AFTER, ADD ]------------------------------------------
#
$user_updated = array();
#
#-----[ FIND ]------------------------------------------
#
WHERE user_id = " . $row['poster_id'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
$user_updated [] = "SELECT ug.user_id, g.group_id as g_id, u.user_posts, g.group_count, g.group_count_max, ".$row['poster_id']." as u_id FROM " . GROUPS_TABLE . " g, ".USERS_TABLE." u
LEFT JOIN ". USER_GROUP_TABLE." ug ON g.group_id=ug.group_id AND ug.user_id=".$row['poster_id']."
WHERE u.user_id=".$row['poster_id']."
AND g.group_single_user=0
AND g.group_count_enable=1
AND g.group_moderator<>".$row['poster_id'];
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT post_id
#
#-----[ BEFORE, ADD ]------------------------------------------
#
if ( sizeof($user_updated) )
{
for($i = 0; $i < sizeof($user_updated); $i++)
{
if ( !($result = $db->sql_query($user_updated[$i])) )
{
message_die(GENERAL_ERROR, 'Error geting users post stat', '', __LINE__, __FILE__, $user_updated[$i]);
}
while ($group_data = $db->sql_fetchrow($result))
{
$user_already_added = (!empty($group_data['user_id']) || $group_data['u_id']==ANONYMOUS) ? TRUE : FALSE;
$user_add = ($group_data['group_count'] == $group_data['user_posts'] && $group_data['u_id']!=ANONYMOUS) ? TRUE : FALSE;
$user_remove = ($group_data['group_count'] > $group_data['user_posts'] && $group_data['u_id']!=ANONYMOUS) ? TRUE : FALSE;
if ($user_add && !$user_already_added)
{
//user join a autogroup
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
VALUES (".$group_data['g_id'].", ".$group_data['u_id'].", '0')";
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error insert users, group count', '', __LINE__, __FILE__, $sql);
}
} else
if ( $user_already_added && $user_remove)
{
//remove user from autogroup
$sql = "DELETE FROM " . USER_GROUP_TABLE . "
WHERE group_id=".$group_data['g_id']."
AND user_id=".$group_data['u_id'];
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not remove users, group count', '', __LINE__, __FILE__, $sql);
}
}
unset ($group_data);
}
$db->sql_freeresult($result);
}
}
Форум Нильса закрыт, даже не знаю куда писать
Наверно стоит на phpbb.com поискать.