Page 1 of 1

Which file tells MOD to show up on the board as a color?

PostPosted: Fri Jul 20, 2007 3:48 pm
Author: cutegothpirate
Your phpBB Version: 2.0.
phpBB Type: Standard phpBB
MODs: No
Your knowledge: Basic Knowledge
Board URL: http://admins.webkillers.net

PHP Version:
MySQL Version:


What was done before the problem appeared?
modified all kinds of files


What was done to try to solve the problem?
modified all kinds of files



De.scription and Message

When a group is made to be MOD of a forum the users of that group are changed to be user_level 2 and then the group mods are displayed as the mod color on the forum pages and in the legend.
if in functions_profile
$sql = "SELECT * FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug
WHERE ug.user_id = " . $userdata['user_id'] . "
AND aa.group_id = ug.group_id
AND aa.auth_fr = 1
AND ug.user_pending = 0";
if ( !$result = $db->sql_query($sql) )
and I have

else if ($userdata['user_level'] == FR)
{
$res = FR;
}

and in the database I have a field auth_fr in auth_access
and it doesn't show up as the correct color, but if I change it to
else if ($userdata['user_level'] == MOD)
{
$res = FR;
}
and it does, then what file is it saying that auth_fr = the new user level?
Because if the new user level should be 10, and I have it in def_auths as that, and in functions_profile as that.
And in admin_ug_auth it is
if ( $set_fr != '' )
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_level = " . FR . "
WHERE user_id IN ($set_fr)";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't update user level", "", __LINE__, __FILE__, $sql);
}
}
cache_tree(true);
But it won't set the user level to 10
So its not working.
What else should I do to make it work? How and where do I tell the forums that if auth_fr is set to 1 in a user group, that all the users should have the level 10?

Re: Which file tells MOD to show up on the board as a color?

PostPosted: Sat Jul 21, 2007 5:09 am
Author: cutegothpirate
ok, I figured out that if in groupcp.php I have
Code: Select all
if ( $row['user_level'] != ADMIN && $row['user_level'] != WK && $group_info['auth_wk'] ){$sql = "UPDATE " . USERS_TABLE . "SET user_level = " . WK . "WHERE user_id = " . $row['user_id'];if ( !$db->sql_query($sql) ){message_die(GENERAL_ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql);}}  

and in admin_ug_auth.php i have
Code: Select all
$sql = "SELECT u.user_id         FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . USERS_TABLE . " u         WHERE ug.group_id = aa.group_id            AND u.user_id = ug.user_id             AND ug.user_pending = 0            AND u.user_level NOT IN (" . MOD . ", " . ADMIN . ")         GROUP BY u.user_id         HAVING SUM(aa.auth_wk) > 0";         if ( !($result = $db->sql_query($sql)) )         {             message_die(GENERAL_ERROR, "Couldn't obtain user/group permissions", "", __LINE__, __FILE__, $sql);         }           $set_mod = '';         while( $row = $db->sql_fetchrow($result) )         {             $set_mod .= ( ( $set_mod != '' ) ? ', ' : '' ) . $row['user_id'];         }         $db->sql_freeresult($result);           //         // Update user level to user for appropriate users         //                 $sql = "SELECT u.user_id                     FROM ( ( " . USERS_TABLE . " u                     LEFT JOIN " . USER_GROUP_TABLE . " ug ON ug.user_id = u.user_id )                     LEFT JOIN " . AUTH_ACCESS_TABLE . " aa ON aa.group_id = ug.group_id )                     WHERE u.user_level NOT IN (" . USER . ", " . ADMIN . ")                     GROUP BY u.user_id                     HAVING SUM(aa.auth_wk) = 0";         if ( !($result = $db->sql_query($sql)) )         {             message_die(GENERAL_ERROR, "Couldn't obtain user/group permissions", "", __LINE__, __FILE__, $sql);         }           $unset_mod = "";         while( $row = $db->sql_fetchrow($result) )         {             $unset_mod .= ( ( $unset_mod != '' ) ? ', ' : '' ) . $row['user_id'];         }         $db->sql_freeresult($result);           if ( $set_mod != '' )         {             $sql = "UPDATE " . USERS_TABLE . "                 SET user_level = " . WK . "                 WHERE user_id IN ($set_mod)";             if( !($result = $db->sql_query($sql)) )             {                 message_die(GENERAL_ERROR, "Couldn't update user level", "", __LINE__, __FILE__, $sql);             }         }//-- mod : categories hierarchy --------------------------------------------------------------------//-- add         cache_tree(true);//-- fin mod : categories hierarchy ----------------------------------------------------------------           if ( $unset_mod != '' )         {             $sql = "UPDATE " . USERS_TABLE . "                 SET user_level = " . USER . "                 WHERE user_id IN ($unset_mod)";             if( !($result = $db->sql_query($sql)) )             {                 message_die(GENERAL_ERROR, "Couldn't update user level", "", __LINE__, __FILE__, $sql);             }         }           $sql = 'SELECT user_id FROM ' . USER_GROUP_TABLE . "             WHERE group_id = $group_id";         $result = $db->sql_query($sql);           $group_user = array();         while ($row = $db->sql_fetchrow($result))         {             $group_user[$row['user_id']] = $row['user_id'];         }         $db->sql_freeresult($result);           $sql = "SELECT ug.user_id, COUNT(auth_wk) AS is_auth_mod             FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug             WHERE ug.user_id IN (" . implode(', ', $group_user) . ")                 AND aa.group_id = ug.group_id                 AND aa.auth_wk = 1             GROUP BY ug.user_id";         if ( !($result = $db->sql_query($sql)) )         {             message_die(GENERAL_ERROR, 'Could not obtain moderator status', '', __LINE__, __FILE__, $sql);         }           while ($row = $db->sql_fetchrow($result))         {             if ($row['is_auth_mod'])             {                 unset($group_user[$row['user_id']]);             }         }         $db->sql_freeresult($result);           if (sizeof($group_user))         {             $sql = "UPDATE " . USERS_TABLE . "                 SET user_level = " . USER . "                 WHERE user_id IN (" . implode(', ', $group_user) . ") AND user_level = " . WK;             if ( !($result = $db->sql_query($sql)) )             {                 message_die(GENERAL_ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql);             }         }           message_die(GENERAL_MESSAGE, $message);     }}  


Then I can add the user level through the groups and it changes, and I can take it away in the group and it changes back.
But I want to add 3 more and don't know how to add to the set and unset.
I tried adding a new one like
$unset_wk = "";
while( $row = $db->sql_fetchrow($result) )
{
$unset_wk .= ( ( $unset_wk != '' ) ? ', ' : '' ) . $row['user_id'];
}
$db->sql_freeresult($result);
but then I got weird php errors about not being able to fetch rows using it.
If I can use unset_mod and set_mod for more than one thing that would be nice, but it seems I can't.
And I don't know how to make a new one and have it work.
I need to be able to set and unset these new group mod functions.
could you help?