BuddyDev

Search

Replies

  • Participant
    Level: Master
    Posts: 497
    Daniel on in reply to: How to redirect user to user profile page #36307
    This reply has been marked as private.
  • Participant
    Level: Master
    Posts: 497
    Daniel on 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

  • Participant
    Level: Master
    Posts: 497
    Daniel on 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

  • Participant
    Level: Master
    Posts: 497
    Daniel on 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.
  • Participant
    Level: Master
    Posts: 497
    Daniel on 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

  • Participant
    Level: Master
    Posts: 497
    Daniel on 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

  • Participant
    Level: Master
    Posts: 497
    This reply has been marked as private.
  • Participant
    Level: Master
    Posts: 497
    Daniel on 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

  • Participant
    Level: Master
    Posts: 497
    Daniel on in reply to: [Resolved] MediaPress light box not opening anymore #36027
    This reply has been marked as private.
  • Participant
    Level: Master
    Posts: 497

    Hi Ravi,

    Thanks for the awesome code, you’re a genius!

    Cheers
    Daniel