Skip to:
Content

BuddyPress.org

Changeset 9001


Ignore:
Timestamp:
09/10/2014 09:29:19 PM (12 years ago)
Author:
imath
Message:

On BuddyPress pages, make sure the edit link is not displayed if the corresponding post ID is not set

This prevents the edit link to show at the bottom of BuddyPress pages and allow plugins to get an edit link in case they are using it (providing a post ID) in a BuddyPress page.

Fixes #5853

Location:
trunk/src/bp-core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-filters.php

    r8922 r9001  
    371371                        }
    372372
    373                 /** 
     373                /**
    374374                 * There can be a case where the user was created without the skip confirmation
    375375                 * And the super admin goes in pending accounts to resend it. In this case, as the
    … …  
    606606        return str_replace( 'meta_id', 'id', $q );
    607607}
     608
     609/**
     610 * Filter the edit post link to avoid its display in BuddyPress pages
     611 *
     612 * @since BuddyPress (2.1.0)
     613 *
     614 * @param  string $link    The edit link.
     615 * @param  int    $post_id Post ID.
     616 * @return mixed  Will be a boolean (false) if $post_id is 0. Will be a string (the unchanged edit link)
     617 *                otherwise
     618 */
     619function bp_core_filter_edit_post_link( $edit_link = '', $post_id = 0 ) {
     620        if ( 0 === $post_id ) {
     621                $edit_link = false;
     622        }
     623
     624        return $edit_link;
     625}
  • trunk/src/bp-core/bp-core-theme-compatibility.php

    r8994 r9001  
    559559
    560560        // If we are in theme compat, we don't need the 'Edit' post link
    561         add_filter( 'get_edit_post_link', '__return_false' );
     561        add_filter( 'get_edit_post_link', 'bp_core_filter_edit_post_link', 10, 2 );
    562562}
    563563
Note: See TracChangeset for help on using the changeset viewer.