[buddypress-trac] [BuddyPress] #3806: Deprecate sprintf() in 'alt' param of bp_core_fetch_avatar()

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Wed Dec 7 20:01:33 UTC 2011

#3806: Deprecate sprintf() in 'alt' param of bp_core_fetch_avatar()
 Reporter:  boonebgorges  |      Owner:
     Type:  enhancement   |     Status:  new
 Priority:  normal        |  Milestone:  1.6
Component:  Core          |    Version:
 Severity:  normal        |   Keywords:  dev-feedback
 bp_core_fetch_avatar() takes, as an 'alt' param, a string that is usually
 passed with arguments meant to be swapped out using sprintf() with some
 object data (group name, member display name, etc). The problem is that,
 in order to get this data, we have to call up group or member objects,
 which means a ton of extra queries (for data that is, moreover, almost
 always already available in an existing global).

 Can we deprecate the feature of bp_core_fetch_avatar() that
 allows/encourages folks to pass these kinds of strings? Instead, we should
 pass fully concatenated strings, and encourage plugins to do the same,
 using the data they already have available.

 We could maintain backpat by sniffing out '%s' in the alt param, if anyone
 thought it mattered that much.

 I'll post a patch shortly with my suggestion. Would be very easy to do for
 BP 1.6, and would give *huge* performance boosts in many situations -
 dozens fewer queries per page load, on directories.

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3806>
BuddyPress <http://buddypress.org/>

More information about the buddypress-trac mailing list