Opened 13 years ago
Closed 13 years ago
#3806 closed enhancement (fixed)
Deprecate sprintf() in 'alt' param of bp_core_fetch_avatar()
Reported by: | boonebgorges | Owned by: | |
---|---|---|---|
Milestone: | 1.6 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Core | Keywords: | |
Cc: |
Description
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.
Attachments (1)
Change History (17)
#3
@
13 years ago
- Keywords dev-feedback removed
r5466 takes care of much of this ticket. It changes the logic in bp_core_fetch_avatar(), and it changes all calls to bp_core_fetch_avatar() throughout the members component so that full literals are passed as 'alt'. I'll work my way through the rest of the components over the next few days, though this commit gives us the bulk of the benefit.
This patch is getting tiresome so I'm going to post a half-done version of it. I want to make sure that no one has a problem with this before devoting the energy to finishing it.