From 636753bb002453a85fd83ef2a6f3a28d5db6d207 Mon Sep 17 00:00:00 2001 From: Kelly Dwan Date: Wed, 11 Dec 2019 16:11:13 -0500 Subject: [PATCH] My Pledges: Require profile to be filled out before confirming a pledge (#127) This will disable the "join organization" button until the profile is complete, and add a second warning message to explicitly tell the user why the button is disabled. --- plugins/wporg-5ftf/views/list-my-pledges.php | 14 +++++++++++++- plugins/wporg-5ftf/views/single-my-pledge.php | 4 ++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/plugins/wporg-5ftf/views/list-my-pledges.php b/plugins/wporg-5ftf/views/list-my-pledges.php index 3826894..3685a1f 100644 --- a/plugins/wporg-5ftf/views/list-my-pledges.php +++ b/plugins/wporg-5ftf/views/list-my-pledges.php @@ -16,6 +16,7 @@ use WP_User, WP_Post; */ $has_contributions = $contributor_pending_posts || $contributor_publish_posts; +$has_profile_data = $profile_data['hours_per_week'] && $profile_data['team_names']; ?> @@ -30,7 +31,7 @@ $has_contributions = $contributor_pending_posts || $contributor_publish_posts; - +

+ +
+

+ update your profile before joining an organization.', 'wporg-5ftf' ), + 'https://profiles.wordpress.org/me/profile/edit/group/5/' + ) ); ?> +

+
+ + post_parent ); diff --git a/plugins/wporg-5ftf/views/single-my-pledge.php b/plugins/wporg-5ftf/views/single-my-pledge.php index 80136b3..785e80b 100644 --- a/plugins/wporg-5ftf/views/single-my-pledge.php +++ b/plugins/wporg-5ftf/views/single-my-pledge.php @@ -4,6 +4,7 @@ namespace WordPressDotOrg\FiveForTheFuture\View; /** * @var WP_Post $contributor_post + * @var bool $has_profile_data * @var WP_Post $pledge */ @@ -51,6 +52,9 @@ namespace WordPressDotOrg\FiveForTheFuture\View; class="button button-default" name="join_organization" value="Join Organization" + + disabled="disabled" + />