(phpbb 2.0.15)
Błąd polega na tym, że jeśli kogoś dodamy do dowolnej Grupy to warunek jest spełniony i nie tworzy się wpis w bazie z opcją "
Personal User" a co za tym idzie nie ma możliwości dodania
moderatora żadnego forum, jeśli użytkownik jest członkiem jakiejkolwiek grupy.
Jeśli macie jakieś sugestie rozwiązania tego problemu to proszę.
[php]
//
// Check if a private user group existis for this user and if not, create one.
//
$sql = "SELECT user_id FROM " . USER_GROUP_TABLE . " WHERE user_id = '$user_id'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$user_check = $row['user_id'];
if ( $user_check != $user_id )
{
$sql = "SELECT MAX(group_id) AS total
FROM " . GROUPS_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select last group_id information', '', __LINE__, __FILE__, $sql);
}
if ( !($row = $db->sql_fetchrow($result)) )
{
message_die(GENERAL_ERROR, 'Could not obtain next group_id information', '', __LINE__, __FILE__, $sql);
}
$group_id = $row['total'] + 1;
$sql = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_name, group_description, group_single_user, group_moderator)
VALUES ('$group_id', '', 'Personal User', '1', '0')";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not create private group', '', __LINE__, __FILE__, $sql);
}
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
VALUES ('$group_id', '$user_id', '0')";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not create private group', '', __LINE__, __FILE__, $sql);
}
}
//
// End Private group check.
//
[/php]
nie będę zmieniał wersji forum - zbyt dużo modów znów musiałbym wgrywać więc nie poponujcie mi aktualizacji do nowej wersji.