Skip to:
Content
Pages
Categories
Search
Top
Bottom

Friends notification count with dropdown content


  • spongo
    Participant

    @spongo

    Hey guys !

    I am searching since one week for a solution of my problem.

    My idea is to create 2 icons in my topbar (no bp-admin-bar, i have an own seperate topbar). I have already create a counter for notification and friends and have a dropdown function.

    In the friends dropdown i have input the code from friends-request.php and if you click on the icon there is an dropdown which shows the reqeuest. The problem is that it only shows the reqeust inside the dropdown if you are on a profilpage.

    If you hit the notification icon there should be only show new notifications and no friend requests.
    At the moment it shows everything.

    For the counter i use this function:

    <?php
    function bpfr_add_notification_to_page_title(   ) {
    	
    	//do not change if the user is not logged in
    	if( ! is_user_logged_in() )
    		
    	
    	$user_id = get_current_user_id();//logged in user's id
    	
    	$count = bp_notifications_get_unread_notification_count( $user_id );
    	
    	if( $count > 0 )
    		$title = sprintf( "You Have %d New Notification(s) - ", $count );
    		$anzahlNeuigkeiten = $count;
    		
    		echo '<a class="news" data-dropdown="news" aria-controls="autoCloseExample" aria-expanded="false"> <i class="fi-megaphone" ></i></a><span class="update" >'.$anzahlNeuigkeiten.'</span>';
    		echo '<a style="margin-left:10px;" class="frequest" data-dropdown="friendrequest" aria-controls="autoCloseExample" aria-expanded="false"><i class="fi-torsos"></i></a><span class="update">';
    		echo bp_friend_get_total_requests_count( bp_loggedin_user_id() ) ;
    		echo '</span>';
    		
    	
    	
    	
    }
    ?>

    I found already a thread which trys to explain how to fix it ”
    How to split out BuddyPress notifications drop down items to their own top level” but there is no content for the dropdown.

    So my question is . How can I show the requests of friends in the dropdown on every page? And how can filter notifications? It should be like on Facebook, if you hit the friends icon then it shows requests. If you hit the notification icon than it shows news.

    Thannk you guys for your help !

    Best Regards !

    Peter

  • The topic ‘Friends notification count with dropdown content’ is closed to new replies.
Skip to toolbar