Author Topic: small code change? registered user image number and guest image number  (Read 5400 times)

0 Members and 1 Guest are viewing this topic.

Offline ilaslan

  • Newbie
  • *
  • Posts: 44
    • View Profile
hello
i need a small code change.

my total pic 1500 and 15 categories
but 500 pics and 5 categories are for only registered users

when guest came my main page " 1000 images in 10 categories "  now
but i want     for guests             " 1500 images in 15 categories ( 500' pics and 5 categories are only for registered ) "

because i want to guests are register.

someone help us?
« Last Edit: October 01, 2010, 04:14:35 PM by ilaslan »

Offline ilaslan

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: small code change? registered user image number and guest image number
« Reply #1 on: October 03, 2010, 09:45:23 AM »
hmm..
not reply.
i examine a bit. and i see not easy this...

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: small code change? registered user image number and guest image number
« Reply #2 on: October 03, 2010, 10:55:52 AM »
In includes/page_header.php find:

      if (check_permission("auth_viewcat"$key)) {
        
$total_categories++;
        if (isset(
$val['num_images'])) {
          
$total_images += $val['num_images'];
        }
        else {
          
$cat_cache[$key]['num_images'] = 0;
        }


Replace it with:
      $total_categories++;
      if (isset(
$val['num_images'])) {
        
$total_images += $val['num_images'];
      }
      else {
        
$cat_cache[$key]['num_images'] = 0;
      }
      if (
check_permission("auth_viewcat"$key)) {
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline ilaslan

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: small code change? registered user image number and guest image number
« Reply #3 on: October 03, 2010, 11:16:55 PM »
vano thnx. but i didn't try this yet.

but i think.this is writing main page ( for guest )

1500 images in 15 categories <<<<<<---  only...

but i want to write my main page

1500 images in 15 categories ( 500' pics and 5 categories are only for registered )  <<<<<<------ included in parentheses

but i will try. i try to understand code.... maybe need a little more code changes...
« Last Edit: October 03, 2010, 11:27:21 PM by ilaslan »

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: small code change? registered user image number and guest image number
« Reply #4 on: October 04, 2010, 01:13:16 AM »
oh, I see now.

in includes/page_header.php find:
if (!$data get_cache_file($cache_idnull)) {
  if (!empty(
$cat_cache)) {
    foreach (
$cat_cache as $key => $val) {
      if (
check_permission("auth_viewcat"$key)) {
        
$total_categories++;
        if (isset(
$val['num_images'])) {
          
$total_images += $val['num_images'];
        }
        else {
          
$cat_cache[$key]['num_images'] = 0;
        }
        
$auth_cat_sql['auth_viewcat']['IN'] .= ", ".$key;
      }
      else {
        
$auth_cat_sql['auth_viewcat']['NOTIN'] .= ", ".$key;
      }
    }
  }

  
$data = array();

  
$data['total_images'] = $total_images;
  
$data['total_categories'] = $total_categories;
  
$data['auth_viewcat']['IN'] = $auth_cat_sql['auth_viewcat']['IN'];
  
$data['auth_viewcat']['NOTIN'] = $auth_cat_sql['auth_viewcat']['NOTIN'];

  
save_cache_file($cache_idserialize($data));

} else {
  
$data unserialize($data);

  
$total_images $data['total_images'];
  
$total_categories $data['total_categories'];
  
$auth_cat_sql['auth_viewcat']['IN'] = $data['auth_viewcat']['IN'];
  
$auth_cat_sql['auth_viewcat']['NOTIN'] = $data['auth_viewcat']['NOTIN'];
}


replace with:
$total_images_members 0;
$total_categories_members 0;
if (!
$data get_cache_file($cache_idnull)) {
  if (!empty(
$cat_cache)) {
    foreach (
$cat_cache as $key => $val) {
      if (
check_permission("auth_viewcat"$key)) {
        
$total_categories++;
        if (isset(
$val['num_images'])) {
          
$total_images += $val['num_images'];
        }
        else {
          
$cat_cache[$key]['num_images'] = 0;
        }
        
$auth_cat_sql['auth_viewcat']['IN'] .= ", ".$key;
      }
      else {
        
$auth_cat_sql['auth_viewcat']['NOTIN'] .= ", ".$key;
        
$total_categories_members++;
        
$total_images_members += @$val['num_images'];
      }
    }
  }

  
$data = array();

  
$data['total_images'] = $total_images;
  
$data['total_categories'] = $total_categories;
  
$data['auth_viewcat']['IN'] = $auth_cat_sql['auth_viewcat']['IN'];
  
$data['auth_viewcat']['NOTIN'] = $auth_cat_sql['auth_viewcat']['NOTIN'];
  
$data['total_images_members'] = $total_images_members;
  
$data['total_categories_members'] = $total_categories_members;
  
save_cache_file($cache_idserialize($data));

} else {
  
$data unserialize($data);

  
$total_images $data['total_images'];
  
$total_categories $data['total_categories'];
  
$auth_cat_sql['auth_viewcat']['IN'] = $data['auth_viewcat']['IN'];
  
$auth_cat_sql['auth_viewcat']['NOTIN'] = $data['auth_viewcat']['NOTIN'];
  
$total_images_members $data['total_images_members'];
  
$total_categories_members $data['total_categories_members'];
}
$site_template->register_vars(array(
  
"total_categories_members" => $total_categories_members,
  
"total_images_members" => $total_images_members,
));



in main.php language file replace
$lang['site_stats'] = "<b>{total_images}</b> images in <b>{total_categories}</b> categories.";

with:
$lang['site_stats'] = "<b>{total_images}</b> images in <b>{total_categories}</b> categories (<b>{total_images_members}</b> and <b>{total_categories_members}</b> categories are only for registered)";
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline ilaslan

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: small code change? registered user image number and guest image number
« Reply #5 on: October 04, 2010, 10:58:20 AM »
thnx.i hope i will try to night ( i am at work now ).
i am sure this is ok.

Edit1: 04.10.2010
Vano thanx. code is work for guest. but for register user. 0 pic and 0 category for registered .... :S

total_images_members=0  total_categories_members= 0 return for registered users. for example me :D

edit2 : 05.10.2010
and... most of my pic are only registered user but this pics categories are for everyone. and there is a problem i think ( problem is only registered users pic number )
« Last Edit: October 05, 2010, 04:50:57 PM by ilaslan »