Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'notification user id'

Viewing 25 results - 451 through 475 (of 768 total)
  • Author
    Search Results
  • #181030
    godavid33
    Participant

    Awesome, a post that isn’t years old that I may actually be able to help!

    In functions.php add the following function:

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

    In frontend-noajax.inc.php (you can find this in plugins/bp-direct-menus/inc) add the following code around line 150 (near where all the counts are initialized):

    
    $notifcount = cg_current_user_notification_count();
    $item->title = str_ireplace("%notificationcount%", $notifcount, $item->title);
    $item->title = str_ireplace("%(notificationcount)%", ($notifcount > 0) ? '('.$notifcount.')' : '', $item->title);
    

    Hope that helps you, or if you already figured it out, helps somebody else.

    Cheers,
    Gabe

    #180665
    sundev
    Participant

    @modemlooper

    // I got it working by putting these lines of your code on my existing function

    if ( bp_is_user() && bp_user_has_access() ) {
    $count = bp_notifications_get_unread_notification_count( bp_displayed_user_id() );
    $class = ( 0 === $count ) ? ‘no-count’ : ‘count’;
    $bp->bp_nav[‘notifications’][‘name’] = sprintf( __( ‘Alerts <span class=”%s”>%s</span>’, ‘buddypress’ ), esc_attr( $class ), number_format_i18n( $count ) );
    }

    I really appreciate your gesture. Thank you very much.

    #180630
    modemlooper
    Moderator

    BP 1.9+

    function custom_notification_menu_tabs(){
    	global $bp;
    	if ( bp_is_user() && bp_user_has_access() ) {
    		$count    = bp_notifications_get_unread_notification_count( bp_displayed_user_id() );
    		$class    = ( 0 === $count ) ? 'no-count' : 'count';
    		$bp->bp_nav['notifications']['name'] = sprintf( __( 'Alerts <span class="%s">%s</span>', 'buddypress' ), esc_attr( $class ), number_format_i18n( $count ) );
    	} 
    
    }
    add_action('bp_setup_nav', 'custom_notification_menu_tabs', 201);
    #179842
    colabsadmin
    Participant

    Looks like 3 of them are from the same topic (15959). Go into the db and do a search on the activity table for secondary_item_id = 15959. That will give you a link to the topic. Go to it and 1: see if it exists still (probably does) and 2: see if there is something weird about it.

    OH. Is bbpress up to date? Maybe there is a bbpress plugin causing issues?

    I just tested this on my site. I created a topic as one user. I logged in as another and replied to the top. Notification was sent… no problem. I logged in as administrator and deleted the topic completely. The notification title still showed up, so I doubt deletions are your issue.

    Sorry that I’m grabbing at straws. It would help if I was having this problem (glad I’m not) πŸ™‚

    #179656
    Henry Wright
    Moderator

    That sounds like a better approach than mine. I just have a rather crude looking button which marks as read all unread notifications.

    bp_notifications_mark_notifications_by_type is the function I’m using to do the marking. For example:

    if ( bp_is_active( 'notifications' ) ) {
        bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->messages->id, 'new_message' );
        bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->activity->id, 'new_at_mention' );
    }
    #179369
    danbp
    Participant

    Hi @transmission,

    this is not the solution, but an example for your inspiration.
    The below shows how the notification counter can be moved/implemented on the toolbar.

    /* moving the notification counter from right to left */
    remove_action( 'admin_bar_menu', 'bp_members_admin_bar_notifications_menu', 90 );
    function bpfr_notification_ontheleft() {
    	global $wp_admin_bar;
    	
    	if ( !is_user_logged_in() )
    	return false;
    	
    	$notifications = bp_core_get_notifications_for_user( bp_loggedin_user_id(), 'object' );
    	$count         = !empty( $notifications ) ? count( $notifications ) : 0;
    	$alert_class   = (int) $count > 0 ? 'pending-count alert' : 'count no-alert';
    	$menu_title    = '<span id="ab-pending-notifications" class="' . $alert_class . '">' . $count . '</span>';
    	
    	// Add the top-level Notifications button
    	$wp_admin_bar->add_menu( array(
     /*'parent'    => 'top-secondary',*/  // this is the original position
    	'id'        => 'bp-notifications',
    	'title'     => $menu_title,
    	'href'      => bp_loggedin_user_domain(),
    	) );
    	
    	if ( !empty( $notifications ) ) {
    		foreach ( (array) $notifications as $notification ) {
    			$wp_admin_bar->add_menu( array(
    			'parent' => 'bp-notifications',
    			'id'     => 'notification-' . $notification->id,
    			'title'  => $notification->content,
    			'href'   => $notification->href
    			) );
    		}
    	} else {
    		$wp_admin_bar->add_menu( array(
    		'parent' => 'bp-notifications',
    		'id'     => 'no-notifications',
    		'title'  => __( 'No new notifications', 'buddypress' ),
    		'href'   => bp_loggedin_user_domain()
    		) );
    	}
    	
    	return;
    }
    add_action( 'admin_bar_menu', 'bpfr_notification_ontheleft',30);
    /* other position # are 10, 20, 40, 50, 60, 70, 80, 90 */

    In your case, you also have to check this Codex page. And possibly do some research here.

    #179339
    BlinkyBill01
    Participant

    @mercime

    Ok, set up a throw-away account.

    URL: http://slamfans.com/wp/members/demouser01/
    Login: demouser01
    Pass: demo123

    On that demouser01 profile page, you should see where the Achievements link is forced to a second line but it’s still following the CSS positioning. If you visit another member page, you don’t see that error. I’m assuming that’s because you don’t see the Notifications link on other members profiles.

    I’m trying to remember how I did it on another Buddypress site where I was able to force all of the plugin links, like Achievements, into a second line so that the first line remains with all of the default links. I did that about 2-3 years ago and that since has since floated away into the aether. So dunno if it’s even possible anymore with recent changes to Buddypress.

    Hope there’s a solution to be had. (But thinking about it, it would be awesome if there was a plugin that could me made for custom WP themes that would allow you to position links in the order and places you’d like.)

    Thanks!

    Henry Wright
    Moderator

    Hi @oken

    In BP 1.9 + you can now do

    echo bp_notifications_get_unread_notification_count( bp_loggedin_user_id() );

    #177242
    Henry Wright
    Moderator

    @xwafflecakes since BP 1.9, you should have dedicated notifications pages at members/username/notifications/ and members/username/notifications/read/

    Do these help?

    Regarding the notifications ‘bubble’ in the admin bar – you can output the number of notifications a user has like this

    echo bp_notifications_get_unread_notification_count( bp_loggedin_user_id() );

    aboudard
    Participant

    Ok, sorry, I didn’t read the whole topic !

    Here is the solution for those who still have this double display on their notification TAB :

    – Check that you do have Buddypress 1.9.1
    – Seek in your child theme the file : /members/single/home.php
    – Copy this code in it (say line 70 or close, you will see the same kind of code) :

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

    It does work, whatever your /settings/notification.php is customized.
    Enjoy.

    Alain

    brinkingyellows
    Participant

    Hi @r-a-y. Here are the plugins I am currently using on the site.

    Network Activated:

    Advanced Responsive Video Embedder
    Anti-Splog
    Are You a Human
    bbPress
    bbPress – Report Content
    bbPress Enable TinyMCE Visual Tab
    bbpress Simple View Counts
    BP Profile Search
    BuddyPress Activity Plus – (I did deactivate this after the 1.9.1 update but nothing changed)
    BuddyPress Avatar Bubble
    BuddyPress Follow
    BuddyPress Group Calendar
    BuddyPress Groups Extras
    Buddypress Social
    BuddyPress Toolbar
    BuddyPress Twitter
    Buddypress Xprofile Custom Fields Type
    GD bbPress Toolbox
    Group Forum Crumbs
    rtMedia for WordPress, BuddyPress and bbPress
    User Activity
    WP User Avatar

    —-

    Single Site Actived

    Amazon Product In a Post Plugin
    BuddyMenu
    BuddyPress Notifications Widget
    Really simple Facebook Twitter share buttons

    That’s about all the plugins that I have active that play a heavy part in Buddypress or are loosely connected to it.

    #176416

    Team, please help! where should I add the following code in home.php file? what do you mean about the end of loop? Thank you!
    elseif ( bp_is_user_notifications() ) :
    bp_get_template_part( ‘members/single/notifications’ );

    here is home.php
    ———–
    <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 );

    // 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 –>

    #175974
    Henry
    Member

    @macpresss

    Looks solid to me. If you wanted to condense the code into two lines you could use the logical operator &&

    e.g.

    if ( bp_has_notifications( 'user_id=' . bp_loggedin_user_id() ) && is_user_logged_in() ) {
        // ... here I've got the loop stuff ...
    }

    You could also append this bit which will let you output something to logged in users having no notifications:

    else {
        // ... no notifications ...
    }
    airsid
    Participant

    Thanks @mercime for your quick answer.
    But i’m a french novice and i’m not understanding very well what to do in the https://buddypress.trac.wordpress.org/ticket/5299 topic.

    Should I install thos patches:
    5299.01.patch​ and 5299.02.patch​

    or should I follow indications in lastest johnjamesjacoby’s comment:
    In 7689:
    Notifications:
    Add templates and parts for bp-default theme. Also modify home.php to include notifications.php.

    or should I do the both ?

    Sorry for asking but no access to notfications is important for my users πŸ˜‰
    Alos do you have an idea when the next update will be released ?
    Thanks.

    #175570
    Henry
    Member

    @_dorsvenabili when adding custom functions to functions.php it might be a good idea to add a prefix to all of your function names. As you can see buddyboss has done it with buddyboss_childtheme_.

    You could have used dorsvenabili_core_get_notifications_for_user or my_core_get_notifications_for_user

    Saves conflicts from happening πŸ™‚

    #175341
    modemlooper
    Moderator

    You would need to add some sort of css to style the output

    <?php 
        if ( $notifications = bp_core_get_notifications_for_user( bp_loggedin_user_id() ) ) {
    
            if ( $notifications ) {
                echo '<div id="notifications-header"><ul>';
                for ( $i = 0; $i < count($notifications); $i++ ) {
                    $badge = count($notifications);
                    echo '<li>'.$notifications[$i].'</li>';
                }
                echo '</ul></div>';
                echo '<span id="notifications-badge">'.$badge.'</span>';
            }
    
        } 
    ?>
    #174932
    Andrea Fercia
    Participant

    hi @jigesh
    yes you’re right also @nacin says in his post “You should instead the query directly, as there are no inputs”.
    So as long as you don’t have user inputs to sanitize, you’re safe.

    Btw the latest version 1.0.4 of the plugin already solved this, keeping prepare and correctly passing at least 1 argument on both cases (there are 2 query with $wpdb->prepare).
    Note the plugin still passes $list_ids directly in the first case and “1” in the second case so that it’s just a workaround to avoid the PHP warning.
    If you want to keep $wpdb->prepare just to be super-safe, and pass all parameters to prepare, it’s doable with something like this:

    remove brackets from:

    
    $list_ids="(".join(",", $notification_ids).")";
    

    and change it in

    
    $list_ids = join( ",", $notification_ids);
    

    so the first query become:

    
    $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->core->table_name_notifications} WHERE id in (%s) AND is_new = %d", $list_ids, 1)  );
    

    and change the second query:

    
    $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$bp->core->table_name_notifications} WHERE user_id = %d AND is_new = %d", $user_id, 1 ) );
    

    regards
    Andrea

    #174704
    mattg123
    Participant

    @pjbursnall yeah that code replicates the notification element only (the only part that is somewhat confusing to replicate) you place the code in the plugins directory in bp-custom.php you may have to create the file yourself.

    http://stackoverflow.com/questions/9953482/how-to-make-a-pure-css-based-dropdown-menu – shows you how to create a drop down menu, https://codex.wordpress.org/Function_Reference/get_currentuserinfo get the current users info so you can create links to their profile pages, etc.

    Just a note, to add the notifcations to your custom bar your code will look something like <li><?php bp_notification_badge(); ?></li>

    #174702
    mattg123
    Participant

    @pjbursnall Personally I think buddypress should disable admin access anyway as most users don’t want it but that is neither here nor there. Recreating the admin bar is pretty easy, you need to know some css, html and a few bp functions to get the current users details like username etc, as for the notifications @modemlooper or @mercime posted this a while back (my apologies for not remembering which).

    function bp_notification_badge() {
    	if ( is_user_logged_in() ) {
    	global $current_user;
    	get_currentuserinfo();
    			$notifications = bp_core_get_notifications_for_user( bp_loggedin_user_id() );
    				if ( empty($notifications)) {
    				echo '<li class="li-first" id="li-first-right"><a href="' . get_home_url() . '/members/' . $current_user->user_login . '"><span class="circle-zero">0</span></a><ul class="second-level" id="second-level-right"><li class="li-second"><a href="' . get_home_url() . '/members/' . $current_user->user_login . '">No new notifications!</a></li></ul></li>';
    				} else {
    						echo '<ul class="second-level" id="second-level-right">';
    					$counter = 0;
    						for ( $i = 0; $i < count($notifications); $i++ ) {
    						$badge = count($notifications);
    						echo '<li class="li-third">'.$notifications[$i].'</li>';		
    						}
    				echo '</ul>';
    				echo '<a href="' . get_home_url() . '/members/' . $current_user->user_login . '"><span class="circle-badge">'.$badge.'</span></a>';
    			}
    	}
    }

    As for actually disabling the admin bar + backend that can be done with a plugin, plenty of them just google.

    #174261
    applegateian
    Participant

    Thanks @henrywright-1

    It doesn’t seem to make any difference. As I said, my change-avatar page does show a notification, but I just checked change-avatar.php and that doesn’t have <?php do_action( 'template_notices' ); ?> in it either, so I’m not sure how it’s working.

    Any ideas?

    #174165
    olumi_day
    Participant

    Thank you for the prompt response. In my haste, I ended up using this plugin: ( http://www.timersys.com/plugins-wordpress/bp-disable-activation-reloaded ) although it wasn’t the ideal choice since I’m already using a lot of plugins.

    I will definitely try this code out although the “Check Your Email to Activate Your Account” notification could still pose a problem. It just sounds like the kind of thing that wouldn’t bother me at first but then I would quickly become nitpicky about. Either way, I’m happy to just have a nice, easy way to override the activation email without the use of a plugin.

    I do wonder if the users that had already registered prior to me using this override will be able to now log in just fine without still needing the activation email. I did a few test runs using the plugin I mentioned above and found that users who registered prior still needed the activation code to log in.

    Finally, the help tour is a custom plugin built on top of twitter’s bootstrap 3 framework. I found the code for it here: http://bootstraptour.com/
    It was very easy to install and only worked because the theme I’m currently using is built on the bootstrap framework.

    #174037
    Marc K.
    Participant

    Hi Seth!

    Interesting, I didn’t know that you had a BP integration in place for EE. With which BP version was it compatible?

    I know that the BP core developers have their hands full of work, so I won’t blame them for not taking on a complete events module in the core.

    For me the question now is, which plugin takes the least effort to extend on our own. And yes, I know about your crowdfunding like offer to fund extensions to EE. But I need to meet certain deadlines and I don’t think you can guarentee a certain development until then.

    BTW, isn’t the “I’ll attend’ and ‘Maybe’ a pretty simple code addition? A user presses a button which captures that users user id and writes it into a custom field of the event page. The plugin then fetches those ids and shows avatars of those people who attend.

    I found an interesting tutorial (http://wp.smashingmagazine.com/2012/01/27/limiting-visibility-posts-username/) which might lead the way for my other request, specific event visibility/privacy:

    1. Only friends of events creator (again, write all the user ids of the event creator into a custom field thats not visible/accessible to users and then restrict visibility of event page to those users)

    2. Only invited (would require more work. First have a way to notify other users of the event by private message or BP notification. Write the user ids of those into yet another custom field, rest see above)

    I am pretty much a PHP noob. But are these things really so hard to do? More than a week of work for an experienced BP developer?

    protechs2
    Participant

    I activated Twenty Thirteen theme and all appears to work ok EXCEPT after you perform different tasks within members, then at any type Click “All Members” it says “Sorry none found…” One time it displayed correctly with the 2 people that were actual members of the system — me and my 1 friend. That’s the last time I saw that display, except when you choose to sort by Last Active (the 2 appeared as active members). When I click “All Memebers” from here, it returns the 2 people in the member system (not users of the blog).

    When I then clicked on Alphabetical display, it again pulled Most (not all) Users of the blog again with “Add Friend” buttons.
    From there cilcking on the top menu tab “Members” returns the same thing again – the list of Most (not all) blog users with buttons.
    Now, clicking on All Members” returns the same thing again – the list of Most (not all) blog users with buttons.

    Now to My Friends, and the one friend I chose and accepted shows. Notification (a number) showed up next to my Display Name in the Dashboard – as did the message when it arrived. It emailed these notices as well. All Cool!

    If this is all normal behavior, then it’s all the problem of an OLD THEME.

    Thank you for looking this over. Knowing what reality should be is as important as what is happening in real time.

    πŸ™‚

    #172199
    Zane
    Participant

    Thanks! There it is πŸ™‚

    So there appears to be an issue with my user receiving emails from the site. I triple checked my profile email address with no luck. No messages to my spam folder or anything. Any idea’s what might cause all notifications for my admin user to be disabled?

    #171536
    minto
    Participant

    Thanks for pasting, @carco

    Strangewise the issue remains, even with your entire script.
    Still no entries for user_id in db
    (which then might cause, that no notifs appear, probably?)
    but “users-who-like” works again^^

Viewing 25 results - 451 through 475 (of 768 total)
Skip to toolbar