Buddypress Starred button redirects users to their post page button
-
The New Feature in Buddypress Starred button redirects users to their post page button. I’ve added a button to users buddypress activity page which is titled Post that takes users to a page with a list of their Posts made to WordPress. With the new update when you click on the Starred button the user is redirected to the the list of posts. I created the Post button using this custom function I found Online.
/* ——————————Start BP Post in profile code for function——————– */
function importSomething(){
return include_once ‘bp-custom.php’;
}
add_action( ‘bp_setup_nav’, ‘buddyboss_child_bp_nav_adder’ );
add_action( ‘bp_template_content’, ‘profile_buddyboss_child_loop’ );
bp_core_load_template( apply_filters( ‘bp_core_template_plugin’, ‘members/single/plugins’ ) );function buddyboss_child_bp_nav_adder() {
global $bp;
$post_count = count_user_posts_by_type( $bp->displayed_user->id );
bp_core_new_nav_item(
array(
‘name’ => sprintf( __( ‘Posts <span>%d</span>’, ‘my-poems’ ), $post_count ),
‘slug’ => ‘Articles’,
‘position’ => 250,
‘show_for_displayed_user’ => true,
‘screen_function’ => ‘buddyboss_child_list’,
‘item_css_id’ => ‘articles’,
‘default_subnav_slug’ => ‘public’
));
}
function buddyboss_child_list() {
add_action( ‘bp_template_content’, ‘profile_buddyboss_child_loop’ );
bp_core_load_template( apply_filters( ‘bp_core_template_plugin’, ‘members/single/plugins’ ) );
}
/*——- This is end of the code for above function ———*/
function profile_buddyboss_child_loop() {
$myposts = get_posts( array(
‘posts_per_page’ => -1,
‘author’ => bp_displayed_user_id(),
‘post_type’ => ‘post’
));
if( ! empty($myposts) ) {
foreach($myposts as $post) {
setup_postdata( $post );
if (has_post_thumbnail( $post->ID ) ):
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘sidebar-smallthumbnew’ );
else :
$image[0] = “…/wp-content/themes/Starkers-Child-2/images/vidimage.jpg”;
endif;
echo ‘<li class=”sidebar mostpop post-‘ . $post->ID . ‘”><div id=”postimage”>ID) . ‘”></div><div id=”postinfo”>ID) . ‘”>’ . get_the_title($post->ID) . ‘</div>‘;
}
echo ‘‘;
wp_reset_postdata();
} else { ?>
<div class=”info” id=”message”>
<p><?php bp_displayed_user_fullname(); ?> has No posts.</p>
</div>
<?php }
}
/* This is end of the code for above function */
remove_filter(‘bp_setup_nav’,”);
function count_user_posts_by_type( $userid, $post_type = ‘post’ ) {
global $wpdb;
$where = get_posts_by_author_sql( $post_type, true, $userid, true);
$count = $wpdb->get_var( “SELECT COUNT(*) FROM $wpdb->posts $where” );
return apply_filters( ‘get_usernumposts’, $count, $userid );
}
/* ——————————This is end of the code for post in profile above function——————– */I dont want to get rid of the latest starred button feature, so How can I go about correcting this redirect error.
Also the new mobile take picture update doesn’t work on the mobile version of my site. I’m using WP-Smart mobile plugin to generate a mobile theme. I also have a copy of Buddypress in both my Child Theme and my active WP smart mobile theme.
How can I go about fixing these issues if possible.
Also, great exceptional work on these new updates.
Thank you
- The topic ‘Buddypress Starred button redirects users to their post page button’ is closed to new replies.