BuddyDev

Search

Nasty “bug” in BP_Profile_Completion

  • Participant
    Level: Initiated
    Posts: 2
    SX 109 on #42311

    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

  • Keymaster
    (BuddyDev Team)
    Posts: 21837
    Brajesh Singh on #42316

    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
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved