In first place, sorry for my english...i am spanish and...

Some time ago I'm looking for a solution to this problem that apparently should not be too complicated to implement. Let me explain.
I installed the module "Userpoints" for users of a website I'm creating obtain points based on their participation.
Once everything is installed and running, I got the idea to create a ranking with scores of users based on their points. To achieve this I got the module "User points to contributors ", which creates a list sorted by the votes of the users, resulting in more or less what I wanted.

However, making a deeper analysis, I realized that is not exactly what I wanted, although the latter module can serve me to create a general list. Actually, what I want is to put the ranking of a user (user obtained points) in the User tab. For a better understanding of what I mean, here's an example:

A user participating in the web and get 36 points and appears in the ranking at Number 4. Well, what I mean is that when the user clicks its tab user (user profile), see their points (36) and their place in the ranking (4th) in a block or something.

I tried with a view and some programming in php that I could find here, and nothing, there is no way. And I wonder, because a feature of this type looks like something that is usually seen in many websites.

Does anyone know how to get such functionality?

"Any idea how to work? Any help? Please!

In any case,
Greetings to the whole community
Barry Collins

Comments

Fidelix’s picture

Subscribing...

I really need this too

dcine’s picture

Ok, finally i used this:

<?php
$user_rank = db_result(db_query("SELECT rank FROM {userpoints_top_contributors} where uid = %d", $uid));
?>

<div class="rank"><div class="tag">Ranking:</div><?php print $user_rank?></div>

The first code is for the user points, the second for the user rank (the div class is for css)

I hope it serves you, it works for me.

Greetings
Barry Collins

Fidelix’s picture

Oh god... its just that easy?

I should have checked the userpoints table...

Thank you dcine!

berdir’s picture

That table comes from http://drupal.org/project/userpoints_top_contributors.

Doing the same with just userpoints.module is a bit more complex.

dcine’s picture

Yeah, yeah sorry for forgetting, but it's true, you must install the module beforehand "Userpoints top contributors". You can then use the code above.

Greetings
Barry Collins

glitz’s picture

i have "Userpoints top contributors" installed but i still cant get this to show. maybe im doing it wrong, i have this code entered in a custom php field in views....

glitz’s picture

i made sure i added the "Userpoints: User" relationship as well....

All I see is:

Ranking: (blank)

for each member...

berdir’s picture

Status: Active » Fixed

Well, you need to figure out what you need to use instead of $uid.

Anyway, what you really want is views integration for the userpoints_top_contributors module, using the custom PHP code is a bad alternative since it executes a query for every row in your result.

I'm setting this to fixed, I suggest to open up follow-up issues in the userpoints_top_contributors module.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.