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 $query = db_query("SELECT title, value, tid FROM {user_titles} ORDER BY value DESC"); to $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

CommentFileSizeAuthor
user_titles.module.patch745 byteseric-alexander schaefer

Comments

eric-alexander schaefer’s picture

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

agileware’s picture

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.

agileware’s picture

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

Status: Fixed » Closed (fixed)

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