Author Topic: Exclude Category from New Images  (Read 19489 times)

0 Members and 1 Guest are viewing this topic.

Offline sigma.

  • Full Member
  • ***
  • Posts: 148
  • cydonian.com/potd
    • View Profile
    • sigma's gallery
Exclude Category from New Images
« on: January 28, 2007, 08:26:50 PM »
Hi,

Is there a way to exclude images being added to the latest images from a certain category, or one that has certain user group permissions attached to it?

I basicly dont want images from a certain category to show up in the 'New Images' area of my site.

Is this possible?

Offline mawenzi

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Exclude Category from New Images
« Reply #1 on: January 28, 2007, 09:46:18 PM »
...if you want to exclude certain categories (e.g. 1,2,3), than use in your new_images_query ...
Code: [Select]
AND i.cat_id NOT IN (1,2,3)
« Last Edit: January 29, 2007, 10:09:20 AM by mawenzi »
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline sigma.

  • Full Member
  • ***
  • Posts: 148
  • cydonian.com/potd
    • View Profile
    • sigma's gallery
Re: Exclude Category from New Images
« Reply #2 on: January 28, 2007, 10:36:15 PM »
Hi mawenzi,

are saying this is only possible in phpMyadmin?

What Im just trying to do is exclude a certain category from the {new_images} section on my site. So basicly no new thumbnails/images get displayed in {new_images} from for example cat_id=24


Offline mawenzi

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Exclude Category from New Images
« Reply #3 on: January 29, 2007, 10:08:46 AM »
... in index.php find in //--- Show New Images ---- the following ...
Code: [Select]
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")

... and add after ...
Code: [Select]
AND i.cat_id NOT IN (24)
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline sigma.

  • Full Member
  • ***
  • Posts: 148
  • cydonian.com/potd
    • View Profile
    • sigma's gallery
Re: Exclude Category from New Images
« Reply #4 on: January 30, 2007, 08:42:31 AM »
dam man, i wish i had your skills. Thank you very much AGAIN. Ive excluded multiple categories by seperating them using a comma. (192,67,84) and so on.
Works great :)

Offline jrey

  • Full Member
  • ***
  • Posts: 165
    • View Profile
    • http://www.jrey.net
Re: Exclude Category from New Images
« Reply #5 on: May 04, 2007, 12:39:13 AM »
Im using this solution for my gallery and works fine, but the problem that I have is that the statistics in category "New Images" are showing the total number of images ( the real number, counting the images that Im not showing in "New Images" ) and its showing the paging of this result, then if for example I have 50 images but Im showing only 12, there is not really a second page with more images, but paging says that yes, and if you press in the link to the second page you will not see anything, only a page with not images. How can I adapt the "real" statistics and paging to my modified/restricted results ?. I want that statistics says " There are 12 new images" and not  "There are 50 new images" in three pages  - Got to page 2,3 "  ( continuing with the example ).

Thanks in advance.

Javi

Offline mawenzi

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Exclude Category from New Images
« Reply #6 on: May 04, 2007, 10:01:42 AM »
@jrey
in search.php find
Code: [Select]
if (!empty($search_id['search_new_images']) && $search_id['search_new_images'] == 1) {
    $new_cutoff = time() - 60 * 60 * 24 * $config['new_cutoff'];
    $sql_where_query .= "AND i.image_date >= $new_cutoff ";
}

and change it to
Code: [Select]
if (!empty($search_id['search_new_images']) && $search_id['search_new_images'] == 1) {
    $new_cutoff = time() - 60 * 60 * 24 * $config['new_cutoff'];
    $sql_where_query .= "AND i.image_date >= $new_cutoff AND i.cat_id NOT IN (1,2,3)";
}

where (1,2,3) are the categories you want to exclude ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: Exclude Category from New Images
« Reply #7 on: May 04, 2007, 01:19:40 PM »
another solution:
you create a table called e.g. "digi_cat_id" in the 4images_settings table
then you insert in admin/settings.php after:
Code: [Select]
show_setting_row("random_cat_id", $random_cat_id);
this:
Code: [Select]
show_setting_row("digi_cat_id", $digi_cat_id);and in the lang/your lang/admin.php:
Code: [Select]
$setting['digi_cat_id'] = "Exclude Category from all Images";
and then in every page e.g. index.php, search.php, top.php etc..
you can insert this in the sql:
Code: [Select]
AND i.cat_id NOT IN (".$config['digi_cat_id'].")
in the acp you see in the settings a new field. insert in this field the cat id exclude from images
you can insert there many cat ids for example:
1, 2, 3

Offline jrey

  • Full Member
  • ***
  • Posts: 165
    • View Profile
    • http://www.jrey.net
Re: Exclude Category from New Images
« Reply #8 on: May 04, 2007, 05:16:08 PM »
 :D :D :D :D :D  Yes, its perfect !!. Thank you very much to both, I did it and now I can configure in my acp the categories that I want to hide and showing the correct statistics. Great help. Thanks again.

Bye

jrey

Offline webmaster73

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
Re: Exclude Category from New Images
« Reply #9 on: August 09, 2007, 04:32:15 PM »
... in index.php find in //--- Show New Images ---- the following ...
Code: [Select]
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")

... and add after ...
Code: [Select]
AND i.cat_id NOT IN (24)

this is sweet. but this must be a parameter to be set in the admin panel, not a hack to the core script.



Offline mawenzi

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Exclude Category from New Images
« Reply #10 on: August 09, 2007, 06:24:57 PM »
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline webmaster73

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
Re: Exclude Category from New Images
« Reply #11 on: August 09, 2007, 06:50:09 PM »
@ wbmaster73
... then use this ... http://www.4homepages.de/forum/index.php?topic=16348.msg92769#msg92769


thank you mawenzi, I really appreciate your effort.

I have tried the first method, and it works fine for me, so I am ok with that.

what honestly disturbs me a bit is to find that almost every single feature I would wish to see in 4images is already available in the form of a Mod.

hmmmm. I believe I am an average user of 4images. If almost every single one of my requests has already been made And answered in the form of a mod, why does not the coding team of 4images pull itself together and integrate those essential mods into the core of the script?

Guys, if frankly it is a funds question, then do as everyone did and does: sell your script at a reasonable price (may I suggest $30/domain) and provide better service......

Freeware has limits and I believe 4images has reached 'em.  now the script is well known, we could take it a step further...


Offline NetRebel

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Exclude Category from New Images
« Reply #12 on: April 13, 2008, 02:22:32 PM »
... in index.php find in //--- Show New Images ---- the following ...

Oh... if only everything in life was this easy! :wink: Thanks for this perfect, yet simple solution. It's exactly what I was looking for to exclude some "adult" content categories from being displayed on the frontpage. :-D

Offline niad

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
Re: Exclude Category from New Images
« Reply #13 on: August 06, 2021, 07:25:52 PM »
I didn't manage to exclude categories with the above solutions, so I did this:

In the Search.php
Find this:
AND c.cat_id = i.cat_id $cat_id_sql

and replace it with this:
AND c.cat_id = i.cat_id AND i.cat_id NOT IN (1,2,3)

where the 1,2,3 are the categories you want to exclude from the "new images" results.

This is a very easy solution and works great!
I love 4images, it is really great work!