When someone gets userpoints they don't get updated in their profile, but they do in the "top contributers".

Any way to make userpoints show the correct points in the profiles or simply remove them from the user profiles?

Comments

TSNetwork’s picture

I managed to delete userpoints from showing in user's profiles but I still wonder why it always showed 0 points...

Great module though, very useful for motivating people!

tobiasb’s picture

StatusFileSize
new971 bytes

here comes a patch, i hope this is right mr maintainer :D

tobiasb’s picture

Status: Active » Needs review
kbahey’s picture

Can we get some people to test this?

Also @jredding, what do you think?

fred0’s picture

Yep, that seems to work just fine. However, the "User's makeup points" block does not seem to show all points for all categories. I have 3 categories and 1 point in each and, while this patch makes the user profile display 3, the block displays 1.

TSNetwork’s picture

How to apply the patch? :]
Thanks for fixing this.

vm’s picture

jredding’s picture

hhmm...I worry about the performance implications of this. When doing
userpoints_get_current_points($uid, 'all')
it causes the following query
SELECT SUM(points) FROM {userpoints} WHERE uid = %d'

While I think this is OK from time to time I don't get a warm fuzzy feeling when implementing this as the default setting.

Maybe we make this is a, yet another, setting in the admin settings?

fred0’s picture

OK... but how then do we solve the original problem? The profile display doesn't show all points. Why would one want to toggle a bug in and off in the admin settings?

jredding’s picture

Category: bug » support

fred0 what is a bug to you isn't a bug to everyone.

Point categorization is used, by many (including me) to "segregate" points not to combine them. Thus making the default 'all' (which SUMs all categories of points) a bug to me.

What is needed is a better way of showing these points on the user profile page.

We can do it simply to what's on the /myuserpoints page.. i.e
category a 5
category b 10
and so on.

OR we can present an option to the admin to select which category of points is displayed on the user profile page (a quick dropdown)

OR we can do a hybrid of both

fred0’s picture

Yes, understood.

Since the myuserpoints page provides the category detail, I'm not sure there's much call for replicating it on the profile page (but there's always someone who might want it, I guess).

As for option 2, I think multiple select checkboxes would be more useful to allow one to choose a (sub)set of categories to sum on the profile page.

jredding’s picture

SUMing individual categories on the user profile page is functionality that isn't provided anywhere else in the module and I can hardly find that useful.

My suggestion was to provide a select box to choose ONE category to display or the option to display ALL (summed).

jredding’s picture

Status: Needs review » Active

OK I implemented a new choice under the categories to allow an admin to choose which category is displayed on the user's profile page. You can also choose "All" which will display a SUM of all categories.

If more functionality than this is provided we should take it to http://groups.drupal.org/user-points and work out a good model.

jredding’s picture

this was implemented in dev so give it a few hours or check out directly from the DRUPAL-6--1 branch.

jredding’s picture

Component: Code: userpoints_basic » Code: userpoints API
Status: Active » Fixed

A solution was written and committed for this. I'm setting as fixed. Comments on the approach are welcome.

Status: Fixed » Closed (fixed)

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

fred0’s picture

Status: Closed (fixed) » Active

Sorry, have to set this back to active. I fully support the approach committed to dev, but it doesn't seem to be working.
Specifically, the array_merge function of this bit at line 413 seems to bork the storage of the variable id:

    $all_option = array('all' => 'All');
	  $form[$group][USERPOINTS_CATEGORY_PROFILE_DISPLAY_TID] = array(
	    '#type' => 'select',
	    '#title' => t('Category to display on the user profile page'),
	    '#default_value' => variable_get(USERPOINTS_CATEGORY_PROFILE_DISPLAY_TID, NULL),
	    '#options' =>  array_merge($all_option, userpoints_get_categories()),
	    '#description' => t('Select which category of !points to display on the user profile page. Select "All" to display a sum total of all categories', userpoints_translation()),
	  );

The term_data id seems to get truncated to a single digit. In my case, my userpoints taxonomy category ids are 22, 23, 24 and 25. The function saves them to as 2, 3, 4, or 5.
As a test, I replaced the options line with just '#options' => userpoints_get_categories(), and it then saves the id properly. Of course, this doesn't provide the All option, but it was just a test.

fred0’s picture

Oh, let me add that the All option is the only one that works with the array_merge function.

jredding’s picture

tested this with taxonomy ids <10, I will test again with large IDs.

jredding’s picture

Assigned: Unassigned » jredding

I checked in new code that removed the use of array_merge but retained the "all" option.

Please check and make as fixed if corrected.

fred0’s picture

Status: Active » Fixed

Yes, that works!

Status: Fixed » Closed (fixed)

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

giggler’s picture

StatusFileSize
new45.78 KB

Sorry to open this up again, but is this fixed in the latest release because I just updated it to the latest and when creating content type it will have "User * earned 1 points Total now is 0 points."

In the My Point page. It will list the points by each instance, but the total on the bottom is all wrong. The points in profile also shows as "0" still while it shows the correct points under "top contributor":

(see attached image)
Uncategorized points Balance: 0
Userpoint for Login points Balance: 1

Approved points Balance: 1
Points awaiting moderation: 0
Net points Balance: 1

giggler’s picture

ok, I've just reset all the points and tried it again and the points in the profile page does show the correct number now..

Passionate_Lass’s picture

Hi.

Is this patch going to be built into the userpoints module soon? I'm working on a production site which is having this issue and I'm skittish about applying patches as it is a production site, but also because despite having TRIED several times to apply patches it ends up being a real ordeal.

vm’s picture

jredding in #20 posted the comment in February of 09, and the last 6.x-1.0 release is from January.

based on my reading of the issue, the patch was a put into 6.x-1.x-dev and is likely still there awaiting a roll into a release other than -dev.

Passionate_Lass’s picture

Ah. Ok this is why I'm still experiencing the issue. :) Do we know when abouts they will roll out a new release?

vm’s picture

I'd guess when enough users test -dev and state that the patch has fixed the issue

Passionate_Lass’s picture

I'm going to be adding the dev module. If it works for me to fix this bug I'll be posting here. :)

Passionate_Lass’s picture

Issue resolved for me now by updating to the dev version. :) Found the setting to "display all" points on profile.

adam_c’s picture

Sorry to re-open this but I didnt really want to create a new post when the question I want answering has gone un-answered in here.

In the original post, the question was asked... 'how can you remove the user points block from the profile page altogether?'

Could anyone answer this please?