Opened 13 years ago
Closed 13 years ago
#3233 closed enhancement (fixed)
Cutdown the queries for Xprofile select/Multiselect field
Reported by: | sbrajesh | Owned by: | sbrajesh |
---|---|---|---|
Milestone: | 1.5 | Priority: | normal |
Severity: | Version: | 1.5 | |
Component: | Extended Profile | Keywords: | has-patch |
Cc: | sbrajesh |
Description
Hi,
Currently when we use select/multiselect field, buddypress makes one query per list item on the edit-profile/registration page.
It means, if we have 100 list items in the select field, it will do 100 queries.
here is a patch to fix it. With this patch, the no. of queries will not depend on the number of items in the list.
I have tested it on my current trunk version, please have a look.
Attachments (1)
Change History (5)
#2
@
13 years ago
If we look at the original code, that section of code does not do anything which will have any effect on working. I am sure, it is not affecting the security but a second opinon will be much better. My main goal was putting
$original_option_values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $options[$k]->parent_id ) );
outside the loop as it actually called the same thing every time. Please do test and let me know if we can improve further.
btw, we can do something similar for the checkboxes too(I really did not test the number of queries for checkboxses earlier, but seeing code, that seems also another candidate for change).
Are you sure the bit under "Check for updated posted values, but errors preventing them from being saved first time" isn't needed? I've not tested the patch (yet).