How to only show profile tab if user has posts
-
This doesn’t work…thought it did at one point but just can’t get it to go now. Is there a better way to only show a custom post tab if user has posts.
add_action('bp_setup_nav', 'mb_bp_user_posts' ); function mb_bp_user_posts() { global $bp; $user_post_count = count_user_posts(bp_displayed_user_id() , 'post' ); if($user_post_count) { bp_core_new_nav_item( array( 'name' => 'Posts', 'slug' => 'posts', 'position' => 10, 'screen_function' => 'post_submenu_redirect', ) ); } }
- You must be logged in to reply to this topic.