Replies
- Daniel on February 19, 2021 at 5:24 pm in reply to: How to redirect user to user profile page #36307This reply has been marked as private.
- Daniel on February 18, 2021 at 10:22 pm in reply to: Searching for plugin to create a BP custom user profile pic #36300
Hi Ravi,
Thanks but I am looking for a plugin to overwrite the grey standard anonymous profile pic of BuddyPress and replace it with a self-created pic. (I mean to replace the grey anonymous, random Buddypress Profile pic with a custom pic. I thought there is a plugin for that?
Thanks.
Regards
Daniel - Daniel on February 17, 2021 at 8:14 am in reply to: Buddypress Post Count to show on User BP page #36256
Hi Ravi,
Actually, I only have inserted the first code into functions.php and the code to call the function I haven’t inserted yet. But then when I uploaded the new functions.php, the website did not load anymore. It was a white screen with the following error message: “There has been a critical error on this website.” Therefore I guess something is wrong with the first code:
function count_user_posts_by_type($userid, $post_type='YOUR_CUSTOM_POST_TYPE') { global $wpdb; $where = get_posts_by_author_sql($post_type, TRUE, $userid); $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" ); return apply_filters('get_usernumposts', $count, $userid); }
By the way, shouldn’t it say in the beginning “add function” instead of only “function”?
Thanks for your time.
Regards,
Daniel - Daniel on February 16, 2021 at 12:21 pm in reply to: Buddypress Post Count to show on User BP page #36246
Hi Brajesh,
I had used this exact code in child theme functions.php
function count_user_posts_by_type($userid, $post_type='YOUR_CUSTOM_POST_TYPE') { global $wpdb; $where = get_posts_by_author_sql($post_type, TRUE, $userid); $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" ); return apply_filters('get_usernumposts', $count, $userid); }
And then for the Buddypress member-header.php I have added this code:
<?php if ( $count = count_user_posts_by_type( bp_current_user_id(), 'YOUR_CUSTOM_POST_TYPE' ) ) echo "Total Recipes: " . $count; ?>
Thank you.
Regards
Daniel- This reply was modified 3 years, 9 months ago by Daniel.
- Daniel on February 16, 2021 at 9:53 am in reply to: Buddypress Post Count to show on User BP page #36242
Hi Brajesh,
The code is actually not working. After inserting it into the child’s function.php then when loading the website it says “There has been a critical error on this website.” and the website is not loading anymore.
Did I miss inserting a syntax in the beginning of the function code? I have just copy-pasted the code above into the functions.php.
Thanks for the hint.
Regards
Daniel - Daniel on February 14, 2021 at 2:07 pm in reply to: Buddypress Post Count to show on User BP page #36221
Hi Brajesh,
Thank you for having a look at it, that’s awesome!
I will try it out 🙂
Thanks again.
Regards
Daniel - Daniel on February 13, 2021 at 4:09 pm in reply to: Audio function buttons shifting to the left when hoovering since BP V7 #36208This reply has been marked as private.
- Daniel on February 3, 2021 at 10:19 am in reply to: [Resolved] MediaPress light box not opening anymore #36029
Yo hi,
I have found the issue, hereby it’s resolved.
Thanks 😁
Regards
Daniel - Daniel on February 3, 2021 at 10:07 am in reply to: [Resolved] MediaPress light box not opening anymore #36027This reply has been marked as private.
- Daniel on February 1, 2021 at 5:30 pm in reply to: [Resolved] MediaPress Upload pics to match with BP container width #35992
Hi Ravi,
Thanks for the awesome code, you’re a genius!
Cheers
Daniel