Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've a buddypress website and what I want is to show in the frontend the notification that buddybar have in the backend, but only the notification not all the buddybar.

basically set the notification like facebook....

how can I do that?

share|improve this question
    
Hi, Manuele, welcome to WPSE! Please, try to add more details to your Question, a screenshot, relevant code (if you can locate it). Take a look at this guide: How to Ask. –  brasofilo Feb 1 '13 at 12:18
    
Hi not sure if this is what you are trying to do, if you go to smeak.com you can see it at work, we split the notifications intro 3, and into a custom toolbar we built for the network. Let me know to see if we can help –  user28950 Mar 14 '13 at 20:27

2 Answers 2

Put the following code in your functions.php. If you want a demo i can show you.

// my custom notification menu www.cityflavourmagazine.com

function my_bp_adminbar_notifications_menu() {
global $bp;

if ( !is_user_logged_in() )
    return false;

echo '<li id="top-notification">';
_e( 'Alerts', 'buddypress' );

if ( $notifications = bp_core_get_notifications_for_user( $bp->loggedin_user->id ) ) { ?>
    <span><?php echo count( $notifications ) ?></span>
<?php
}

echo '</a>';
echo '<ul>';

if ( $notifications ) {
    $counter = 0;
    for ( $i = 0; $i < count($notifications); $i++ ) {
        $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?>

        <li<?php echo $alt ?>><?php echo $notifications[$i] ?></li>

        <?php $counter++;
    }
} else { ?>

    <li><a href="<?php echo $bp->loggedin_user->domain ?>"><?php _e( 'You have no new alerts.', 'buddypress' ); ?></a></li>

<?php
}

echo '</ul>';
echo '</li>';
}

Use the following code to call it anywhere you like. Note: you can amend the above code as you like

<?php my_bp_adminbar_notifications_menu()?>

share|improve this answer

look at this page http://www.colegeissinger.com/blog/2012/12/04/get-buddypress-notifications-count/ where he explains like below:

Put that function into your functions.php file

    function cg_current_user_notification_count() {
    $notifications = bp_core_get_notifications_for_user(bp_loggedin_user_id(), 'object');
    $count = !empty($notifications) ? count($notifications) : 0;

    echo $count;
     }

in front end use,

Notificaitons : <?php cg_current_user_notification_count(); ?>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.