admin rating badge

Review Request #85 - Created May 16, 2009 and submitted

Information
Savin Tiberiu
infoarena
Reviewers
hackers
Admin rating badges are kind of orange irelevant of their rating. 

Mircea Pasoi
This looks ok since user_get_by_username is cached.
Bogdan-Cristian Tătăroiu
Can you run the benchmark script before and after this change?

It seems to me fetching the user from cache/database again every time you render his rating is a little redundant and on pages such as rankings it's going to slow things down. This should be done be passing an extra is_admin parameter to format_user_{link,tiny,normal} just like with $rating. The information about the user is already being fetched every time before calling these 3 functions, we should just reuse that information.

It also seems to me these three functions should have just received a $user object with all the information returned by user_get_by_username so that when any of the format_user_* functions are changed we don't have to search for all their appearances in the code and change what parameters are being passed. If I'm correct all this information is being fetched every time before calling format_user_* anyway.
  1. I think SMF doesn't have the whole $user at hand before calling format_user_*, though it could be fixed easily.
    
  2. I'm on it :)
  3. Unfortunately this problem is not only for SMF. When we take an object (page, task, round etc) we also take it's owner (or author) and we only take from the database his name, his username and his rating cache. Passing to format_user_* the whole user object would mean modifying a large number of queries. It can be done but it's not that easy and it doesn't stand with the ticket description. I think we could leave it like this for the time being and place another ticket for this.
Loading...