WordPress.org

Ready to get started?Download WordPress

Forums

Add BBpress Favorites Link in Admin Drop-Down Bar (1 post)

  1. csm2012
    Member
    Posted 1 year ago #

    Hello All,

    I am trying to add a link to bbpress 2.1.1 user favorites in the admin drop-down bar. I want to keep the forum as clean as possible so I do not want to add another drop-down menu on the bar. There is not a direct link to User Favorites because the code calls up the specific user id. I was able to add direct html links with Angela's code from this post

    Below is her code that you add to the admin-bar.php file:

    function remove_admin_bar_links() {
        global $wp_admin_bar;
        $wp_admin_bar->remove_menu('wp-logo');
        $wp_admin_bar->remove_menu('updates');
    }
    add_action( 'wp_before_admin_bar_render', 'remove_admin_bar_links' );
    
    function add_admin_bar_links() {
        global $wp_admin_bar;
        $wp_admin_bar->add_menu(array(
            'parent' => 'my-account-with-avatar',
            'id' => 'sup',
            'title' => __('Support Center'),
            'href' => "http://hosting.centilin.com/support/")
        );
    }
    add_action('admin_bar_menu', 'add_admin_bar_links');

    Here is the php code from the bbp plugin of the bbp-user-template.php file.

    /** Favorites *****************************************************************/
    
    /**
     * Output the link to the user's favorites page (profile page)
     *
     * @since bbPress (r2652)
     *
     * @param int $user_id Optional. User id
     * @uses bbp_get_favorites_permalink() To get the favorites permalink
     */
    function bbp_favorites_permalink( $user_id = 0 ) {
    	echo bbp_get_favorites_permalink( $user_id );
    }
    	/**
    	 * Return the link to the user's favorites page (profile page)
    	 *
    	 * @since bbPress (r2652)
    	 *
    	 * @param int $user_id Optional. User id
    	 * @uses bbp_get_user_profile_url() To get the user profile url
    	 * @uses apply_filters() Calls 'bbp_get_favorites_permalink' with the
    	 *                        user profile url and user id
    	 * @return string Permanent link to user profile page
    	 */
    	function bbp_get_favorites_permalink( $user_id = 0 ) {
    		return apply_filters( 'bbp_get_favorites_permalink', bbp_get_user_profile_url( $user_id ), $user_id );
    	}

    If anyone knows how I could merge the two codes to produce a user friendly link I would greatly appreciate it.

    Genuinely,

    CSM2012

Topic Closed

This topic has been closed to new replies.

About this Topic