Author Topic: [1.7 - 1.7.6] Additional image fields don't show with random image  (Read 16540 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
This is not a bug per-se, but more like a missing feature. The additional image fields not being showed at random image / random cat image

The fix is:

in includes/functions.php find:
  $random_image_cache = array();

Insert below:
  global $additional_image_fields;
  
$additional_sql "";
  if (!empty(
$additional_image_fields)) {
    foreach (
$additional_image_fields as $key => $val) {
      
$additional_sql .= ", i.".$key;
    }
  }


Then find:
Code: (PHP/MySQL) [Select]
    $sql = "SELECT DISTINCT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
Replace with:
Code: (PHP/MySQL) [Select]
    $sql = "SELECT DISTINCT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name").$additional_sql."

Next find:
Code: (PHP/MySQL) [Select]
    $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
Replace with:
Code: (PHP/MySQL) [Select]
    $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name").$additional_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 yesme

  • Jr. Member
  • **
  • Posts: 61
  • Yes for 4images!
    • View Profile
Re: [1.7 - 1.7.6] Additional image fields don't show with random image
« Reply #1 on: February 18, 2009, 07:30:34 AM »
My new field now displayed with the random image. Thanks for the fix.  :D
Love 4images! @--^-----

Offline __G__

  • Sr. Member
  • ****
  • Posts: 286
    • View Profile
Re: [1.7 - 1.7.6] Additional image fields don't show with random image
« Reply #2 on: February 18, 2009, 08:23:16 AM »
thanks a lot V@NO :D for the wonderful feature :D it works great successfully fixed on 1.7.6

Offline MitchJohnson

  • Pre-Newbie
  • Posts: 2
    • View Profile
Re: [1.7 - 1.7.6] Additional image fields don't show with random image
« Reply #3 on: January 14, 2010, 03:10:29 PM »
Thanks for this v@no. Being able to show random images is a nice little feature.

Mitch
« Last Edit: January 28, 2010, 03:48:45 PM by MitchJohnson »