Skip to:
Content
Pages
Categories
Search
Top
Bottom

Problems inserting url using xprofile_set_field_data


  • msteudel
    Participant

    @msteudel

    I’m using xprofile_set_field_data() to update a user’s profile automatically. I’m trying to insert a particular URL into their profile. I can see it inserted properly in the db, but when I view it in a profile I see that it’s been converted into an an anchortag, but it appears to be escaped improperly.

    Screen shot:
    https://www.evernote.com/shard/s194/sh/dd2cfe8b-1665-4988-9c99-362b1ffeaa27/c6f13683768f9b9d493e707a1fe8ad81

    Example value copy pasted from db:
    http://connect.allianceofbaptists.org/resources/user/125

    My Code:

    public function update_profile_field()
        {
            $field_id = $_POST['field_id'];
            $user_id = $_POST['user_id'];
            $value = $_POST['value'];
            $wp_update_hash = $_POST['hash'];
    
            if( $wp_update_hash != 'some hash' ) {
                return json_encode( array( 'error' => 'Unauthorized request') );
            }
            return var_export( xprofile_set_field_data( $field_id, $user_id, $value, $is_required = false ), true );
        }

    Am I inserting the data in wrong?

  • The topic ‘Problems inserting url using xprofile_set_field_data’ is closed to new replies.
Skip to toolbar