BuddyPress commone link to user/member profile

I need add static link to menu for redirect user to profile BuddyPress. But BP have only individual links for each user.

I writed short snippet for add root endpoint /my-profile/ and redirect to user profile.


//Add root endpoint /my-profile/
function wpcc_add_redirect_endpoint() {
    add_rewrite_endpoint( 'my-profile', EP_ROOT );
}
add_action( 'init', 'wpcc_add_redirect_endpoint' );

//Add redirect for endpoint
function wpcc_profile_redirect(){
  $check = get_query_var('my-profile', false);

  if($check === ''){
    wp_redirect(bp_loggedin_user_domain(get_current_user_id()));
  }
}
add_action( "template_redirect", 'wpcc_profile_redirect' );

Access control list for posts in WordPress

You can add the code in functions.php, include in plugin or copy file in /mu-plugins/

/*
* Filter posts in SQL
*/
if ( ! function_exists( 'acl_filter_posts_where' ) ) :


  function acl_filter_posts_where($where){

    global $wpdb;

    $current_user_id = get_current_user_id();

    $where .= " AND ($wpdb->posts.post_type != 'post'
                    OR $wpdb->posts.ID IN (
                      SELECT post_id
                      FROM $wpdb->postmeta
                      WHERE $wpdb->postmeta.post_id = $wpdb->posts.ID
                          AND $wpdb->postmeta.meta_key = 'cmdb_acl'
                          AND $wpdb->postmeta.meta_value like '%\"$current_user_id\"%'
                    ))";

    return $where;
  }

  add_filter('posts_where', 'acl_filter_posts_where');

endif;

Excerpt in Twenty Seventeen

The new version of WP appeared very interested theme Twenty Seventeen.

But for me need blog style with excerpts without full content.

And I created child theme and added code in functions.php

function the_content_loop_trim($content){

  if(is_archive() or is_home()){
    $post = get_post();
    $content = $post->post_content;
    $url = get_permalink($post->ID);
    $more = sprintf(' <a href="%s">...</a>', $url);
    $excerpt = wp_trim_words( $content, $num_words = 30, $more);
    $content = $excerpt;
  }

  return $content;
}
add_filter('the_content', 'the_content_loop_trim');