Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'notification user id'

Viewing 25 results - 426 through 450 (of 771 total)
  • Author
    Search Results
  • #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’ ); ?>
    
    #229862
    Brent Havill
    Participant

    Hi Henry

    I went to ‘plugins’/buddypress/settings, and found the following (I note that “account settings” is not ticked – could this be it?)
    I have bolded the ones that are ticked currently.

    Settings:

    Component Description
    Component Description
    Extended Profiles Customize your community with fully editable profile fields that allow your users to describe themselves.
    Account Settings Allow your users to modify their account and notification settings directly from within their profiles.
    Friend Connections Let your users make connections so they can track the activity of others and focus on the people they care about the most.
    Private Messaging Allow your users to talk to each other directly and in private. Not just limited to one-on-one discussions, messages can be sent between any number of members.
    Activity Streams Global, personal, and group activity streams with threaded commenting, direct posting, favoriting, and @mentions, all with full RSS feed and email notification support.
    Notifications Notify members of relevant activity with a toolbar bubble and/or via email, and allow them to customize their notification settings.
    User Groups Groups allow your users to organize themselves into specific public, private or hidden sections with separate activity streams and member listings.
    Site Tracking Record activity for new posts and comments from your site.
    BuddyPress Core It‘s what makes time travel BuddyPress possible!
    Community Members Everything in a BuddyPress community revolves around its members.

    #229209
    Security
    Participant

    Hi i think i know whats happening here i was working on status theme to make it work with the latest versions of both buddypress and wordpress and i faced the similar issue so this is what i did to resolve it goto wp-content>>themes>>yourthemename>>members folder>>single>>home.php and add these lines of code there

    elseif ( bp_is_user_notifications() ) :
    					locate_template( array( 'members/single/notifications.php' ), true );	
    

    just before this kinda statement // If nothing sticks, load a generic template
    next create a file named notifications.php in wp-content>>themes>>yourthemename>>members folder>>single folder and add these lines to it

    <?php
    
    /**
     * BuddyPress - Users Notifications
     *
     * @package BuddyPress
     * @subpackage bp-legacy
     */
    
    ?>
    
    <div class="item-list-tabs no-ajax" id="subnav" role="navigation">
    	<ul>
    		<?php bp_get_options_nav(); ?>
    
    		<li id="forums-order-select" class="last filter">
    			<?php bp_notifications_sort_order_form(); ?>
    		</li>
    	</ul>
    </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;

    and try to reload your site now your problem should be solved.
    Note: only create notifications.php if its not already there and please backup your site before making these changes

    #228794
    mcpeanut
    Participant

    @sbaglia i really dont have a clue about this but ive just noticed a recent update on a plugin that adds seperate social networking functions to wordpress that i have been watching for a while, now the idea i had a while ago was wondering if this plugin could infact be ran alongside buddypress just for the comment notifications within wordpress, meaning i was wondering if all other notifications and workings of this other plugin could be disabled and used just for this one specific task, this way users would have a seperate notification system for blog and custom post comments, i really dont know as i have not messed around with them together but i know that this plugin does achieve what we want but seperately to buddypress, maybee you want to have a mess with the idea i had? i just dont have time at the minute and dont know if it will work well with buddypress running too, the plugin is here https://wordpress.org/plugins/wp-notifications/

    #228023

    In reply to: Live Notifications

    Paul Bursnall
    Participant

    Hi @henrywright

    Thanks for the quick reply. I’ll put a request in on Trac shortly. At present, I’m probably going to be forced into using my second choice as a theme just to have these feature. From a regular users point of view, I find it unlikely they’ll even bother to acknowledge new email notifications, whereas live web notifications are standard, even expected in other widely used applications, both personal and workplace.

    Thanks for your help.

    Henry Wright
    Moderator

    Try this function:

    function bp_set_notification_default( $user_id ) {
        $keys = array( 'notification_activity_new_mention', 'notification_activity_new_reply', 'notification_friends_friendship_accepted', 'notification_friends_friendship_request', 'notification_groups_admin_promotion', 'notification_groups_group_updated', 'notification_groups_invite', 'notification_groups_membership_request', 'notification_messages_new_message', 'notification_messages_new_notice' );
    
        foreach ( $keys as $key ) {
            update_user_meta( $user_id, $key, 'no' );
        }
    }
    add_action( 'bp_core_signup_user', 'bp_set_notification_default', 100, 1 );

    Ref: http://premium.wpmudev.org/forums/topic/how-can-i-disable-buddypress-notification-email

    Halo Diehard
    Participant

    Yeah, I still will get the odd mention from old posts, have absolutely no idea what triggers them. And now that I’ve changed my display name recently, it will even occasionally send me ones where I’ve included myself in a quote, before the username change! It’s weird.

    The good news is it slows down! ;D The bad news is before it does it can drive your members to turn off their notifications, and if your server can’t handle it the process can crash your server.

    Does that code only stop old notifications, or does it stop all, or what?

    #190941
    aghajoon
    Participant

    this code work for me but java script not work and when user favorite comment user can’t remove notification help me

    define("BP_FAVORITE_NOTIFIER_SLUG","fa_notification");
    
        function bp_favorite_setup_globals() {	
    	global $bp, $current_blog;
        $bp->bp_favorite=new stdClass();
        $bp->bp_favorite->id = 'bp_favorite';
        $bp->bp_favorite->slug = BP_FAVORITE_NOTIFIER_SLUG;
        $bp->bp_favorite->notification_callback = 'bp_favorite_format_notifications';//show the notification   
        $bp->active_components[$bp->bp_favorite->id] = $bp->bp_favorite->id;
    			
                do_action( 'bp_favorite_setup_globals' );
        }
                add_action( 'bp_setup_globals', 'bp_favorite_setup_globals' );
         
    
    function bp_favorite_format_notifications(  $action, $activity_id, $secondary_item_id, $total_items,$format='string'  ) { 
    $action_checker = explode('_', $action);
    $activities = bp_activity_get_specific( array( 'activity_ids' => $activity_id, 'display_comments' => true) );
    	$glue = '';
    	$user_names = array();
    
    	$users = find_favorite_involved_persons($activity_id, $action);
    	$total_user = $count = count($users);
    
    	if($count > 2) {
    		$users = array_slice($users, $count - 2);
    		$count = $count - 2;
    		$glue = ", ";
    	} else if($total_user == 2) {
    		$glue = " and ";
    	}
    
    	foreach((array)$users as $user_id) {
    		$user_names[] = bp_core_get_user_displayname($user_id);
    	}
    
    	if(!empty($user_names)) {
    		$favoriting_users = join($glue, $user_names);
    	}
    
    	switch ( $action ) {
    		case 'new_bp_favorite_'.$activity_id:
    			if($total_user > 2) {
    				$text = $favoriting_users.' and '.$count.' liked: '.substr($activities["activities"][0]->content,0,32).'...';
    			} else {
    				$text = $favoriting_users." like: ".substr($activities["activities"][0]->content,0,32)."...";
    			}
    		break;
    	}
    	$url = '<div id="'.$action.'"class="notification"><a href="#" class="social-delete" onclick="deleteAjaxNotification(\''.$action.'\',\''.$activity_id.'\', \''.admin_url( 'admin-ajax.php' ).'\'); return false;">x</a><span class="social-loader"></span></div>';
    	$link = favorite_activity_get_permalink( $activity_id );
    
    	if($format=='string') {
    		return apply_filters( 'bp_activity_multiple_favorite_notifications', '<a href="' . $link. '">' . $text . '</a>'. $url .'' ,$users, $total_user, $count, $glue, $link );
    	} else {
    		return array(
    			'link' => $link,
    			'text' => $text
    		);
    	}
    	return false;
    
    }
    function find_favorite_involved_persons($activity_id, $action) {
    	global $bp,$wpdb;
    	$table = $wpdb->prefix . 'bp_notifications';
    	return $wpdb->get_col($wpdb->prepare("select DISTINCT(secondary_item_id) from {$table} where item_id=%d and secondary_item_id!=%d and component_action = %s",$activity_id,$bp->loggedin_user->id, $action));
    }
    function favorite_activity_get_permalink( $activity_id, $activity_obj = false ) {
    	global $bp;
    
    	if ( !$activity_obj )
    		$activity_obj = new BP_Activity_Activity( $activity_id );
                        
    		if ( 'activity_comment' == $activity_obj->type )
    			$link = bp_get_activity_directory_permalink(). 'p/' . $activity_obj->item_id . '/';
    		else
    			$link = bp_get_activity_directory_permalink() . 'p/' . $activity_obj->id . '/';
    
    	return apply_filters( 'ac_notifier_activity_get_permalink', $link );
    
    }
    
    function favorite_notifier_remove_notification($activity ,$has_access){
           global $bp;
           if($has_access)		       
    	   bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->bp_favorite->id, 'new_bp_favorite_'.$activity->id );
    	}
    add_action("bp_activity_screen_single_activity_permalink","favorite_notifier_remove_notification", 10,2);
    
    function favorite_notification( $activity_id){  
                       global $bp;                 
    	               $activities = bp_activity_get_specific( array( 'activity_ids' => $activity_id, 'display_comments' => true) );
    				   $author_id = $activities['activities'][0]->user_id;
                       $user_id =  bp_loggedin_user_id();
    	// if favoriting own activity, dont send notification
    	if( $user_id == $author_id ) {
    		return false;
    	}
    				   if ( bp_is_active( 'notifications' ) ) {
    		bp_notifications_add_notification( array(
    			'user_id'           => $author_id,
    			'item_id'           => $activity_id,
    			'secondary_item_id' => $user_id,
    			'component_name'    => $bp->bp_favorite->id,
    			'component_action'  => 'new_bp_favorite_'.$activity_id,
    			'date_notified'     => bp_core_current_time(),
    			'is_new'            => 1,
    		) );
    	}				
    }
    add_action("bp_activity_add_user_favorite","favorite_notification", 10, 2);
    
    function deleteAjaxNotification(){
        global $bp;        
        bp_core_delete_notifications_by_item_id ($bp->loggedin_user->id, $bp->bp_favorite->id, 'new_bp_favorite_'.$activity->id);     
        die();        
    }	
    add_action('wp_ajax_deleteAjaxNotification', 'deleteAjaxNotification' ); 
    
    function bp_like_add_like_action() {
    global $bp, $activities_template; 
    	 if ( bp_activity_can_favorite() ) : 
    		
    				$my_fav_count = bp_activity_get_meta( bp_get_activity_comment_id(), 'favorite_count' );
    				
    				$my_fav_count = "<span>".$my_fav_count."</span>";
    				
    				$is_favorite = apply_filters( 'bp_get_activity_is_favorite', in_array( bp_get_activity_comment_id(), $activities_template->my_favs ) );
    		
    
    			 if ( !$is_favorite ) : ?>
    
    				<a href="<?php echo apply_filters( 'bp_get_activity_favorite_link', wp_nonce_url( home_url( bp_get_activity_root_slug() . '/favorite/' . bp_get_activity_comment_id() . '/' ), 'mark_favorite' ) ); ?>" class="tooltip-trigger fav bp-secondary-action bp-primary-action" title="<?php _e( 'Favorite', 'buddypress' ); ?>" style="position:relative;"><?php _e( 'Favorite', 'buddypress' ); ?><?php echo $my_fav_count; ?></a>
    
    			<?php else : ?>
    
    				<a href="<?php echo apply_filters( 'bp_get_activity_favorite_link', wp_nonce_url( home_url( bp_get_activity_root_slug() . '/favorite/' . bp_get_activity_comment_id() . '/' ), 'mark_favorite' ) ); ?>" class="tooltip-trigger unfav bp-secondary-action bp-primary-action" title="<?php _e( 'Remove Favorite', 'buddypress' ); ?>" style="position:relative;"><?php _e( 'Remove Favorite', 'buddypress' ); ?><?php echo $my_fav_count; ?></a>
    
    			<?php endif; 
    
    		 endif; 
    }
    add_filter( 'bp_activity_comment_options' , 'bp_like_add_like_action', 1000 );
    
    

    and java code

    function deleteAjaxNotification(action_id, activity_id, adminUrl){
        jQuery('#'+action_id).children(".social-delete").html("");
        jQuery('#'+action_id ).children(".social-loader").show(); 
    
        jQuery.ajax({
            type: 'post',
            url: adminUrl,
            data: { action: "deleteAjaxNotification", action_id:action_id, activity_id:activity_id },
            success:
            function(data) {
            	jQuery('#'+action_id).parent().hide();
            	
            }
         });  
    }
    #189599
    danbp
    Participant

    It is not an issue, it is intended so !

    The logged user’s profile tab comes with 3 sub menus:
    – View (public)
    – Edit (private)
    – Change avatar (private)

    On the main navigation of the member, you have at least
    – Settings with 3 sub nav items:
    – account credential (email, password)
    – notifications
    – field visibility settings

    And if component is activated:
    – Friends
    – Groups
    – Forum

    I agree that this Setting is confusing, at least, because those labels should indicate My Friends, My Groups, My Forums and My profile fields visibility settings, which is too long i grant you. 😉

    FYI: such distinction wern’t really possible untill now in the original english version.
    But the upcomming BP 2.1 brings some better context disambiguation just to improve such situation.

    To solve this today, you can:
    1) create a translation file and modify the wording (but, as said, without disambiguation)
    2) use a child theme and hardcode the text you want into the template file (best approach)
    3) wait a few days for 2.1 to use the first option

    natb19
    Participant

    Anton, I haven’t tried it yet, but could we hook onto the user login and then run the code fancyfiber provided above?

    That way all users will have their notification settings set after they have logged in. (not perfect, but it should work!?)

    #188501
    victord34
    Participant

    @henrywright

    do you have another exemple. to make page notif ?

    I try that, and many other setting… nothing appears.

    
    if ( bp_is_active( 'notifications' ) ) {
        bp_notifications_add_notification( array(
            'all'           => $user_id,
            'pages'          => $item_id,
            'pages/ edit' => $secondary_item_id,
            'component_name'    => $component_name,
            'component_action'  => $component_action,
            'date_notified'     => bp_core_current_time(),
            'is_new'            => 1,
        ) );
    }
    

    thank you

    #188354
    Henry Wright
    Moderator

    bp_notifications_add_notification() is used to add a notification. For example:

    if ( bp_is_active( 'notifications' ) ) {
        bp_notifications_add_notification( array(
            'user_id'           => $user_id,
            'item_id'           => $item_id,
            'secondary_item_id' => $secondary_item_id,
            'component_name'    => $component_name,
            'component_action'  => $component_action,
            'date_notified'     => bp_core_current_time(),
            'is_new'            => 1,
        ) );
    }

    See here for more info: https://codex.buddypress.org/developer/function-examples/bp_notifications_add_notification/

    #187080

    In reply to: Forwarding Messages

    danbp
    Participant

    Hi @akovia,

    each logged in user has access to his profile settings. Eg. on the top right user menu (howdy…)
    or on the buddybar under the profile header.

    /membres/xxxx/settings/notifications/

    Settings > Email
    Once on this setting page, each user can decide for what he want to receive an alert.

    But it is an emailed notice he will receive, not the complete message.

    This messaging system is intended to work internally. This means the content of the message stays on the site. BP eventually sends only a reference to the content. Eg. xxx send you a private message (site url), not the full message.

    Screenshot:
    BuddyPress 2.x notification settings

    Findolfin
    Participant

    Hi

    Thanks, for your fast respond! Unfortunately it doesn’t work. But I could fix it by myself with trying.
    With poEdit the words were translatet but when I opened the file with CodeStyling Localization and searched for the “</span>” – tag I found message, notification, friends and groups twice:

    Once translatet to German and once not. I translatet all to German who were not translatet and it worked. I have no idea why this was that way but now I’m happy.
    I sent the file also to deckerweb and a topic in German WordPress so the other user with this issue can use the file.

    Maybe you have an idea what that could be?

    #183977
    Chris Perryman
    Participant

    Just wanted to follow up…we did come up with a solution for this in case any one else is looking for it.

    Full details are now on my blog at Revelation Concept.

    function rc_buddypress_profile_update( $user_id ) { 
     
         $admin_email = "YOUR-EMAIL@DOMAIN.COM";
         $message = sprintf( __( 'Member: %1$s', 'buddypress' ), bp_core_get_user_displayname( $user_id ) ) . "\r\n\r\n"; 
         $message .= sprintf( __( 'Color: %s' ), bp_get_profile_field_data('field=Color') ). "\r\n\r\n";
         wp_mail( $admin_email, sprintf( __( '[YOUR SITE] Member Profile Update' ), get_option('blogname') ), $message );
     }
     
     add_action( 'xprofile_updated_profile', 'rc_buddypress_profile_update', 10, 5 );
    #183850
    godavid33
    Participant

    Ok, well I had to figure this one out. It’s a bit of a lengthy solution. I’m not going to explain everything, as I can’t for either lack of knowledge or fear of being incorrect. I’ll just give you the code, tell you what it does, and where it goes.

    First, lets add the favorite button to the comments template. Find comment.php (in /activity) and add the code:

    
    		<?php global $activities_template; ?>
    		<?php if ( bp_activity_can_favorite() ) : ?>
    			<?php
    				$my_fav_count = bp_activity_get_meta( bp_get_activity_comment_id(), 'favorite_count' );
    				
    				$my_fav_count = "<span>".$my_fav_count."</span>";
    				
    				$is_favorite = apply_filters( 'bp_get_activity_is_favorite', in_array( bp_get_activity_comment_id(), $activities_template->my_favs ) );
    			?>
    
    			<?php if ( !$is_favorite ) : ?>
    
    				<a href="<?php echo apply_filters( 'bp_get_activity_favorite_link', wp_nonce_url( home_url( bp_get_activity_root_slug() . '/favorite/' . bp_get_activity_comment_id() . '/' ), 'mark_favorite' ) ); ?>" class="tooltip-trigger fav bp-secondary-action bp-primary-action" title="<?php echo god_get_favorited_usernames(bp_get_activity_comment_id()); ?>" style="position:relative;"><?php _e( 'Like', 'buddypress' ); ?><?php echo $my_fav_count; ?></a>
    
    			<?php else : ?>
    
    				<a href="<?php echo apply_filters( 'bp_get_activity_favorite_link', wp_nonce_url( home_url( bp_get_activity_root_slug() . '/favorite/' . bp_get_activity_comment_id() . '/' ), 'mark_favorite' ) ); ?>" class="tooltip-trigger unfav bp-secondary-action bp-primary-action" title="<?php echo god_get_favorited_usernames(bp_get_activity_comment_id()); ?>" style="position:relative;"><?php _e( 'Unlike', 'buddypress' ); ?><?php echo $my_fav_count; ?></a>
    
    			<?php endif; ?>
    
    		<?php endif; ?>	
    

    This code simply adds the buttons, and gets all the necessary info and variables.

    Then, you’re going to need to modify the buddypress javascript. I personally modified both global.js and buddypress.js (through overriding in my template, which is a topic for a whole other thread), though I might be wrong in this. At any rate, look for the line (around 264 in buddypress.js):

    
    var parent = target.closest('.activity-item');
    

    and change it to

    
    var parent = target.closest('li');
    

    The reason we changed this line is so that our custom favorite button doesn’t default to grabbing the top level activity id. Now you can actually favorite comments!

    But wouldn’t it be nice if the user received a notification when someone favorited their activity? Add this bad boy to functions.php

    
    
    add_action("bp_activity_add_user_favorite","favorite_notification", 10, 2);
    
    function favorite_notification( $activity_id, $user_id = 0){
    	// By type and item_id
    	if($user_id != $activities["activities"][0]->user_id){
    		$activities = bp_activity_get_specific( array( 'activity_ids' => $activity_id, 'display_comments' => true) );
    		
    		bp_core_add_notification( $activity_id, $activities["activities"][0]->user_id, "notifier", bp_core_get_username(bp_loggedin_user_id())." liked: '".substr($activities["activities"][0]->content,0,20)."...'", $activity_id ) ;		
    	}
    }
    

    Hope this helped someone. It mostly works for me.

    #183649
    godavid33
    Participant

    I know this is a very old thread, but here’s some useful code for solving this problem (put it in functions.php) in case someone else stumbles upon it

    
    add_action("bp_activity_add_user_favorite","favorite_notification", 10, 2);
    
    function favorite_notification( $activity_id, $user_id = 0){
    
    	$activities = bp_activity_get_specific( array( 'activity_ids' => $activity_id) );
    
    	bp_core_add_notification( $activity_id, $activities["activities"][0]->user_id, "notifier", "<a href='".get_site_url()."/activity/p/$activity_id'>New Like!</a>" ) ;
    }
    
    Henry Wright
    Moderator

    Hi @godavid33

    I’m 99% sure you can. I do believe it’s store in secondary_item_id.

    I think you can access it by doing something like this:

    $notifications = BP_Notifications_Notification::get( array(
        'id' => $notification_id,
        'user_id' => $user_id
    ) );
    
    // I assume there will only be one result but i'll do a loop anyway
    if ( $notifications ) {
        foreach( $notifications as $notification ) {
            // this should output the friendship ID
            echo $notification->secondary_item_id;
        }
    }
Viewing 25 results - 426 through 450 (of 771 total)
Skip to toolbar