BP_Group_Extension::call_edit_screen_save()

Check the nonce, and call the edit_screen_save() method.


Source Source

File: bp-groups/classes/class-bp-group-extension.php

	public function call_edit_screen_save() {
		if ( empty( $_POST ) ) {
			return;
		}

		// When DOING_AJAX, the POST global will be populated, but we
		// should assume it's a save.
		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
			return;
		}

		$this->check_nonce( 'edit' );

		// Detect whether the screen_save_callback is performing a
		// redirect, so that we don't do one of our own.
		add_filter( 'wp_redirect', array( $this, 'detect_post_save_redirect' ) );

		// Call the extension's save routine.
		call_user_func( $this->screens['edit']['screen_save_callback'], $this->group_id );

		// Clean up detection filters.
		remove_filter( 'wp_redirect', array( $this, 'detect_post_save_redirect' ) );

		// Perform a redirect only if one has not already taken place.
		if ( empty( $this->post_save_redirect ) ) {

			/**
			 * Filters the URL to redirect to after group edit screen save.
			 *
			 * Only runs if a redirect has not already occurred.
			 *
			 * @since 2.1.0
			 *
			 * @param string $value URL to redirect to.
			 */
			$redirect_to = apply_filters( 'bp_group_extension_edit_screen_save_redirect', bp_get_requested_url( ) );

			bp_core_redirect( $redirect_to );
			die();
		}
	}


Top ↑

Changelog Changelog

Changelog
Version Description
1.8.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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