Commit 93dbc4ca authored by John James Jacoby's avatar John James Jacoby
Browse files

Rearrange links and template inclusion.

This should fix issues with not being able to join/cancel after having already created an account and logged back in.
parent 9fae7806
Pipeline #881 skipped
......@@ -49,9 +49,9 @@ function wp_join_page_maybe_do_request() {
// Remove pending role
if ( 'cancel' === $_REQUEST['access'] ) {
delete_user_option( get_current_user_id(), 'capabilities' );
wp_join_page_clear_user_capabilities( get_current_user_id() );
} elseif ( 'request' === $_REQUEST['access'] ) {
delete_user_option( get_current_user_id(), 'capabilities' );
wp_join_page_clear_user_capabilities( get_current_user_id() );
wp_get_current_user()->set_role( 'pending' );
}
......
......@@ -13,7 +13,17 @@
<div class="header"><?php echo wp_get_current_user()->display_name; ?></div>
<?php echo esc_html( wp_get_current_user()->user_email ); ?>
</div>
<a href="<?php echo esc_url( wp_join_page_get_dashboard_url() ); ?>" class="ui bottom attached blue button"><?php echo wp_join_page_get_string( 'go_to_dashboard' ); ?></a>
<?php if ( wp_join_page_is_user_pending() ) : ?>
<a href="<?php echo esc_url( wp_join_page_get_access_url() ); ?>" class="ui bottom attached blue button"><?php echo wp_join_page_get_string( 'cancel_request' ); ?></a>
<?php else : ?>
<a href="<?php echo esc_url( wp_join_page_get_dashboard_url() ); ?>" class="ui bottom attached blue button"><?php echo wp_join_page_get_string( 'go_to_dashboard' ); ?></a>
<?php endif; ?>
</div>
<input type="hidden" id="username" name="username" value="<?php echo esc_attr( wp_get_current_user()->user_login ); ?>">
......
......@@ -13,17 +13,7 @@
<div class="header"><?php echo wp_get_current_user()->display_name; ?></div>
<?php echo esc_html( wp_get_current_user()->user_email ); ?>
</div>
<?php if ( wp_join_page_is_user_pending() ) : ?>
<a href="<?php echo esc_url( wp_join_page_get_access_url() ); ?>" class="ui bottom attached blue button"><?php echo wp_join_page_get_string( 'cancel_request' ); ?></a>
<?php else : ?>
<a href="<?php echo esc_url( wp_join_page_get_access_url() ); ?>" class="ui bottom attached blue button"><?php echo wp_join_page_get_string( 'request_access' ); ?></a>
<?php endif; ?>
<a href="<?php echo esc_url( wp_join_page_get_access_url() ); ?>" class="ui bottom attached blue button"><?php echo wp_join_page_get_string( 'request_access' ); ?></a>
</div>
<input type="hidden" id="username" name="username" value="<?php echo esc_attr( wp_get_current_user()->user_login ); ?>">
......
......@@ -4,12 +4,12 @@
if ( is_user_logged_in() ) {
// Already a member of this site
if ( is_user_member_of_blog() && ! wp_join_page_is_user_pending() ) {
wp_join_page_get_template_part( 'forms/already-member' );
if ( ! is_user_member_of_blog() ) {
wp_join_page_get_template_part( 'forms/request-access' );
// Not a member, but logged in, so give them a simple form
} elseif ( ! wp_join_page_is_user_pending() ) {
wp_join_page_get_template_part( 'forms/request-access' );
} elseif ( is_user_member_of_blog() || wp_join_page_is_user_pending() ) {
wp_join_page_get_template_part( 'forms/already-member' );
// Some kind of other setup (super admin, etc...)
} else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment