bp_xprofile_ajax_remove_signup_field()

Removes a field from signup fields.


Source Source

File: bp-xprofile/bp-xprofile-admin.php

function bp_xprofile_ajax_remove_signup_field() {
	// Check the nonce.
	check_admin_referer( 'bp_reorder_fields', '_wpnonce_reorder_fields' );

	if ( ! isset( $_POST['signup_field_id'] ) || ! $_POST['signup_field_id'] ) {
		return wp_send_json_error();
	}

	$signup_field_id = (int) wp_unslash( $_POST['signup_field_id'] );

	// Validate the field ID.
	$signup_position = bp_xprofile_get_meta( $signup_field_id, 'field', 'signup_position' );

	if ( ! $signup_position ) {
		wp_send_json_error();
	}

	bp_xprofile_delete_meta( $signup_field_id, 'field', 'signup_position' );

	/**
	 * Fires when a signup field is removed from the signup form.
	 *
	 * @since 8.0.0
	 */
	do_action( 'bp_xprofile_removed_signup_field' );

	wp_send_json_success();
}


Top ↑

Changelog Changelog

Changelog
Version Description
8.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.