How to hide CPT Links from profile view
- 
		For privacy issues I want to hide certain links on profile view. 
 i use the snippet, mentioned here (see script below):
 oneThis works fine with BP related links, but I cannot hide links from CPT like rtMedia and the link of this: `function bp_postsonprofile() { 
 add_action( ‘bp_template_content’, ‘profile_screen_posts_show’ );
 bp_core_load_template( apply_filters( ‘bp_core_template_plugin’, ‘members/single/plugins’ ) );
 }function profile_screen_posts_show() { $myposts = get_posts( array( 
 ‘posts_per_page’ => -1,
 ‘author’ => bp_displayed_user_id(),
 ‘post_type’ => ‘post’
 ));if( ! empty($myposts) ) { echo ‘<ul>’; foreach($myposts as $post) { 
 setup_postdata( $post );
 echo ‘<li><a href=”‘ . get_permalink($post->ID) . ‘”>’ . get_the_title($post->ID) . ‘</a></i>’;
 }echo ‘</ul>’; wp_reset_postdata(); } else { echo ‘<div class=”info” id=”message”><p>’. bp_displayed_user_fullname() .’ hat keine Beiträge veröffentlicht.</p></div>’; 
 }
 }add_action ( ‘profile_screen_posts_show’ );` function bpfr_hide_tabs() { 
 global $bp;
 /**
 * class_exists() & bp_is_active are recommanded to avoid problems during updates
 * or when Component is deactivated
 */if( class_exists( ‘bbPress’ ) || bp_is_active ( ‘groups’ ) ) : /** here we fix the conditions. 
 * Are we on a profile page ? | is user site admin ? | is user logged in ?
 */
 if ( bp_is_user() && !is_super_admin() && !is_user_logged_in() ) {/* and here we remove our stuff ! */ 
 bp_core_remove_nav_item( ‘activity’ );
 bp_core_remove_nav_item( ‘friends’ );
 bp_core_remove_nav_item( ‘groups’ );
 bp_core_remove_nav_item( ‘posts’ );
 bp_core_remove_nav_item( ‘forums’ );
 bp_core_remove_nav_item( ‘media’ );
 }
 endif;
 }
 add_action( ‘bp_setup_nav’, ‘bpfr_hide_tabs’, 15 );
- You must be logged in to reply to this topic.