1 sayfadan 1. sayfa

Kullanıcı adlarını nasıl inceltebilirim

İletiTarih: 17.03.2007, 00:01
kormali466
Resim
Uğraştım ama bulamadım.Kullanıcı adlaını falan inceltince zannedersem sql sorgusu azalıyor ve site hızlanıyormuş.nasıl yapabilirim?

Cvp: Kullanıcı adlarını nasıl inceltebilirim

İletiTarih: 17.03.2007, 00:19
Simuzer
Hayır, alakası yok. Colour Groups modunun bir Fix'i olacak. O Fix ile bu sql sorgusu büyük bir oranda düşüyor. Bi ara bulursun...

Cvp: Kullanıcı adlarını nasıl inceltebilirim

İletiTarih: 17.03.2007, 09:38
kormali466
Bir tane buldum ama tüm üyelerin kullanıcı adlarını inceltiyor.vede sql sorgularını büyük oranda düşürüyor.modların ve adminlerinki kalın kalıyor.sadece adminler kalın kalsa diğerlerin hepsi ince nasıl yapabiliriz.
kodları buraya yazsam inceleyebilirmisiniz?

Cvp: Kullanıcı adlarını nasıl inceltebilirim

İletiTarih: 17.03.2007, 10:21
Simuzer
sen bi ekle bakalım...

Cvp: Kullanıcı adlarını nasıl inceltebilirim

İletiTarih: 17.03.2007, 10:45
kormali466
Kod: Tümünü seç
#
#-----[ AÇ ]-----
#

includes/functions_color_groups.php

#
#-----[ BUL ]-----
#

function color_group_colorize_name($user_id, $no_profile = false)
{
   global $board_config, $phpEx, $db, $phpbb_root_path;
   
   static $cacheUsers;
   
   // First see if the user is Anon
   if ($user_id != ANONYMOUS)
   {
      if (!isset($cacheUsers[$user_id]))
      {
         // Get the user info and see if they are assigned a color_group //
         $sql = 'SELECT u.user_color_group, u.username, c.* FROM ' . USERS_TABLE . ' u, ' . COLOR_GROUPS_TABLE . " c
         WHERE u.user_id = $user_id
         AND u.user_color_group = c.group_id";
         $result = $db->sql_query($sql);
         $row = $db->sql_fetchrow($result);
         if (!isset($row['username']))
         {
            //If there was a problem before, we don't want a blank username!
            $sql = 'SELECT username FROM ' . USERS_TABLE . "
               WHERE user_id = $user_id";
            $result = $db->sql_query($sql);
            $row = $db->sql_fetchrow($result);
         }
         $cacheUsers[$user_id]['username'] = $row['username'];

         if (isset($row['group_color']))
         {
            // WE found the highest level color, head out now //
            $cacheUsers[$user_id]['group_color'] = stripslashes($row['group_color']);
         }
         else
         {
            // Now start looking for user group memberships //
            $sql = 'SELECT c.* FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u, ' . COLOR_GROUPS_TABLE . ' c, ' . GROUPS_TABLE . ' g
            WHERE ug.user_id = ' . $user_id . '
            AND u.user_id = ug.user_id
            AND ug.group_id = g.group_id
            AND g.group_color_group = c.group_id
            AND g.group_single_user = 0
            ORDER BY c.order_num ASC LIMIT 1';
            //print $sql;
            $result = $db->sql_query($sql);
            $curr = 10000000000000;
            $style_color = '';
            while ($row = $db->sql_fetchrow($result))
            {
               // If our new group in the list is a higher order number, it's color takes precedence //
               if ($row['order_num'] < $curr)
               {
                  $curr = $row['order_num'];
                  $cacheUsers[$user_id]['group_color'] = stripslashes($row['group_color']);
               }
            }
         }
      }

$style_color = 'style="font-weight:bold;color:' . $cacheUsers[$user_id]['group_color'] . '"';
      $username = $cacheUsers[$user_id]['username'];
      // Make the profile link or no and return it //
      if ($no_profile)
      {
         $user_link = "<span $style_color>$username</span>";
      }
      else
      {
         $user_link = '<a href="' . append_sid($phpbb_root_path."profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$user_id") . '"' . $style_color .'>' . $username . '</a>';
      }
      return($user_link);
   }
   else
   {
      return false;
   }
}

#
#-----[ BUNUNLA DEGISTIR ]-----
#

function color_group_colorize_name($user_id, $no_profile = false)
{
   global $board_config, $phpEx, $db, $phpbb_root_path, $colorusers, $coloruname, $colorgroup;
   
   // First see if the user is Anon
   if ($user_id != ANONYMOUS)
   {
      $username = $coloruname[$user_id];
      if ( $colorusers[$user_id] != 0 )
      {
         // Get the user info and see if they are assigned a color_group //
         $sql = 'SELECT u.user_color_group, u.username, c.* FROM ' . USERS_TABLE . ' u, ' . COLOR_GROUPS_TABLE . " c
            WHERE u.user_id = $user_id
            AND u.user_color_group = c.group_id";
         $result = $db->sql_query($sql);
         $row = $db->sql_fetchrow($result);

      }
       
      if (isset($row['group_color']))
      {
         // WE found the highest level color, head out now //
         $style_color = 'style="font-weight:bold;color:' . $row['group_color'] . '"';
      }
      else
      {
         if ( in_array($user_id, $colorgroup) )
         {
            // Now start looking for user group memberships //
            $sql = 'SELECT c.* FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u, ' . COLOR_GROUPS_TABLE . ' c, ' . GROUPS_TABLE . ' g
               WHERE ug.user_id = ' . $user_id . '
               AND u.user_id = ug.user_id
               AND ug.group_id = g.group_id
               AND g.group_color_group = c.group_id
               AND g.group_single_user = 0';
            //print $sql;
               $result = $db->sql_query($sql);
               $curr = 10000000000000;
               $style_color = '';
               while ($row = $db->sql_fetchrow($result))
               {
                  // If our new group in the list is a higher order number, it's color takes precedence //
                  if ($row['order_num'] < $curr)
                  {
                     $curr = $row['order_num'];
                     $style_color = 'style="font-weight:bold;color:' . $row['group_color'] . '"';
                  }
               }
         }
      }
       
      // Make the profile link or no and return it //
      if ($no_profile)
      {
         $user_link = "<span $style_color>$username</span>";
      }
      else
      {
         $user_link = '<a href="' . append_sid($phpbb_root_path."profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$user_id") . '"' . $style_color .'>' . $username . '</a>';
      }
      return($user_link);
   }
   else
   {
      $username = $coloruname[$user_id];
      if ($no_profile)
      {
         $user_link = "<span $style_color>$username</span>";
      }
      else
      {
         $user_link = '<a href="' . append_sid($phpbb_root_path."profile.php?mode=viewprofile&amp;" . POST_USERS_URL . "=$user_id") . '"' . $style_color .'>' . $username . '</a>';
      }
      return $username;
   }
}

#
#-----[ AÇ ]-----
#

common.php
 
#
#-----[ BUL ]-----
#

//
// Show 'Board is disabled' message if needed.
//

#
#-----[ ÖNCESINE EKLE ]-----
#

$sql = "SELECT user_id, user_color_group, username FROM " . USERS_TABLE;
if( !($result = $db->sql_query($sql)) )
{
   message_die(GENERAL_ERROR, 'Could not read user color groups', '', __LINE__, __FILE__, $sql);
}

$colorusers = array();
$coloruname = array();
while ( $row = $db->sql_fetchrow($result) )
{
   $userid = $row['user_id'];
   $colorusers[$userid] = $row['user_color_group'];
   $coloruname[$userid] = $row['username'];
}

$colorgroup = array();

$sql = "SELECT ug.user_id FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
   WHERE g.group_single_user = 0
   AND g.group_id = ug.group_id
   GROUP BY ug.user_id
   ORDER BY ug.user_id";
if( !($result = $db->sql_query($sql)) )
{
   message_die(GENERAL_ERROR, 'Could not read user color groups', '', __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result) )
{
   $colorgroup[] = $row['user_id'];
}

#
#-----[ TÜM DOSYALARI KAPAT/LAYDET ]-----
#
SoN

Kodlar tam olarak böyle.

Cvp: Kullanıcı adlarını nasıl inceltebilirim

İletiTarih: 17.03.2007, 17:42
Simuzer
Aşağıdaki kodu bul ve sil.

Kod: Tümünü seç
font-weight:bold

Cvp: Kullanıcı adlarını nasıl inceltebilirim

İletiTarih: 17.03.2007, 19:53
kormali466
kardeş dediğin gibi yaptım oldu.Teşekkürler, peki şöyle birşey yapabilirmiyiz.dediğim modda sadece üyelerin rengini inceltiyor.Sadece onlarınkini nasıl kalınlaştırabiliriz?

Cvp: Kullanıcı adlarını nasıl inceltebilirim

İletiTarih: 17.03.2007, 22:09
Simuzer
onlar kim?

Yönetici mi, yetkili mi, üye mi ?

Cvp: Kullanıcı adlarını nasıl inceltebilirim

İletiTarih: 18.03.2007, 09:04
kormali466
Onlar dediğim herkesin yani yönetici, üye, yetkili herkesin kullanıcı adının kalın olmasını istiyorum.
onu nasıl yapıcaz..

Cvp: Kullanıcı adlarını nasıl inceltebilirim

İletiTarih: 18.03.2007, 11:36
Simuzer
Kod: Tümünü seç
function color_group_colorize_name($user_id, $no_profile = false)
{
   global $board_config, $phpEx, $db, $phpbb_root_path, $colorusers, $coloruname, $colorgroup;
   
   // First see if the user is Anon
   if ($user_id != ANONYMOUS)
   {
      $username = $coloruname[$user_id];
      if ( $colorusers[$user_id] != 0 )
      {
         // Get the user info and see if they are assigned a color_group //
         $sql = 'SELECT u.user_color_group, u.username, c.* FROM ' . USERS_TABLE . ' u, ' . COLOR_GROUPS_TABLE . " c
            WHERE u.user_id = $user_id
            AND u.user_color_group = c.group_id";
         $result = $db->sql_query($sql);
         $row = $db->sql_fetchrow($result);

      }
       
      if (isset($row['group_color']))
      {
         // WE found the highest level color, head out now //
         $style_color = 'style="font-weight:bold;color:' . $row['group_color'] . '"';
      }
      else
      {
         if ( in_array($user_id, $colorgroup) )
         {
            // Now start looking for user group memberships //
            $sql = 'SELECT c.* FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u, ' . COLOR_GROUPS_TABLE . ' c, ' . GROUPS_TABLE . ' g
               WHERE ug.user_id = ' . $user_id . '
               AND u.user_id = ug.user_id
               AND ug.group_id = g.group_id
               AND g.group_color_group = c.group_id
               AND g.group_single_user = 0';
            //print $sql;
               $result = $db->sql_query($sql);
               $curr = 10000000000000;
               $style_color = '';
               while ($row = $db->sql_fetchrow($result))
               {
                  // If our new group in the list is a higher order number, it's color takes precedence //
                  if ($row['order_num'] < $curr)
                  {
                     $curr = $row['order_num'];
                     $style_color = 'style="font-weight:bold;color:' . $row['group_color'] . '"';
                  }
               }
         }
      }
       
      // Make the profile link or no and return it //
      if ($no_profile)
      {
         $user_link = "<span $style_color><b>$username</b></span>";
      }
      else
      {
         $user_link = '<a href="' . append_sid($phpbb_root_path."profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$user_id") . '"' . $style_color .'><b>' . $username . '</b></a>';
      }
      return($user_link);
   }
   else
   {
      $username = $coloruname[$user_id];
      if ($no_profile)
      {
         $user_link = "<span $style_color><b>$username</b></span>";
      }
      else
      {
         $user_link = '<a href="' . append_sid($phpbb_root_path."profile.php?mode=viewprofile&amp;" . POST_USERS_URL . "=$user_id") . '"' . $style_color .'><b>' . $username . '</b></a>';
      }
      return $username;
   }
}

Cvp: Kullanıcı adlarını nasıl inceltebilirim

İletiTarih: 20.03.2007, 15:38
kormali466
Eline sağlık Simuzer, uğraştığın için teşekkürler :roll: