• [Mod] Let visitors to chose how to sort images(date,name,..) 5 0 5 1
Currently:  

Author Topic: [Mod] Let visitors to chose how to sort images(date,name,..)  (Read 181928 times)

0 Members and 1 Guest are viewing this topic.

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
[Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #15 on: February 27, 2003, 02:19:55 PM »
Quote from: tradertt
Can it sort by username too?  Sometimes people may want to see what a user has posted.... Kindly let me know what to add thank you :D


GREAT MOD !!

doesnt make too much sence, because u always can do search by user...
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 tradertt

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
[Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #16 on: February 27, 2003, 06:50:00 PM »
But can it be done with a extra code? Cause I do not know what code to put in for sort by username

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
[Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #17 on: February 28, 2003, 12:10:29 AM »
Quote from: tradertt
But can it be done with a extra code? Cause I do not know what code to put in for sort by username

8O it was simpliest change I've ever done... :?

in /lang/<yourlanguage>/main.php replace the line u inserted:
Code: [Select]
 "image_hits"      => "Hits"
with this:
Code: [Select]
 "image_hits"      => "Hits",
  "image_comments"  => "Comments",
  "user_name"       => "User"
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 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
[Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #18 on: February 28, 2003, 02:10:37 AM »
hmm...I guess it wasnt so simple...this method works untill u click on image details...
if no one figure it out, then I'll try fix it in 18 hours


[EDITED]
couldnt resist... :?
in details.php u'll need do following changes:

1.
find:
Code: [Select]
if ($mode == "lightbox") {
  if (!empty($user_info['lightbox_image_ids'])) {
    $image_id_sql = str_replace(" ", ", ", trim($user_info['lightbox_image_ids']));
    $sql = "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file
            FROM ".IMAGES_TABLE."
            WHERE image_active = 1 AND image_id IN ($image_id_sql) AND cat_id IN (".get_auth_cat_sql("auth_viewcat").")
            ORDER BY ".$config['image_order']." ".$config['image_sort'];
    $in_mode = 1;
  }
}

replace with:
Code: [Select]
if ($mode == "lightbox") {
  if (!empty($user_info['lightbox_image_ids'])) {
    $image_id_sql = str_replace(" ", ", ", trim($user_info['lightbox_image_ids']));
    $sql = "SELECT i.image_id, i.cat_id, i.image_name, i.image_media_file, i.image_thumb_file, i.user_id
            FROM ".IMAGES_TABLE." i
            LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE i.image_active = 1 AND i.image_id IN ($image_id_sql) AND i.cat_id IN (".get_auth_cat_sql("auth_viewcat").")
            ORDER BY ".$config['image_order']." ".$config['image_sort'];
    $in_mode = 1;
  }
}



2.
Find:
Code: [Select]
 else {
    $cat_id_sql = get_auth_cat_sql("auth_viewcat");
  }

  if (!empty($sql_where_query)) {
    $sql = "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file
            FROM ".IMAGES_TABLE."
            WHERE image_active = 1
            $sql_where_query
            AND cat_id IN ($cat_id_sql)
            ORDER BY ".$config['image_order']." ".$config['image_sort'];
    $in_mode = 1;
  }
}
if (!$in_mode || empty($sql)) {
  $sql = "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file
          FROM ".IMAGES_TABLE."
          WHERE image_active = 1 AND cat_id = $cat_id
          ORDER BY ".$config['image_order']." ".$config['image_sort'];
}
$result = $site_db->query($sql);

Replace with:
Code: [Select]
 else {
    $cat_id_sql = get_auth_cat_sql("auth_viewcat");
  }

  if (!empty($sql_where_query)) {
    $sql = "SELECT i.image_id, i.cat_id, i.image_name, i.image_media_file, i.image_thumb_file, i.user_id
            FROM ".IMAGES_TABLE." i
            LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE i.image_active = 1
            $sql_where_query
            AND i.cat_id IN ($cat_id_sql)
            ORDER BY ".$config['image_order']." ".$config['image_sort'];
    $in_mode = 1;
  }
}
if (!$in_mode || empty($sql)) {
  $sql = "SELECT i.image_id, i.cat_id, i.image_name, i.image_media_file, i.image_thumb_file, i.user_id
          FROM ".IMAGES_TABLE." i
          LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
          WHERE i.image_active = 1 AND i.cat_id = $cat_id
          ORDER BY ".$config['image_order']." ".$config['image_sort'];
}
$result = $site_db->query($sql);
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 Ernesto Taseffa

  • Full Member
  • ***
  • Posts: 151
    • View Profile
[Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #19 on: February 28, 2003, 08:27:35 AM »
.
« Last Edit: August 09, 2009, 01:19:29 AM by Ernesto Taseffa »

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
[Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #20 on: February 28, 2003, 09:40:44 AM »
ops, sry, didnt check my post, and I had extra "feature" in my own main.php.... :oops:
just edited my post, check it again. I also added this "new feature" ;)
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 Ernesto Taseffa

  • Full Member
  • ***
  • Posts: 151
    • View Profile
[Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #21 on: February 28, 2003, 10:21:47 AM »
.
« Last Edit: August 09, 2009, 01:19:10 AM by Ernesto Taseffa »

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
[Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #22 on: February 28, 2003, 10:27:00 AM »
opsy...my typo.
it's in details.php
*seems I'm the trouble here...  :? *
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 Ernesto Taseffa

  • Full Member
  • ***
  • Posts: 151
    • View Profile
[Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #23 on: February 28, 2003, 10:58:55 AM »
.
« Last Edit: August 09, 2009, 01:18:53 AM by Ernesto Taseffa »

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
[Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #24 on: February 28, 2003, 11:13:10 AM »
geeee what's wrong with me today?  :?
sry, my bad again.
change "Hits," to this: "Hits",
I added comma in wront place...
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 Ernesto Taseffa

  • Full Member
  • ***
  • Posts: 151
    • View Profile
[Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #25 on: February 28, 2003, 11:21:06 AM »
.
« Last Edit: August 09, 2009, 01:18:35 AM by Ernesto Taseffa »

Offline PuCK

  • Newbie
  • *
  • Posts: 25
    • View Profile
    • http://www.acidarts.net
[Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #26 on: March 11, 2003, 03:57:29 PM »
I can't get the mod to work. I did everything like it said in the second post. I don't get anny errormessages, but when I change the options and click on go, it always shows the images by Date, Descending, like I set it up in the control panel. These options also stay selected when I click on GO.

Does anybody know why this is? It looks like it can't override the Date, Descending options wich I set up in the Control Panel.

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
[Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #27 on: March 12, 2003, 12:15:19 AM »
ok, I just find out why this script didnt work for me, when I uncommented two lines:
find:
Code: [Select]
//  $imagesorder = intval($HTTP_POST_VARS['imagesorder']);
Replace with:
Code: [Select]
 $imagesorder = $HTTP_POST_VARS['imagesorder'];
and find:
Code: [Select]
// $imagessort = intval($HTTP_POST_VARS['imagessort']);
Replace with:
Code: [Select]
$imagessort = $HTTP_POST_VARS['imagessort'];

that how it suposed to be :oops:

P.S. I edited my original post, so, if u just installed this MOD, then dont worry about changes above.
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 PuCK

  • Newbie
  • *
  • Posts: 25
    • View Profile
    • http://www.acidarts.net
[Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #28 on: March 12, 2003, 08:55:22 AM »
YES!

It works now for me to. How strange. I had those 2 lines commented, but when I changed them into the new lines you gave, uncommented it worked!  :D

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
[Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #29 on: March 12, 2003, 12:26:02 PM »
Quote from: PuCK
YES!

It works now for me to. How strange. I had those 2 lines commented, but when I changed them into the new lines you gave, uncommented it worked!  :D

yes, it took me just 3 month to figure it out... hehe
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)