4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: Stoleti on January 20, 2006, 09:26:39 PM

Title: Req: Total User Votes (from images) in profile .
Post by: Stoleti 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:

Title: Re: Req: Total User Votes (from images) in profile .
Post by: TheOracle 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.
Title: Re: Req: Total User Votes (from images) in profile .
Post by: V@no 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 (http://www.4homepages.de/forum/index.php?topic=6123.0).
Title: Re: Req: Total User Votes (from images) in profile .
Post by: Stoleti 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 (http://www.4homepages.de/forum/index.php?topic=6123.0).


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

 :mrgreen:
Title: Re: Req: Total User Votes (from images) in profile .
Post by: V@no 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?
Title: Re: Req: Total User Votes (from images) in profile .
Post by: Stoleti 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 :)
Title: Re: Req: Total User Votes (from images) in profile .
Post by: V@no 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.
Title: Re: Req: Total User Votes (from images) in profile .
Post by: Stoleti 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)
Title: Re: Req: Total User Votes (from images) in profile .
Post by: V@no 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.
Title: Re: Req: Total User Votes (from images) in profile .
Post by: Stoleti 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:
Title: Re: Req: Total User Votes (from images) in profile .
Post by: TheOracle 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 ?
Title: Re: Req: Total User Votes (from images) in profile .
Post by: Stoleti 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:
Title: Re: Req: Total User Votes (from images) in profile .
Post by: V@no 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 :)
Title: Re: Req: Total User Votes (from images) in profile .
Post by: Stoleti 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:
Title: Re: Req: Total User Votes (from images) in profile .
Post by: trez 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?
Title: Re: Req: Total User Votes (from images) in profile .
Post by: V@no on January 26, 2006, 05:41:22 AM
I think you are missunderstanding meaning of this topic. Its not how many votes a member made, but how many votes member's images (the images the member have uploaded) received from other members.
Title: Re: Req: Total User Votes (from images) in profile .
Post by: Stoleti on January 26, 2006, 06:02:25 AM
resuming this MOD just count the votes and average rate from votes from "another" users in your IMAGES  , only this :) simply this !! :wink:
Title: Re: Req: Total User Votes (from images) in profile .
Post by: trez on January 26, 2006, 06:06:39 AM
Oh no  :twisted: I'am sittin' ours trying to solve my "problem"  ... thanks for the information guys - but, anyway, is it posible to show that what i'am searching for in the members profile? f.e.:

This user has rated XX images with an average voting of XX

Possible?
Title: Re: Req: Total User Votes (from images) in profile .
Post by: V@no on January 26, 2006, 06:31:59 AM
only with this mod:
http://www.4homepages.de/forum/index.php?topic=6123.0
I think I've posted code for that somewhere in the replys of that mod.
Title: Re: Req: Total User Votes (from images) in profile .
Post by: mawenzi on January 26, 2006, 11:13:53 AM
Its ... how many votes member's images (the images the member have uploaded) received from other members.

... it's important to know for a description ...
... for more clarity in member_profile.html the language-code in lang/<your_language>/main.php should be ...

... (http://img517.imageshack.us/img517/7821/eng9tu.gif) ...
Code: [Select]
$lang['num_votes'] = "Votes - received for the own images";
$lang['avg_rating'] = "Images average rating - for the own images";

... (http://img517.imageshack.us/img517/1378/deu8yc.gif) ...
Code: [Select]
$lang['num_votes'] = "Bildbewertungen - erhalten für die eigenen Bilder";
$lang['avg_rating'] = "Bewertungsdurchschnitt - für die eigenen Bilder";

... btw. a nice fetuare ... thanks V@no ...  :!:

mawenzi
Title: Re: Req: Total User Votes (from images) in profile .
Post by: trez on January 26, 2006, 01:46:07 PM
only with this mod:
http://www.4homepages.de/forum/index.php?topic=6123.0
I think I've posted code for that somewhere in the replys of that mod.

Do you mean this *http://www.4homepages.de/forum/index.php?topic=6123.msg57740#msg57740* code? If yes, how and where have i to include it to get the total votes/average rating for the user in his profile?
Title: Re: Req: Total User Votes (from images) in profile .
Post by: mawenzi on January 26, 2006, 02:22:39 PM
@ trez

... like this : http://www.4homepages.de/forum/index.php?topic=11242.msg58027#msg58027
... but it is only the count of user votes ...
Title: Re: Req: Total User Votes (from images) in profile .
Post by: trez on January 26, 2006, 04:23:52 PM
@ trez

... like this : http://www.4homepages.de/forum/index.php?topic=11242.msg58027#msg58027
... but it is only the count of user votes ...

so when i want to show the total votes the member made, in his profile i should add

Code: [Select]
wrong
and then show the results by {user_num_votes} etc., in the profile.html? If iam wrong, can you explain me how to do it right? Kannst auch auf deutsch posten ;)
Title: Re: Req: Total User Votes (from images) in profile .
Post by: TheOracle on January 26, 2006, 04:27:38 PM
Quote

and then show the results by {user_num_votes} etc., in the profile.html? If iam wrong, can you explain me how to do it right?


Actually. You're going on the right track. However, under your templates/<your_template>/member_profile.html file, these are the four tags you need to add :

Code: [Select]

{user_num_votes}
{user_avg_rating}
{user_lang_num_votes}
{user_lang_avg_rating}


;)
Title: Re: Req: Total User Votes (from images) in profile .
Post by: mawenzi on January 26, 2006, 05:48:42 PM
If iam wrong, can you explain me how to do it right? Kannst auch auf deutsch posten ;)

... Ja, du liegst falsch ...  :!:
... du hast oben gefragt, wo du den von dir angegeben Code (siehe Link) einfügen sollst und nicht was ...
... der Code für die vom User abgegebenen Stimmen in member.php --- Show Profile --- sieht etwa so aus :

Code: [Select]
//--- Nummer der abgegebenen Stimmen im Profil ---
    $lang['user_votes'] = "Abgegebene Bewertungen:";
    $lang['vot'] = "Bewertungen";
    $sql = "SELECT user_v_images, user_id FROM ".USERS_TABLE." WHERE user_id = $user_id";
    $row = $site_db->query_firstrow($sql);
    $user_votes = $row['user_v_images'];
    $lang_user_votes = $lang['user_votes'];
    $lang_vot = $lang['vot'];
    $site_template->register_vars(array(
    "user_votes" => $user_votes,
    "lang_user_votes" => $lang_user_votes,
    "lang_vot" => $lang_vot,
    ));
//--- Nummer der abgegebenen Stimmen im Profil ---

jetzt kannst du in deiner member_profile.html folgende Tags verwenden :
Code: [Select]
<b>{user_lang_votes}</b> {user_votes} {vot}

PS. Voraussetzung ist aber : http://www.4homepages.de/forum/index.php?topic=6123.0 Varinate B
PPS. Deinen Code kannst du löschen, da er andere User nur verwirren wird !

mawenzi
Title: Re: Req: Total User Votes (from images) in profile .
Post by: trez on January 26, 2006, 08:01:27 PM
mawenzi, vielen dank fuer deine muehe, allerdings habe ich die Avariante installiert, kann man den code irgendwie aendern so dass er mit der A variante funzt? :)

mawenzi, thanks for your help, but i have installed the A version of that mod - anyway to make thinks work?
Title: Re: Req: Total User Votes (from images) in profile .
Post by: mawenzi on January 26, 2006, 08:27:20 PM
... und auf speziellen Wunsch ...
... der Code für die vom User abgegebenen Stimmen in member.php --- Show Profile --- ....
... in Anlehnung an : http://www.4homepages.de/forum/index.php?topic=6123.msg57740#msg57740
... Voraussetzung hierfür : http://www.4homepages.de/forum/index.php?topic=6123.0 Varinate A

Code: [Select]
//--- Nummer der abgegebenen Stimmen im Profil ---
    $lang['user_votes'] = "Abgegebene Bewertungen:";
    $lang['vot'] = "Bewertungen";
    $sql = "SELECT COUNT(vote) AS user_votes FROM ".VOTED_TABLE." WHERE user_id = ".$user_id;
    $result = $site_db->query_firstrow($sql);
    $user_votes = $result['user_votes'];
    $lang_user_votes = $lang['user_votes'];
    $lang_vot = $lang['vot'];
    $site_template->register_vars(array(
    "user_votes" => $user_votes,
    "lang_user_votes" => $lang_user_votes,
    "lang_vot" => $lang_vot,
    ));
//--- Nummer der abgegebenen Stimmen im Profil ---

jetzt kannst du in deiner member_profile.html folgende Tags verwenden :
Code: [Select]
<b>{user_lang_votes}</b> {user_votes} {vot}

PS. ist aber ungetestet, da ich auch die Struktur der Tabelle nicht weiter kenne ... !

mawenzi
Title: Re: Req: Total User Votes (from images) in profile .
Post by: trez on January 26, 2006, 10:21:51 PM
FUNZT! Vielen vielen dank ;)