Create a new buddypress tab with pagination: Error in pagination or error in active tab css

Hi,

I have created a tab with a list of posts in the user profile page of buddypress, example: http://ggsalas.staging.wpengine.com/miembros/ggsalas/publicaciones/

The code I use is this:

bp_core_new_nav_item( array(
'name' => __( 'Publicaciones', 'buddypress'),
'slug' => 'publicaciones' ,
'parent_url' => $bp->displayed_user->domain . 'publicaciones' ,
'screen_function' => 'funcion_tab_publicaciones',
'position' => 40,
'default_subnav_slug' => 'todas',
) );

// SUBNAV
// name, slug, parent_url, parent slug, screen function
bp_core_new_subnav_item( array(
'name' => __( 'Todas', 'buddypress' ),
'slug' => 'todas',
'parent_url' => $bp->displayed_user->domain . 'publicaciones/' ,
'parent_slug' => 'publicaciones',
'screen_function' => 'funcion_tab_publicaciones',
) );

function funcion_tab_publicaciones() {
//add title and content here - last is to call the members plugin.php template
//add_action( 'bp_template_title', 'funcion_tab_publicaciones_title' );
add_action( 'bp_template_content', 'funcion_tab_publicaciones_content' );
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
}
function funcion_tab_publicaciones_content() {
global $post;
// arguments, adjust as needed
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'author' => bp_displayed_user_id(),
'paged' => get_query_var( 'paged' )
);

global $wp_query;
$wp_query = new WP_Query( $args );

do_action('genesis_loop');
wp_reset_query();
}

And my problem is that the pagination not work because It sends me to a wrong url. The pagination sends to: http://ggsalas.staging.wpengine.com/miembros/ggsalas/publicaciones/page/2/

instead of: http://ggsalas.staging.wpengine.com/miembros/ggsalas/publicaciones/todas/page/2/


I can resolve this with this another code:

bp_core_new_nav_item( array(
'name' => __( 'Publicaciones', 'buddypress'),
'slug' => 'publicaciones/todas' ,
'parent_url' => $bp->displayed_user->domain ,
'screen_function' => 'funcion_tab_publicaciones',
'position' => 40,
'default_subnav_slug' => 'todas',
) );

// SUBNAV
// name, slug, parent_url, parent slug, screen function
bp_core_new_subnav_item( array(
'name' => __( 'Todas', 'buddypress' ),
'slug' => 'todas',
'parent_url' => $bp->displayed_user->domain . 'publicaciones/' ,
'parent_slug' => 'publicaciones',
'screen_function' => 'funcion_tab_publicaciones',
) );

But I have another problem: the “publicaciones” page not have the css of “active tab”. See the example on: http://redminka.com/miembros/ggsalas/publicaciones/todas/

I hope must be explained well the problem. I’m very confusing, I tried a lot but I can’t find a way to solve this.

Best regards