Tagged: behaviour, bp, bug, completion, nasty
Dear Devs,
we fought with a nasty behaviour within BP_Profile_Completion for months now which prevents users from being able to access the site.
The bug and original root cause might lay somewhere else, but still BP_Profile_Completion has a not 100% fail-safe programmed behaviour.
Within has_required_field_data(), you check whether the user has filled the required profile fields. It may happen that within xprofile_data table, specific data is entered redundantly. Hence, the query
SELECT field_id, value FROM {$table} WHERE user_id = %d AND field_id IN {$fields_list}
may possibly (which was the case pretty often for us) MORE rows than unique field_ids.You could simply add ” GROUP BY field_id” to the end of the query, making sure, e.g. for 6 required fields, that only 6 rows are returned. OR simply change the line:
if ( count( $profile_entries ) != count( $required_fields ) ) {
to:
if ( count( $profile_entries ) < count( $required_fields ) ) {
(because we need AT LEAST X profile entries).
This way, it greatly improves robustness.We fixed it ourselves – and simply hope – if you ever gonna release a new version, please consider fixing it as well.
Thanks
Hi,
Welcome to Buddydev.Thank you for reporting the issue and proposing the solution. This might have append on multi check/options field.
I appreciate you sharing the solution. The GROUP BY clause will definatey fix it. We will update the code with it.
Thank you
BrajeshHi Aleks,
Welcome to BuddyDev and thank you for reminding us about the issue.
I am sorry, we missed this as it does not happen in normal fields.
There will be an update available in next 24 hours.For your last question:- We are just the normal kind of devs who might miss couple of topics sometimes but when reminded, we make sure to resolve them.
Thank you
BrajeshPlease upgrade to 1.1.0 . it contains the fix.
Regards
Brajesh
You must be logged in to reply to this topic.