mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-04-22 02:53:43 +03:00
My Pledges: Return early if contributor_post_id is missing.
`process_my_pledges_form()` is actually called on page load in `render_my_pledges()`. So to prevent the unnecessary get_post() queries, let’s just return early if the form wasn’t really submitted. See #87
This commit is contained in:
parent
4b3586a487
commit
c47679a5cc
|
@ -306,11 +306,15 @@ function render_my_pledges() {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function process_my_pledges_form() {
|
function process_my_pledges_form() {
|
||||||
|
$contributor_post_id = filter_input( INPUT_POST, 'contributor_post_id', FILTER_VALIDATE_INT );
|
||||||
|
$nonce = filter_input( INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING );
|
||||||
|
if ( empty( $contributor_post_id ) || empty( $nonce ) ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$message = '';
|
$message = '';
|
||||||
$status = false;
|
$status = false;
|
||||||
$contributor_post_id = filter_input( INPUT_POST, 'contributor_post_id', FILTER_VALIDATE_INT );
|
|
||||||
$pledge = get_post( get_post( $contributor_post_id )->post_parent );
|
$pledge = get_post( get_post( $contributor_post_id )->post_parent );
|
||||||
$nonce = filter_input( INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING );
|
|
||||||
|
|
||||||
if ( filter_input( INPUT_POST, 'join_organization' ) ) {
|
if ( filter_input( INPUT_POST, 'join_organization' ) ) {
|
||||||
wp_verify_nonce( $nonce, 'join_decline_organization' ) || wp_nonce_ays( 'join_decline_organization' );
|
wp_verify_nonce( $nonce, 'join_decline_organization' ) || wp_nonce_ays( 'join_decline_organization' );
|
||||||
|
|
Loading…
Reference in a new issue