Skip to:
Content

BuddyPress.org

Opened 13 years ago

Closed 13 years ago

#3233 closed enhancement (fixed)

Cutdown the queries for Xprofile select/Multiselect field

Reported by: sbrajesh's profile sbrajesh Owned by: sbrajesh's profile 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)

xprofil-select-multiselect-field-patch.patch (2.6 KB) - added by sbrajesh 13 years ago.

Download all attachments as: .zip

Change History (5)

#1 @DJPaul
13 years ago

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).

#2 @sbrajesh
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).

#3 @DJPaul
13 years ago

  • Milestone changed from Awaiting Review to 1.3

#4 @djpaul
13 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [4431]) Don't do multiple queries when editing xprofile select/radio/checkboxes. Fixes #3233, props sbrajesh

Note: See TracTickets for help on using tickets.