mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-04-19 01:43:44 +03:00
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.
This commit is contained in:
parent
bdbf6d573e
commit
636753bb00
|
@ -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;
|
|||
<?php esc_html_e( 'My Pledges', 'wporg-5ftf' ); ?>
|
||||
</h1>
|
||||
|
||||
<?php if ( $profile_data['hours_per_week'] && $profile_data['team_names'] ) : ?>
|
||||
<?php if ( $has_profile_data ) : ?>
|
||||
<p class="my-pledges__dedication">
|
||||
<?php echo esc_html( sprintf(
|
||||
_n(
|
||||
|
@ -85,6 +86,17 @@ $has_contributions = $contributor_pending_posts || $contributor_publish_posts;
|
|||
<div class="my-pledges__list is-pending-list">
|
||||
<h2><?php esc_html_e( 'Pending Pledges', 'wporg-5ftf' ); ?></h2>
|
||||
|
||||
<?php if ( ! $has_profile_data ) : ?>
|
||||
<div class="notice notice-error notice-alt">
|
||||
<p>
|
||||
<?php echo wp_kses_data( sprintf(
|
||||
__( 'You need to <a href="%s">update your profile</a> before joining an organization.', 'wporg-5ftf' ),
|
||||
'https://profiles.wordpress.org/me/profile/edit/group/5/'
|
||||
) ); ?>
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
foreach ( $contributor_pending_posts as $contributor_post ) {
|
||||
$pledge = get_post( $contributor_post->post_parent );
|
||||
|
|
|
@ -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"
|
||||
<?php if ( ! $has_profile_data ) : ?>
|
||||
disabled="disabled"
|
||||
<?php endif; ?>
|
||||
/>
|
||||
|
||||
<input
|
||||
|
|
Loading…
Reference in a new issue