BuddyDev

Search

BuddyPress Xprofile Custom Field Types – Images upload – Registration page

  • Participant
    Newton on #52888

    So our dating site requires people to apply for membership and admins review it before activation, we use BuddyPress Xprofile Custom Field Types to add Image field to the signup form so they can upload their photo for us to review first, its been working for over a year now and with some custom code to Buddypress files to show the image preview in the pending profile section of the users part we can view details before approving as a full user.

    This custom coding was done in class-bp-members-admin.php and this was the code that worked:

    <!— custom code for image preview and Verification —->

    <?php
    $user = get_user_by_email($signup->user_email);
    $user_id = $user->ID;

    $verification = esc_html( $fdata[ $pid ] );

    if($pid==759)
    {
    global $wpdb;
    $bp_xprofile_data = $wpdb->prefix.”bp_xprofile_data”;
    $metadata = $wpdb->get_var(“SELECT value FROM “.$bp_xprofile_data.” WHERE field_id=”.$pid.” AND user_id=”.$user_id.” “);

    $url = “wp-content/uploads/”.$metadata;
    $imgUrl = site_url($url);
    ?>

    ” width=”100%” alt=”<?php echo esc_html( $signup->user_name ); ?>” >
    <?php
    }
    ?>

    Now not sure if since buddypress update 2 weeks ago or wordpress update, when using your pulgin to upload image in the registration form it no longer uploads the image and creates the file path for this code above to pull and show the image.

    Been spending 2 days trying to figure out why your plugin has stopped uploading media.

  • Keymaster
    (BuddyDev Team)
    Posts: 24534
    Brajesh Singh on #52896

    Hi Newton,
    Welcome to BuddyDev support forums.

    Thank you for reporting the issue.

    We handle file upload on ‘xprofile_data_before_save` (when a profile field data is saved to the database).

    In BuddyPress 14.0, The registration does not store any data in xprofile table unless the user account is activated(Internally account is created after activation now).

    That is causing the issue. There may be a solution by forcing creation of account.

    Please put this in your bp-custom.pjp

    
    
    add_filter( 'bp_signups_create_user', '__return_true' );
    
    

    Let me know if that works or not?

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved