Author Topic: Req: Total User Votes (from images) in profile .  (Read 24689 times)

0 Members and 1 Guest are viewing this topic.

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Req: Total User Votes (from images) in profile .
« on: January 20, 2006, 09:26:39 PM »
Its possible show in user profile the total of votes (from your own images) , and show it on profile , or show the total rate?

Total Votes : 321 vote(s)

or

User Rate : 6.21  ...


showing on each profile the stats of votes/rate of user ?  :mrgreen:


Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: Req: Total User Votes (from images) in profile .
« Reply #1 on: January 20, 2006, 10:01:00 PM »
Quote

showing on each profile the stats of votes/rate of user ?


This has been asked several times in the past as the answer is still no.

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
Re: Req: Total User Votes (from images) in profile .
« Reply #2 on: January 21, 2006, 01:37:57 AM »
I'm confused...
1) first question I understood is to show total votes/rating for the images that user own (uploaded)
2) second question is kind of little different that I understood as votes/rating the user casted on the site...
If your question is "1)" then the answer is yes, you can, but if its "2)", then no you can not, UNLESS you've installed [MOD] Votes saved in DB.
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 Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: Req: Total User Votes (from images) in profile .
« Reply #3 on: January 21, 2006, 02:51:30 AM »
I'm confused...
1) first question I understood is to show total votes/rating for the images that user own (uploaded)
2) second question is kind of little different that I understood as votes/rating the user casted on the site...
If your question is "1)" then the answer is yes, you can, but if its "2)", then no you can not, UNLESS you've installed [MOD] Votes saved in DB.


Yes i've [MOD] Votes saved in DB installed  8)

 :mrgreen:

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
Re: Req: Total User Votes (from images) in profile .
« Reply #4 on: January 21, 2006, 04:34:01 AM »
So, which question is it? total votes for the images that the user own (votes made by others) or total votes casted by that 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 Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: Req: Total User Votes (from images) in profile .
« Reply #5 on: January 21, 2006, 04:58:42 AM »
So, which question is it? total votes for the images that the user own (votes made by others) or total votes casted by that user?

yes ideia its count how many votes that user have got from another users in your own images (not my votes,but yes from another user in my images) and the other option its taken from this votes a "rate" :

example : 370 vote(s) => Give a "7.80 v"

one of both options ill be nice make avaliable  :P , always made by others in my images :)

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
Re: Req: Total User Votes (from images) in profile .
« Reply #6 on: January 21, 2006, 05:19:07 AM »
To show how many total votes and average rating the images owned by specific member received in member.php find:
Code: [Select]
    if (!empty($user_row['user_email']) && (!isset($user_row['user_showemail']) || (isset($user_row['user_showemail']) && $user_row['user_showemail'] == 1))) {
Insert above:
Code: [Select]
$lang['num_votes'] = "Image votes";
$lang['avg_rating'] = "Image average rating";
    $sql = "SELECT SUM(image_votes) num_votes, AVG(image_rating) avg_rating
            FROM ".IMAGES_TABLE."
            WHERE ".get_user_table_field("", "user_id")." = ".$user_id." AND image_rating > 0";
    $result = $site_db->query_firstrow($sql);
    $result['num_votes'] = ($result['num_votes']) ? $result['num_votes'] : 0;
    $result['avg_rating'] = ($result['avg_rating']) ? sprintf("%.2f", $result['avg_rating']) : 0;

    $site_template->register_vars(array(
      "num_votes" => $result['num_votes'],
      "avg_rating" => $result['avg_rating'],
      "lang_num_votes" => $lang['num_votes'],
      "lang_avg_rating" => $lang['avg_rating'],
    ));
In member_profile.html template you can use these tags:
{lang_num_votes}
{num_votes}
{lang_avg_rating}
{avg_rating}


(you can move
Code: [Select]
$lang['num_votes'] = "Images votes";
$lang['avg_rating'] = "Images average rating";
into your main.php language file)

Note, this will work with default 4images, no extra mod required.
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 Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: Req: Total User Votes (from images) in profile .
« Reply #7 on: January 21, 2006, 04:26:21 PM »
This doesn't work, i mean doesn't show (Lang) and (Votes) on profile , note i'm using the version A of MOD Votes saved in DB  8)

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
Re: Req: Total User Votes (from images) in profile .
« Reply #8 on: January 21, 2006, 05:04:34 PM »
Then you inserted it in a wrong please, for example it wont work if you insert it below and not above.
I've tested on fresh 4images v1.7.1 without any mods.
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 Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: Req: Total User Votes (from images) in profile .
« Reply #9 on: January 21, 2006, 05:27:44 PM »
i've added again and this is working :) , following the ideia, its possible create a top with this (top 10) of user with more votes or more high rating ? (by user and not by image) ?  :wink:

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: Req: Total User Votes (from images) in profile .
« Reply #10 on: January 21, 2006, 05:58:53 PM »
i've added again and this is working :) , following the ideia, its possible create a top with this (top 10) of user with more votes or more high rating ? (by user and not by image) ?  :wink:

This is what I meant about the earlier requests. It has never been done before (no one would do it. :() but I still second that though. ;)

@V@no :

In the mean time, may I ask why these two arrays :

Quote

$lang['num_votes'] = "Image votes";
$lang['avg_rating'] = "Image average rating";


has been added on top of your routine and not in main.php file ?

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: Req: Total User Votes (from images) in profile .
« Reply #11 on: January 21, 2006, 07:20:23 PM »
but must be possible following the the ideia of default code of top.php , but i'm not php coder, so let php experts think on it  :mrgreen:

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
Re: Req: Total User Votes (from images) in profile .
« Reply #12 on: January 21, 2006, 07:22:16 PM »
@V@no :

In the mean time, may I ask why these two arrays :

Quote

$lang['num_votes'] = "Image votes";
$lang['avg_rating'] = "Image average rating";


has been added on top of your routine and not in main.php file ?
Just to simplyfy the installation instructions, less steps and besides not everyone is using multi-language 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 Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: Req: Total User Votes (from images) in profile .
« Reply #13 on: January 21, 2006, 07:25:09 PM »
make things simply its always a good thing  :wink: , but about added a table on top.php of top 10 more rated/more votes users ill be great, maybe to increase more popularity to site  :wink:

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: Req: Total User Votes (from images) in profile .
« Reply #14 on: January 26, 2006, 05:34:32 AM »
The MOD is more or less working, but it shows just the votes the admin mades, it doesnt count the votes from normal users. I log in under a normal user, vote, but the number in my profile isn't increasing *but the vote itself is being accepted*

whats wrong?