4images Forum & Community

4images Help / Hilfe => Bug Fixes & Patches => Topic started by: V@no on February 18, 2009, 07:14:19 AM

Title: [1.7 - 1.7.6] Additional image fields don't show with random image
Post by: V@no on February 18, 2009, 07:14:19 AM
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."
Title: Re: [1.7 - 1.7.6] Additional image fields don't show with random image
Post by: yesme on February 18, 2009, 07:30:34 AM
My new field now displayed with the random image. Thanks for the fix.  :D
Title: Re: [1.7 - 1.7.6] Additional image fields don't show with random image
Post by: __G__ 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
Title: Re: [1.7 - 1.7.6] Additional image fields don't show with random image
Post by: MitchJohnson 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