Skip to:
Content
Pages
Categories
Search
Top
Bottom

Getting the unread-count inbox-count info elsewhere


  • smuddah
    Participant

    @smuddah

    i’m looking for a way to display the unread messages info (which looks like this in html)

    <span class="unread-count inbox-count" style="display: inline;">1</span>

    to be in the footer of my site.

    is there a snippet for it?

Viewing 11 replies - 1 through 11 (of 11 total)
  • bp_adminbar_notifications_menu() is the function to call for creating the notifications menu… you will have to play with that.


    smuddah
    Participant

    @smuddah

    oh, i thought there might be an easier way. like <?php bp_show_unread_count() ?> :D

    you can easily recreate a new function with the one i provided, so instead of creating a dropdown menu it would simply show a count…


    smuddah
    Participant

    @smuddah

    thanks nexia, i will checkout the docu.

    <?php bp_total_unread_messages_count() ?>


    Simon Dabkowski
    Participant

    @simoncreative

    Here’s what I use:

    <?php

    global $bp;

    $hmag_inbox_count = messages_get_unread_count();

    if ($hmag_inbox_count > ‘9’) {

    $hmag_inbox_count = ‘9+’;

    }

    echo ‘<span class=”your-style”>’.$hmag_inbox_count.'</span>’;

    ?>

    Displays a number for # of unread. If the count is greater then 9, it displays 9+


    smuddah
    Participant

    @smuddah

    i want my personal andy peatling right beside me when i play with buddypress.

    thanks a lot everyone!

    even tho the code doesn’t check for »pendig friendships« it’s pretty cool!

    <?php bp_total_unread_messages_count() ?>

    having a Andy Peatling in my living room when i code, would be really annoying… sorry but we would have to debate the usage of each function… not good.

    ROFL!


    smuddah
    Participant

    @smuddah

    i thought <?php bp_core_get_notifications_for_user() ?> might get all notifications, but that’s just empty. hmm


    drebabels
    Member

    @drebabels

    Just a note “ echos the count.
    If you want to return the count without the echo use “


    adamt19
    Participant

    @adamt19

    Bumping to re-post the information that @drebabels posted but looks to have been lost due to use of quotes

    bp_total_unread_messages_count() uses echo. So if you use this within an ‘echo’ you’ll get unexpected results (value doesn’t print where you expect it to in the DOM, in my experience)

    add ‘get’, e.g. bp_get_total_unread_messages_count() to simply return the # of messages for the logged-in user in your code

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Getting the unread-count inbox-count info elsewhere’ is closed to new replies.
Skip to toolbar