Download & Extend

For all users the title with the lowest count is returned

Project:User titles
Version:5.x-1.0
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

In user_titles.module the sorting in user_titles_get_titles() is broken. It was OK in rev 1.15.2.1 and got broken in 1.15.2.2.
Line 646 changed from

<?php
$query
= db_query("SELECT title, value, tid FROM {user_titles} ORDER BY value DESC");
?>
to
<?php
$query
= db_query("SELECT * FROM {user_titles} ORDER BY value");
?>

Note the missing sort order specification ("DESC").

Thats why user_titles_get_title() always returns the title with the lowest value.

HTH,
Eric

AttachmentSize
user_titles.module.patch745 bytes

Comments

#1

BTW: If the sort order switch was on purpose, then the condition in function user_titles_get_title() must be changed...

#2

Status:needs review» fixed

Hi Eric,

Thanks for picking this up. It was going to be an order switch on purpose but I have changed it back as it will also be safer that way in case other people are calling this function and are expecting it to be descending.

It has been fixed in the 5.x-1.x-dev version, which will be updated sometime in the next half day and a release will be made soon with the change.

#3

There is now a 5.x-1.1 release with this bug fixed.

#4

Status:fixed» closed (fixed)

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

nobody click here