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

Yeni başlayanlar, nasıl ve ne yapacağını bilmeyenler buraya yazabilir.

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

İleti kormali466 17.03.2007, 00:01

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?
kormali466
Üye
Üye
 
İleti: 37
Kayıt: 13.01.2007, 17:40

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

İleti Simuzer 17.03.2007, 00:19

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...
Kullanıcı avatarı
Simuzer
Geliştirme Grubu
Geliştirme Grubu
 
İleti: 669
Kayıt: 09.11.2005, 09:34
Konum: İstanbul

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

İleti kormali466 17.03.2007, 09:38

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?
kormali466
Üye
Üye
 
İleti: 37
Kayıt: 13.01.2007, 17:40

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

İleti Simuzer 17.03.2007, 10:21

sen bi ekle bakalım...
Kullanıcı avatarı
Simuzer
Geliştirme Grubu
Geliştirme Grubu
 
İleti: 669
Kayıt: 09.11.2005, 09:34
Konum: İstanbul

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

İleti kormali466 17.03.2007, 10:45

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.
kormali466
Üye
Üye
 
İleti: 37
Kayıt: 13.01.2007, 17:40

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

İleti Simuzer 17.03.2007, 17:42

Aşağıdaki kodu bul ve sil.

Kod: Tümünü seç
font-weight:bold
Kullanıcı avatarı
Simuzer
Geliştirme Grubu
Geliştirme Grubu
 
İleti: 669
Kayıt: 09.11.2005, 09:34
Konum: İstanbul

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

İleti kormali466 17.03.2007, 19:53

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?
kormali466
Üye
Üye
 
İleti: 37
Kayıt: 13.01.2007, 17:40

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

İleti Simuzer 17.03.2007, 22:09

onlar kim?

Yönetici mi, yetkili mi, üye mi ?
Kullanıcı avatarı
Simuzer
Geliştirme Grubu
Geliştirme Grubu
 
İleti: 669
Kayıt: 09.11.2005, 09:34
Konum: İstanbul

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

İleti kormali466 18.03.2007, 09:04

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..
kormali466
Üye
Üye
 
İleti: 37
Kayıt: 13.01.2007, 17:40

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

İleti Simuzer 18.03.2007, 11:36

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;
   }
}
Kullanıcı avatarı
Simuzer
Geliştirme Grubu
Geliştirme Grubu
 
İleti: 669
Kayıt: 09.11.2005, 09:34
Konum: İstanbul

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

İleti kormali466 20.03.2007, 15:38

Eline sağlık Simuzer, uğraştığın için teşekkürler :roll:
kormali466
Üye
Üye
 
İleti: 37
Kayıt: 13.01.2007, 17:40


Yeni Başlayanlar



Kimler çevrimiçi

Bu forumu görüntüleyenler: Kayıtlı kullanıcı yok ve 0 misafir

cron