bp_nouveau_submit_button( string $action,  $object_id )

Output a submit button and the nonce for the requested action.


Parameters Parameters

$action

(string) (Required) The action to get the submit button for. Required.


Source Source

File: bp-templates/bp-nouveau/includes/template-tags.php

function bp_nouveau_submit_button( $action, $object_id = 0 ) {
	$submit_data = bp_nouveau_get_submit_button( $action );
	if ( empty( $submit_data['attributes'] ) || empty( $submit_data['nonce'] ) ) {
		return;
	}

	if ( ! empty( $submit_data['before'] ) ) {

		/**
		 * Fires before display of the submit button.
		 *
		 * This is a dynamic filter that is dependent on the "before" value provided by bp_nouveau_get_submit_button().
		 *
		 * @since 3.0.0
		 */
		do_action( $submit_data['before'] );
	}

	$submit_input = sprintf( '<input type="submit" %s/>',
		bp_get_form_field_attributes( 'submit', $submit_data['attributes'] )  // Safe.
	);

	// Output the submit button.
	if ( isset( $submit_data['wrapper'] ) && false === $submit_data['wrapper'] ) {
		echo $submit_input;

	// Output the submit button into a wrapper.
	} else {
		printf( '<div class="submit">%s</div>', $submit_input );
	}

	$nonce = $submit_data['nonce'];
	if ( isset( $submit_data['nonce_placeholder_value'] ) ) {
		$nonce = sprintf( $nonce, $submit_data['nonce_placeholder_value'] );
	}

	if ( empty( $submit_data['nonce_key'] ) ) {
		wp_nonce_field( $nonce );
	} else {
		if ( $object_id ) {
			$submit_data['nonce_key'] .= '_' . (int) $object_id;
		}

		wp_nonce_field( $nonce, $submit_data['nonce_key'] );
	}

	if ( ! empty( $submit_data['after'] ) ) {

		/**
		 * Fires before display of the submit button.
		 *
		 * This is a dynamic filter that is dependent on the "after" value provided by bp_nouveau_get_submit_button().
		 *
		 * @since 3.0.0
		 */
		do_action( $submit_data['after'] );
	}
}


Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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