Well, of course fetch_musername() will be called at least once for each different user. The function does check the $user array that's passed as the first parameter to see if the musername field is set already, and if it is it returns right away. But of course that doesn't guarantee that it won't be called twice for a given user, if the same user array isn't passed both times.
You could make your code check for $user['field16'] being set before you do the query. And if still find your query is being done more than once per user, you could build you own cache. (You can see how many times your query is called by turning on debug mode and looking at the list of queries at the bottom of the page).
Edit:
Quote:
Originally Posted by James Birkett
Will this query be ran once and cached - or will it be ran every time the fetch_musername hook is ran?
|
To answer this specifically, with the code you posted above it will be run each time the fetch_musername hook is run