Skip to content

Commit

Permalink
Directory: Redirect button links back to referer.
Browse files Browse the repository at this point in the history
See #5.
  • Loading branch information
r-a-y committed Oct 5, 2015
1 parent 0d6af43 commit bae962c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion includes/hooks-buddypress-profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,11 @@ function cacsp_profile_action_handler() {
return;
}

$redirect = bp_displayed_user_domain() . 'papers/';
if ( false !== strpos( wp_get_referer(), get_post_type_archive_link( 'cacsp_paper' ) ) ) {
$redirect = get_post_type_archive_link( 'cacsp_paper' );
} else {
$redirect = bp_displayed_user_domain() . 'papers/';
}

switch ( bp_current_action() ) {
// delete paper
Expand Down
2 changes: 2 additions & 0 deletions templates/content-directory-social-paper-buddypress.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

<?php cacsp_get_template_part( 'archive-header', 'social-paper' ); ?>

<?php do_action( 'template_notices' ); ?>

<div class="item-list-tabs" role="navigation">
<ul>
<li class="selected" id="papers-all"><a href="<?php echo esc_url( get_post_type_archive_link( 'cacsp_paper' ) ); ?>"><?php printf( __( 'All Papers <span>%s</span>', 'social-paper' ), $GLOBALS['wp_query']->found_posts ); ?></a></li>
Expand Down

0 comments on commit bae962c

Please sign in to comment.