Author Topic: Best rated and most commented user picture in user profile  (Read 15703 times)

0 Members and 1 Guest are viewing this topic.

Offline mircea

  • Pre-Newbie
  • Posts: 1
    • View Profile
Best rated and most commented user picture in user profile
« on: January 08, 2008, 10:03:33 PM »
Hi,

I would like to enrich the user profile with few extra fields (thumbnails):
Best rated user picture (highest rating average)
Most popular picture (picture with the highest number of hits)
Most commented picture (picture with the highest number of comments)

Is there any MOD already created?

Thanks!!
 
« Last Edit: January 14, 2008, 01:16:34 PM by mircea »

Offline bergblume

  • Sr. Member
  • ****
  • Posts: 463
  • on to the top!
    • View Profile
Re: Best rated and most commented user picture in user profile
« Reply #1 on: December 22, 2008, 10:23:20 PM »
Hi,

I would like to enrich the user profile with few extra fields (thumbnails):
Best rated user picture (highest rating average)
Most popular picture (picture with the highest number of hits)
Most commented picture (picture with the highest number of comments)

Is there any MOD already created?

Thanks!!
 

is there already a solution available for this request?

Offline alekinna

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
    • Gallery of cross-stitching
Re: Best rated and most commented user picture in user profile
« Reply #2 on: January 08, 2009, 01:06:35 PM »
This mod will add to user's profile user's images top (most rated, most commented, most viewed, most downloaded).
If all user's images have most value (hits, rating, e.g.) = 0, no image will displayed for this value.

1. in the file member.php

find
Code: [Select]
else {
      $user_email = REPLACE_EMPTY;
      $user_email_save = REPLACE_EMPTY;
      $user_mailform_link = REPLACE_EMPTY;
      $user_email_button = REPLACE_EMPTY;
    }

add below
Code: [Select]
// ----------------------------------- USER'S IMAGES TOP ----------------------------------
    $user_images_top = "";
    $most_value_array = array("image_rating", "image_hits", "image_comments", "image_downloads");
    $most_value_image = "";
    foreach ($most_value_array as $key) {
     
      $additional_sql = "";
      if ($key == "image_rating") {
        $additional_sql .= "AND image_rating = (SELECT MAX(image_rating) ";
        $most_value = $lang['most_rate'];
      }
      elseif ($key == "image_hits") {
        $additional_sql .= "AND image_hits = (SELECT MAX(image_hits) ";
        $most_value = $lang['most_hits'];
      }
      elseif ($key == "image_comments") {
        $additional_sql .= "AND image_comments = (SELECT MAX(image_comments) ";
        $most_value = $lang['most_comments'];
      }
      elseif ($key == "image_downloads") {
        $additional_sql .= "AND image_downloads = (SELECT MAX(image_downloads) ";
        $most_value = $lang['most_downloads'];
      }
    $sql = "SELECT image_id, cat_id, image_name, image_thumb_file, image_comments, image_downloads, image_rating, image_hits
            FROM ".IMAGES_TABLE." a
            WHERE user_id = $user_id AND image_active = 1 $additional_sql
            FROM ".IMAGES_TABLE." b
            WHERE a.user_id = b.user_id)
            GROUP BY image_date";

      $most_value_row = $site_db->query_firstrow($sql);

      if ($most_value_row[$key] != 0 && !empty($most_value_row[$key])) {
        $most_value_image .= "<td align=\"center\"><b>".$most_value." (".$most_value_row[$key].")</b><br>\n";
        $most_value_image .= "<a href=\"".$site_sess->url(ROOT_PATH."details.php?image_id=".$most_value_row['image_id'])."\"><img src=\"".get_file_path($most_value_row['image_thumb_file'], "thumb", $most_value_row['cat_id'], 0, 1)."\" border=\"0\" alt=\"\" title=\"".$most_value_row['image_name']."\" /><br>\n";
        $most_value_image .= $most_value_row['image_name']."</a><br></td>\n";
      }

  }
    if ($most_value_image != "") {
      $user_images_top .= "<table border=\"0\" cellpading=\"0\" cellspasing=\"0\">\n<tr>\n";
      $user_images_top .= $most_value_image."</tr>\n</table>\n";
    }
// ---------------------------------------------------------------------------------------

1.1 find
Code: [Select]
"user_name" => (isset($user_row['user_name'])) ? format_text($user_row['user_name'], 2) : REPLACE_EMPTY,
add below
Code: [Select]
"user_images_top" => $user_images_top,

2. in the file lang/your_lang/main.php

add before ?>
Code: [Select]
$lang['most_rate'] = "Most rated";
$lang['most_hits'] = "Most viewed";
$lang['most_comments'] = "Most commented";
$lang['most_downloads'] = "Most downloaded";

3. in the file member_profile.html

use
Code: [Select]
{if user_images_top}{user_images_top}{endif user_images_top}

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: Best rated and most commented user picture in user profile
« Reply #3 on: January 08, 2009, 01:09:43 PM »
Hi alekinna,

i love your signature  :wink:


Kurt

Offline bergblume

  • Sr. Member
  • ****
  • Posts: 463
  • on to the top!
    • View Profile
Re: Best rated and most commented user picture in user profile
« Reply #4 on: January 15, 2009, 02:17:09 PM »
I alekinna,

I just tried out your mod, but I get the following error message:

An unexpected error occured. Please try again later.

An unexpected error occured. Please try again later.

Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /var/www/web15/html/member.php on line 1852


please help!

Offline fermachado

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
Re: Best rated and most commented user picture in user profile
« Reply #5 on: April 23, 2009, 09:38:26 AM »
Hi,

I tried this Mod in wamp "localhost" and works nice.

But,if send to the server (online) don't works.  :?

what's  the problem? 8O

The server have PHP Version 5.2.3

Thanks,
Fernando

www.globalfoto.net

Sintra - Portugal

Offline fermachado

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
Re: Best rated and most commented user picture in user profile
« Reply #6 on: August 20, 2009, 05:43:10 AM »
Anyone solve the problem with this Mod. :?:

Works nice only in localhost. :cry:

Thanks,
www.globalfoto.net

Sintra - Portugal

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: Best rated and most commented user picture in user profile
« Reply #7 on: August 20, 2009, 02:24:32 PM »
Hat das jemand getestet?
Läuft das?

Offline fermachado

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
Re: Best rated and most commented user picture in user profile
« Reply #8 on: August 21, 2009, 01:22:11 PM »
Hat das jemand getestet?
Läuft das?

Yes,this works but only in localhost (my pc) online don't works.

You can see a example in the image in attach.

www.globalfoto.net

Sintra - Portugal

Offline mzawdi

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Best rated and most commented user picture in user profile
« Reply #9 on: August 26, 2009, 01:43:16 AM »
 :evil: :evil: :evil:

An unexpected error occured. Please try again later


Offline fermachado

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
Re: Best rated and most commented user picture in user profile
« Reply #10 on: August 26, 2009, 02:31:00 PM »
:evil: :evil: :evil:

An unexpected error occured. Please try again later



I don't have any error if is Onine.Only don't show anything! :?
www.globalfoto.net

Sintra - Portugal