Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'notification user id'

Viewing 25 results - 276 through 300 (of 638 total)
  • Author
    Search Results
  • #233516
    fanmusic
    Participant

    Hi,

    Actually no, thats not it, there is no option for that in buddypress, I need to hide the buttons notifications and settings (that are along with profile, messages groupes etc.)
    it’s in the front office.

    thanks a lot

    PS : someone posted this, I think it’s on the right track but it doesn’t work :/
    [ edited – please use ‘code’ button when posting code ]
    Try this in bp-custom.php

    function fanmusic_remove_profile_nav_remove( $nav ) { 
            
         $nav = '';
                    
         return $nav;
    }
    add_filter('bp_get_displayed_user_nav_notifications', 'fanmusic_remove_profile_nav_remove', 10, 1 );
    add_filter('bp_get_displayed_user_nav_settings', 'fanmusic_remove_profile_nav_remove', 10, 1 );
    #233408

    In reply to: Notification

    Brajesh Singh
    Participant

    Hi Christian,
    There is one functionality in BuddyPress that allows it. You can see the feature as site wide notice(Mark a message as notice).

    The problem is currently, only a user with the capability ‘bp_moderate’ can send the notice. Do you want to allow this notification feature for all users or just selected few?

    #233356
    Brajesh Singh
    Participant

    Hi Chaitanya,
    Try this code.

    
    
    function bpfr_add_notification_to_page_title( $title, $original_title, $sep  ) {
    	
    	//do not change if the user is not logged in
    	if( ! is_user_logged_in() )
    		return $title;
    	
    	$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 );
    	
    	return $title;
    	
    	
    }
    add_filter( 'wp_title', 'bpfr_add_notification_to_page_title', 100, 3 );
    

    I have modified the code from your last post. The difference is, It only does it for logged in users. Also, I have decreased the priority to make it work on BuddyPress pages( otherwide bp_modify_title would have overwritten it).

    Hope that helps.

    #233352
    chatty24
    Participant

    @danbp
    I have edited the code a bit and now it is getting displayed on all the pages as I wanted but, How can I hide the modified title when the notification count is 0. By current code is below –

    function bpfr_add_notification_to_page_title( $title, $original_title, $sep, $seplocation  ) {
    	global $bp;
    	if( bp_is_user() && ! bp_get_member_user_id() ) {
            $user_id = 'displayed: '. bp_displayed_user_id();
        } else {
            $user_id = 'get_member_user: '. bp_get_member_user_id();
        }
    
    	if (bp_notifications_get_unread_notification_count( $user_id ) ) {
    
    		$counter = 0;
    			for ( $i = 0; $i < count($notifications); $i++ ) {
    				echo $notifications[$i];
    			$counter++;
    			}	
    
    	
    		
    			$title = "You Have " . bp_notifications_get_unread_notification_count() . " New Notification(s) - ";
        
    		return $title;
    	}
    }
    add_filter( 'wp_title', 'bpfr_add_notification_to_page_title', 9, 4 );
    

    Thanks

    #233349
    danbp
    Participant

    Try this (tested on 2.2 RC2)

    function bpfr_add_notification_to_page_title( $title, $original_title, $sep, $seplocation  ) {
    	global $bp;
    	if( bp_is_user() && ! bp_get_member_user_id() ) {
            $user_id = 'displayed: '. bp_displayed_user_id();
        } else {
            $user_id = 'get_member_user: '. bp_get_member_user_id();
        }
    
    	if (bp_notifications_get_unread_notification_count( $user_id ) ) {
    
    		$counter = 0;
    			for ( $i = 0; $i < count($notifications); $i++ ) {
    				echo $notifications[$i];
    			$counter++;
    			}	
    
    	if ( bp_is_profile_component() || bp_is_current_action( 'just-me' ) ) {
    		
    			$title .= bp_notifications_get_unread_notification_count() . " $sep ";
        }
    		return $title;
    	}
    }
    add_filter( 'bp_modify_page_title', 'bpfr_add_notification_to_page_title', 9, 4 );
    #233345
    chatty24
    Participant

    @henrywright

    I tried using the below code but it is returning the value to zero too 🙁

    echo bp_notifications_get_unread_notification_count( bp_loggedin_user_id() );

    #233344
    Henry Wright
    Moderator

    …how do I get it?

    That depends. For example:

    If you want the currently logged-in user:

    $user_id = bp_loggedin_user_id();

    If the context is a member’s profile page and you want the displayed member:

    $user_id = bp_displayed_user_id();

    So, depending on the above, what you need may be either:

    bp_notifications_get_unread_notification_count( bp_loggedin_user_id() );

    or

    bp_notifications_get_unread_notification_count( bp_displayed_user_id() );

    Because we’re talking about notifications, it’s likely you’ll want the former because you wouldn’t really need to show somebody else’s notifications count.

    #233340
    chatty24
    Participant

    @henrywright

    Thanks for the reply but

    I used the below code to print the notification count on my page to match it with the notification count which is shown by wordpress and I noticed that the below code returns the value to zero no matter what ever the original notification count is.

    
    echo bp_notifications_get_unread_notification_count( $user_id );

    and yes I need unread notification count.

    #233338
    Henry Wright
    Moderator

    There’s 2 types of notifications: a) read and b) unread.

    bp_notifications_get_unread_notification_count( $user_id ) will get you the unread count so you could use that value in the comparison you mentioned here.

    #233333
    danbp
    Participant

    Try this

    if ( $notifications = bp_notifications_get_notifications_for_user( $user_id, $format = 'string' ) ) { 
    
    		$counter = 0;
    			for ( $i = 0; $i < count($notifications); $i++ ) {
    			$alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; 
    
    			echo '<span ="'.$alt.'">'. $notifications[$i] .'</span>';
    
    			$counter++;
    			}	
    r-a-y
    Keymaster

    We’re looking to improve the invite process for BuddyPress 2.3.

    I’m going to ping @dcavins, as he will be implementing the invite improvements, so he’s aware of this.

    Just to answer your questions:

    Notification in the profile window’s (there are 3 notifications: message (1) – friends (1) – but in GROUPS there is no notification).

    The “Groups > No Pending Invites” nav item is for invites you have requested. Not invites that are pending for the entire group.

    The user (A) has posted in a group wall’s and the user (B) has done a comment.
    The user (A) hasn’t received notification neither admin toolbar or administration profile windows.

    Currently, notifications do not occur for activity comments. We’ll likely add this enhancement into core eventually, but for now, you’ll have to use a plugin for this:

    BuddyPress Activity Comment Notifier

    The user (A) has opened a forum in a grup. The user (B) has done a comment.
    The user (A) has received notification in the administratio toolbar. But when the user (A) has done a comment the user (B) don’t has received the notification.

    How did user A reply to user B? On the group activity homepage or on the actual group forum topic? If user A replied on the group forum topic, then this sounds like an issue with bbPress, not BuddyPress.

    chatty24
    Participant

    @henrywright

    The code is working fine. But, now the website is showing this strange behavior. Whenever I try to go to something like, example.com/username/profile or /notifications etc.

    It gets me back to, example.com/username

    And if I remove the code the error goes away.

    Any ideas why is that happening?

    Thanks

    #231894
    jessicana
    Participant

    In other way, I will be using this code for the whole site except login widgets (like BBpress log in sidebar widget):

    function jessicana_redirect_page( $redirect_to, $request, $user ) {
        $redirect_to = bp_core_get_user_domain($user->ID) . 'notifications/';
        return $redirect_to;
    }
    add_filter('login_redirect', 'jessicana_redirect_page', 11, 3);

    For widgets, I need a different function that redirects to the same page where users logs from. Is this possible?

    I appreciate the help

    #231887
    jessicana
    Participant

    One more question. What if I want users who logs in using the sidebar widget to return to the same page where they were while I want users who logs in using homepage link to be directed to their notifications page?

    #231885
    shanebp
    Moderator

    Try this:

    function jessicana_redirect_page( $redirect_to, $request, $user ) {
        $redirect_to = bp_core_get_user_domain($user->ID) . 'notifications/';
        return $redirect_to;
    }
    add_filter('login_redirect', 'jessicana_redirect_page', 11, 3);
    #231406
    danbp
    Participant

    Thxs @shanebp, i ignored that. 🙄

    Corrected function here:

    function bpfr_sidebar_notifications_menu() {
    global $bp;
    
        // if user is not logged, we do nothing
    	if ( !is_user_logged_in() )
    	return false;
    
    	// if user is group member, show him notification + count	
    if ( groups_is_user_member( bp_loggedin_user_id(), $bp->groups->current_group->id ) && $notifications = bp_notifications_get_notifications_for_user( $user_id, $format = 'string' ) ) { 
    
    		$counter = 0;
    			for ( $i = 0; $i < count($notifications); $i++ ) {
    			$alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; 
    
    			echo '<p ="'.$alt.'"><i class="fa fa-group"></i>'. $notifications[$i] .'</p>';
    
    			$counter++;
    			}	
    	}
    }

    Shows anything group related to the concerned group member.
    Mentions, membership request/reject, promotion,…

    #231399
    shanebp
    Moderator

    Nice @danbp, but a couple of issues…

    bp_core_get_notifications_for_user is deprecated.

    Instead use bp_notifications_get_notifications_for_user( $user_id, $format = 'string' )

    And I’d try using $format = 'object' so you can loop thru the results and only display those items related to that group.

    Of course, this will only get notifications for a single person.
    I’m not sure if there would be notifications for a group other than activity update…?

    #231398
    danbp
    Participant

    hi ouegy,

    Add this snippet to your child-theme functions.php and give it a try.

    First function grabs the notification
    Second function allows to add a hook to the template (in your case sidebar.php)
    And the hook to use.

    function bpfr_sidebar_notifications_menu() {
    global $bp;
    
        // if user is not logged, we do nothing
    	if ( !is_user_logged_in() )
    	return false;
    
    	// if user is group member, show him notification + count
    	if ( groups_is_user_member( bp_loggedin_user_id(), $bp->groups->current_group->id ) && $notifications = bp_core_get_notifications_for_user( $bp->loggedin_user->id ) ) { 
    
    		echo '<ul>';
    
    		$counter = 0;
    			for ( $i = 0; $i < count($notifications); $i++ ) {
    			$alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; 
    
    			echo '<li ="'.$alt.'"><i class="fa fa-group"></i>'. $notifications[$i] .'</li>';
    
    			$counter++;
    			echo '</ul>';
    			}	
    	}
    }
    
    function bpfr_xtra_group_sidebar() {	
    	// show notification only on the group sidebar
    	if(bp_is_groups_component() ):
    	// your content
    		 bpfr_sidebar_notifications_menu();
    	endif;
    
    }
    add_action( 'xtragroup', 'bpfr_xtra_group_sidebar' );

    The hook to add to sidebar.php (or any other template)
    <?php do_action( 'xtragroup' ); ?>

    Hope this help ! 😉

    #230355
    marvc
    Participant

    I have the following on another network:

    <?php
    /*
    Plugin Name: BP Multi Network
    Plugin URI: http://wpmututorials.com/news/new-features/multiple-buddypress-social-networks/
    Description: Segregate your BP networks in a multi-network WP install (must be installed in the mu-plugins folder)
    Version: 0.1.1
    Author: Ron Rennick
    Author URI: http://ronandandrea.com/
    */
    /* Copyright: (C) 2011 Ron Rennick, All rights reserved.
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    */
    
    function ra_bp_multinetwork_filter( $prefix ) {
    global $wpdb;
    
    if( $wpdb->siteid > 1 && $prefix == $wpdb->base_prefix ) {
    $current_site = get_current_site();
    return $wpdb->get_blog_prefix( $current_site->blog_id );
    }
    
    return $prefix;
    }
    add_filter( ‘bp_core_get_table_prefix’, ‘ra_bp_multinetwork_filter’ );
    
    function ra_bp_multinetwork_meta_key_filter( $key ) {
    global $wpdb;
    static $user_meta_keys = array(
    ‘last_activity’ => false,
    ‘bp_new_mention_count’ => false,
    ‘bp_favorite_activities’ => false,
    ‘bp_latest_update’ => false,
    ‘total_friend_count’ => false,
    ‘total_group_count’ => false,
    ‘notification_groups_group_updated’ => false,
    ‘notification_groups_membership_request’ => false,
    ‘notification_membership_request_completed’ => false,
    ‘notification_groups_admin_promotion’ => false,
    ‘notification_groups_invite’ => false,
    ‘notification_messages_new_message’ => false,
    ‘notification_messages_new_notice’ => false,
    ‘closed_notices’ => false,
    ‘profile_last_updated’ => false,
    ‘notification_activity_new_mention’ => false,
    ‘notification_activity_new_reply’ => false
    );
    
    if( $wpdb->siteid < 2 || !isset( $user_meta_keys[$key] ) )
    return $key;
    
    if( !$user_meta_keys[$key] ) {
    $current_site = get_current_site();
    $user_meta_keys[$key] = $wpdb->get_blog_prefix( $current_site->blog_id ) . $key;
    }
    
    return $user_meta_keys[$key];
    }
    add_filter( ‘bp_get_user_meta_key’, ‘ra_bp_multinetwork_meta_key_filter’ );
    #230354
    marvc
    Participant

    In terms of the BP Multi-Network plugin I have the following on one network:

    <?php
    /*
    Plugin Name: BP Multi Network
    Plugin URI: http://wpmututorials.com/news/new-features/multiple-buddypress-social-networks/
    Description: Segregate your BP networks in a multi-network WP install (must be installed in the mu-plugins folder)
    Version: 0.1
    Author: Ron Rennick
    Author URI: http://ronandandrea.com/
    */
    /* Copyright: (C) 2011 Ron Rennick, All rights reserved.
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    */
    
    function ra_bp_multinetwork_filter( $prefix ) {
    global $wpdb;
    
    if( $wpdb->siteid > 1 && $prefix == $wpdb->base_prefix ) {
    $current_site = get_current_site();
    return $wpdb->get_blog_prefix( $current_site->blog_id );
    }
    
    return $prefix;
    }
    add_filter( ‘bp_core_get_table_prefix’, ‘ra_bp_multinetwork_filter’ );
    
    function ra_bp_multinetwork_meta_key_filter( $key ) {
    global $wpdb;
    static $user_meta_keys = array(
    ‘bp_new_mention_count’ => false,
    ‘bp_favorite_activities’ => false,
    ‘bp_latest_update’ => false,
    ‘total_friend_count’ => false,
    ‘total_group_count’ => false,
    ‘notification_groups_group_updated’ => false,
    ‘notification_groups_membership_request’ => false,
    ‘notification_membership_request_completed’ => false,
    ‘notification_groups_admin_promotion’ => false,
    ‘notification_groups_invite’ => false,
    ‘notification_messages_new_message’ => false,
    ‘notification_messages_new_notice’ => false,
    ‘closed_notices’ => false,
    ‘profile_last_updated’ => false,
    ‘notification_activity_new_mention’ => false,
    ‘notification_activity_new_reply’ => false
    );
    
    if( $wpdb->siteid < 2 || !isset( $user_meta_keys[$key] ) )
    return $key;
    
    if( !$user_meta_keys[$key] ) {
    $current_site = get_current_site();
    $user_meta_keys[$key] = $wpdb->get_blog_prefix( $current_site->blog_id ) . $key;
    }
    
    return $user_meta_keys[$key];
    }
    add_filter( ‘bp_get_user_meta_key’, ‘ra_bp_multinetwork_meta_key_filter’ );
    #230308
    Paul Bursnall
    Participant

    @sebacar @mercime Hi Sebastien, from looking at replies to your Trac ticket, I think something is being lost in translation between ourselves and the devs.

    To quote the official documentation :

    Notifications are a central aspect of the user experience on a BuddyPress site. By default new notifications are displayed in the admin bar profile menu, right next to the navigation menus, some themes even integrate the notification counter in other places (like in the header or sidebar of a page).

    Notifications are sent out to your community members as soon as one of the following things happen:

    Activity

    A member mentions you in an update @username”
    A member replies to an update or comment you’ve posted

    The activity in bold above definitely stopped triggering notifications on 3 different sites I was testing, where it had previously generated a notification (probably 4 months+ consistently). Quite simply, that notification trigger stopped working. This should not be a new feature, it was already there.

    #230051
    tim_marston
    Participant

    Thanks @henrywright

    Here is the list:

    Admin Tweaks
    Advanced Excerpt
    Antispam Bee
    bbPress
    Bowe Codes
    BP Auto Activate Autologin Redirect To Profile On Signup
    Bp Clear Notifications
    BP Group Activities Notifier
    Broken Link Checker
    BuddyBlock
    BuddyPress
    Buddy Press Activity Ads
    BuddyPress Activity as Wire
    BuddyPress Activity Comment Notifier
    BuddyPress Activity Privacy
    BuddyPress Block Activity Stream Types
    BuddyPress Live Notification
    BuddyPress Profile Visibility Manager
    BuddyPress Security Check
    BuddyPress Usernames Only
    Delete Expired Transients
    Duplicator
    Email Login
    Facebook Like User Activity Stream For BuddyPress
    Google Analytics +
    Imsanity
    Infinite SEO
    Insert Headers and Footers
    Mailjet for WordPress
    Menu Items Visibility Control
    OPcache Dashboard
    Post Voting
    Pretty Link Lite
    Query Monitor
    Random Banner
    rtMedia for WordPress, BuddyPress and bbPress
    rtMedia Pro
    s2Member Framework
    SearchWP
    SearchWP bbPress Integration
    Social Likes
    Subscribe To Comments
    User Activity
    Wordfence Security
    WordPress FAQ Manager
    WP-DBManager
    WP-Memory-Usage
    wp-Monalisa
    WPBakery Visual Composer
    WP Better Emails
    WP External Links
    WP Maintenance Mode
    WPMU DEV Dashboard
    WP Widget Cache

    #229954
    @mercime
    Participant

    @hypnoscribe @milenushka @style960 default notifications are posted at https://codex.buddypress.org/member-guide/notifications/ set up in your Profile Settings > Notifications panel. If the feature you need is not available, do create a ticket in BP Trac. Log in using your WP username and password.

    #229904
    miama
    Participant

    and this:

    <?php
    
    /**
    * BuddyPress – Users Notifications
    *
    * @package BuddyPress
    * @subpackage bp-legacy
    */
    
    ?>
    
    <div class=”item-list-tabs no-ajax” id=”subnav” role=”navigation”>
    
        <?php bp_get_options_nav(); ?>
    
        <li id=”forums-order-select” class=”last filter”>
        <?php bp_notifications_sort_order_form(); ?>
    
    </div>
    
    <?php
    switch ( bp_current_action() ) :
    
    // Unread
    case ‘unread’ :
    bp_get_template_part( ‘members/single/notifications/unread’ );
    break;
    
    // Read
    case ‘read’ :
    bp_get_template_part( ‘members/single/notifications/read’ );
    break;
    
    // Any other
    default :
    bp_get_template_part( ‘members/single/plugins’ );
    break;
    endswitch;
    #229903
    miama
    Participant
    
    
    <?php
    
    /**
    * BuddyPress – Users Home
    *
    * @package BuddyPress
    * @subpackage bp-default
    */
    
    //get theme options
    global $oswc_bp;
    
    //set theme options
    $oswc_bp_sidebar_unique = $oswc_bp[‘bp_sidebar_unique’];
    $oswc_bp_members_sidebar_unique = $oswc_bp[‘bp_members_sidebar_unique’];
    
    //setup variables
    $sidebar=”Default Sidebar”;
    if($oswc_bp_sidebar_unique) { $sidebar=”BuddyPress Default Sidebar”; }
    if($oswc_bp_members_sidebar_unique) { $sidebar=”BuddyPress Members Sidebar”; }
    
    get_header( ‘buddypress’ ); ?>
    
    <div class=”main-content-left”>
    
    <div class=”page-content” id=”content”>
    
    <?php do_action( ‘bp_before_member_home_content’ ); ?>
    
    <div id=”item-header” role=”complementary”>
    
    <?php locate_template( array( ‘members/single/member-header.php’ ), true ); ?>
    
    </div><!– #item-header –>
    
    <div id=”item-nav”>
    <div class=”item-list-tabs no-ajax” id=”object-nav” role=”navigation”>
    
        <?php bp_get_displayed_user_nav(); ?>
    
        <?php do_action( ‘bp_member_options_nav’ ); ?>
    
    </div>
    </div><!– #item-nav –>
    
    <div id=”item-body”>
    
    <?php do_action( ‘bp_before_member_body’ );
    
    if ( bp_is_user_activity() || !bp_current_component() ) :
    locate_template( array( ‘members/single/activity.php’ ), true );
    
    elseif ( bp_is_user_blogs() ) :
    locate_template( array( ‘members/single/blogs.php’ ), true );
    
    elseif ( bp_is_user_friends() ) :
    locate_template( array( ‘members/single/friends.php’ ), true );
    
    elseif ( bp_is_user_groups() ) :
    locate_template( array( ‘members/single/groups.php’ ), true );
    
    elseif ( bp_is_user_messages() ) :
    locate_template( array( ‘members/single/messages.php’ ), true );
    
    elseif ( bp_is_user_profile() ) :
    locate_template( array( ‘members/single/profile.php’ ), true );
    
    elseif ( bp_is_user_forums() ) :
    locate_template( array( ‘members/single/forums.php’ ), true );
    
    elseif ( bp_is_user_settings() ) :
    locate_template( array( ‘members/single/settings.php’ ), true );
    
    elseif ( bp_is_user_notifications() ) :
    locate_template( array( ‘members/single/notifications.php’ ), true );
    // If nothing sticks, load a generic template
    else :
    locate_template( array( ‘members/single/plugins.php’ ), true );
    
    endif;
    
    do_action( ‘bp_after_member_body’ ); ?>
    
    </div><!– #item-body –>
    
    <?php do_action( ‘bp_after_member_home_content’ ); ?>
    
    </div>
    
    </div>
    
    <div class=”sidebar”>
    
    <?php if ( function_exists(‘dynamic_sidebar’) && dynamic_sidebar($sidebar) ) : else : ?>
    
    <div class=”widget-wrapper”>
    
    <div class=”widget”>
    
    <div class=”section-wrapper”><div class=”section”>
    
    <?php _e(‘ Made Magazine ‘, ‘made’ ); ?>
    
    </div></div>
    
    <div class=”textwidget”>
    
    <p><?php _e( ‘This is a widget panel. To remove this text, login to your WordPress admin panel and go to Appearance >> Widgets, and drag & drop a widget into the corresponding widget panel.’, ‘made’ ); ?></p>
    
    </div>
    
    </div>
    thats what I did:
    </div>
    
    <?php endif; ?>
    
    </div>
    
    <br class=”clearer” />
    
    <?php get_footer( ‘buddypress’ ); ?>
    
Viewing 25 results - 276 through 300 (of 638 total)
Skip to toolbar