Skip to:
Content
Pages
Categories
Search
Top
Bottom

Imitated New Message Notification

  • Avatar of gerikg
    gerikg
    Participant

    @gerikg

    I dont like the buddybar but I do want to be able to notify on the sidebar that you have a new message.

    I thought this was the code but it doesn’t work with mail

    <strong>Notifications</strong> <?php echo ( count($notifications) > 0 && $notifications != false ) ? "(".count($notifications).")" : "" ?>
    <?php echo '<ul>'; if ( $notifications ) { ?>
    <?php $counter = 0; ?>
    <?php for ( $i = 0; $i < count($notifications); $i++ ) { ?>
    <?php $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?>
    <li<?php echo $alt ?>><?php echo $notifications[$i] ?></li>
    <?php $counter++; ?>
    <?php } ?>
    <?php } else { ?>
    <li><?php _e( 'No new notifications.', 'buddypress' ); ?></li>
    <?php } echo '</ul>';?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • Avatar of gerikg
    gerikg
    Participant

    @gerikg

    this is what I got so far…

    <a href="<?php echo get_option('home') ?>/members/<?php $user_info = get_userdata($user_ID);echo $user_info->user_login; ?>/messages"><?php if ( bp_message_thread_has_unread() ) : ?>You Have New Messages<?php else: ?>Mailbox<?php endif; ?></a>

    It keeps coming out as “Mailbox” when I know I have a new message. Am I doing it right? What am I missing?

    Avatar of Simon Dabkowski
    Simon Dabkowski
    Participant

    @simoncreative

    Took me forever to figure this one out, yet its so simple. Here’s how I’ve set mine up:

    <?php

    global $bp;

    $inbox_count = messages_get_unread_count();

    if ($inbox_count > ‘9’) {

    $inbox_count = ‘9+';

    }

    echo ‘<span>’.$inbox_count.'</span>';

    ?>

    Each member gets a new message count and because I’ve prettied up the actual notification css I didn’t want to show a value above ‘9’.

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.