Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'notifications counter'

Viewing 25 results - 51 through 75 (of 75 total)
  • Author
    Search Results
  • @mcuk
    Participant

    Hi all,

    I am trying to insert a notification counter bubble within my main navigation menu after one specific ‘menu item li id’. Using the code below I have managed to display the counter correctly on the page but am unable to work out how to place it where I want after the desired menu item. Can anyone offer any pointers?

    I already have the code to display the notification counter:

    echo bp_notifications_get_unread_notification_count( bp_loggedin_user_id() );

    I then added it to my theme’s child header.php within the main menu container div and gave it it’s own div & id to enable styling:

    <div id="testid"><?php echo bp_notifications_get_unread_notification_count( bp_loggedin_user_id() ); ?></div>

    (Putting it here was just a test to see if the echo and CSS were correct).

    The CSS which makes it appear correctly:

    #testid {
    	background: #eee;
    	border-radius: 50%;
    	border: 1px solid #ccc;
    	color: #000;
    	display: inline;
    	font-size: 70%;
    	margin-left: 2px;
    	padding: 3px 6px;
    	text-align: center;
    	vertical-align: middle;
    }

    I ran a search for ‘notification counter’ along with a few other things but didn’t come across a recognisable solution.

    Thanks

    #235574
    danbp
    Participant

    hi @tennaki,

    did you searched a little before asking ? 😉
    This subject was handled many times in the past.
    https://buddypress.org/support/search/notifications+counter/

    #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 );
    #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++;
    			}	
    #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,…

    #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 ! 😉

    #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.

    #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.

    danbp
    Participant

    hi @pascalh,
    your issue maybe related to your theme or a custom function you use.

    The original “notifications” string is in bp-notifications/bp-notifications-loader.php:109
    Check the po file first
    If you made a custom function to get the menu, check that function.

    Be aware that the words “notifications”, “friends” and “groups” are coming with a count and that this counter is included in the translation within a html span tag. This is technically the point who made such translation not showing in some case. Because gettext is not very compleasant with html tags… So the problem can also be the strictness of the php version on use on your server.

    You can test this by writing your translation without using the span tag. (meldingen %d for example). If this ok, you’ll be fixed.

    #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.

    #167928

    In reply to: My account menu

    mathieu.urstein
    Participant

    @espellcaste
    do you have some news?
    I have been able to take the notifications like this :

    // notifications
    function my_bp_adminbar_notifications_menu() {
    	global $bp;
    
    	if ( !is_user_logged_in() )
    		return false;
    
    	echo '<li id="menu-item-9991" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-9991 parent">';
    //	_e( 'Alerts', 'buddypress' );
    
    	if ( $notifications = bp_core_get_notifications_for_user( $bp->loggedin_user->id ) ) { ?>
    		<a href="#"><span id="notifs_top"><?php echo count( $notifications ) ?></span></a>
    	<?php
    	}
    
    	echo '</a>';
    	echo '<ul class="sub-menu">';
    
    	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>';
    }
    #166070
    Tecca
    Participant

    You can make your own. Here’s mine as an example. You’ll need to tinker around with the CSS or code if you’d like to display them differently. What the below does is it shows a number (the amount of notifications you have) when you have one or more. It is hidden when there are none to display. Hovering over the number will display your notifications in a drop-down.

    Place into bp-custom.php:

    /**
    * Add Notification number to template
    */
    function my_bp_adminbar_notifications_menu() {
    global $bp;
    
    if ( !is_user_logged_in() )
        return false;
    
    echo '<div class="notices"><ul class="notices">';
    _e( '', 'buddypress' );
    
    if ( $notifications = bp_core_get_notifications_for_user( $bp->loggedin_user->id ) ) { ?>
        <li class="parent"><span class="notice-badge"><?php echo count( $notifications ) ?></span>
    <?php
    }
    
    echo '</a>';
    echo '<ul class="sub-menu">';
    
    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></li>';
    echo '</ul></div>';
    }

    CSS:

    /*-------------------------- Notification dropdown -----------------------------------*/
    .notice-badge { font-weight: bold; cursor: default; background: #d33939; padding: 0 3px; border-radius: 10px }
    .parent.user-bar { width: 86px; text-align:left; float: right; font-weight: bold; }
    .notices { float: right; margin:0; line-height: 45px; z-index: 9999; }
    .notices a { color: #ffffff; }
    .notices ul, .notices { margin:0 2px 0 0; padding:0; list-style-type:none; list-style-position:outside; position:relative; }
    .notices ul a:link, .notices ul a:active, .notices ul a:visited { display:block; padding: 0; text-decoration:none; }
    .notices ul ul a:link, .notices ul ul a:active, .notices ul ul a:visited { width: 480px; display:block; padding:0 7px; text-decoration:none; }
    .notices ul ul a:hover { color: #0d385f; text-shadow: none; }
    .notices ul li { float:left; position:relative; background:none; padding:0 12px; }
    .notices ul li:hover { transition: all 100ms ease-in; }
    .notices ul ul { width: 480px; line-height: 35px; background: #ffffff; position:absolute; right: 0; top:45px; text-align:left; padding:0; display:none; border:1px solid #eeeeee; border-bottom:none; border-top:none; box-shadow:0 0 2px rgba(0, 0, 0, 0.15), 0 3px 5px rgba(0, 0, 0, 0.1); }
    .notices ul ul a { color:#248361; font-weight: bold; }
    .notices ul li ul a { float:left; }
    .notices ul li ul ul { left:-170px; top:2px; margin:0px; border-right:3px solid #cccccc; border-top:1px solid #eeeeee; }
    .notices ul li ul li { width: 480px; padding:0; margin:0; border-bottom:1px solid #eeeeee; max-width:none; list-style-type:none; text-shadow: none; }
    .notices ul li ul li:hover { background: #f5f5f5; }
    .noticesn ul li:hover ul ul, ul li:hover ul ul ul, ul li:hover ul ul ul ul { display:none; }
    .notices ul li:hover ul, .notices ul li li:hover ul, .notices ul li li li:hover ul, .notices ul li li li li:hover ul { display:block; }
    .notices ul li ul.children li { list-style-type:none; }
    .notices ul li ul li.current-menu-item { background:#f5f5f5; }
    .notices ul li ul li.current-menu-item a { color:#585858; }
    .notices ul li.current-menu-item span { color:#585858; }
    .notices ul li.parent { background-image: url(images/menu-arrow-transparent.png); background-position: center center; background-repeat: no-repeat; }
    .notices ul li.parent:hover { background-image: url(images/menu-arrow1.png); background-position: 14px 36px; background-repeat: no-repeat; }
    .notices ul li ul li.parent:hover { background-image: url(images/menu-arrow-left.png); background-position: 152px center; background-repeat: no-repeat; }

    Place into header.php or wherever you’d like your notifications shown:
    <?php my_bp_adminbar_notifications_menu()?>

    #156809
    Shahzaib Sabir
    Participant

    @chouf1 thank you. This really works.
    Is there any idea that it works the same for the front end of the website too?
    I mean by applying the above code the counter moves at the back end bar but when visits the front end there, at bar, the counter still remains on the right side.
    I would love to listen. Again, thank you so much.

    danbpfr
    Participant

    here’re the 3 counter. Their names are explicit enough i guess to see the right place where to use 😉

    echo bp_friend_get_total_requests_count( $user_id );

    echo bp_get_total_unread_messages_count($name );

    echo count($notifications);

    #103479
    calvinhsu
    Participant

    @acaps2007
    What I’ve found finally:

    (It’s based on this article:
    http://easyoutsource.com/blog/how-to-code-a-custom-adminbar-in-buddypress/)

    So if you just set your adminbar to be hidden in css rather than completely disable it in the wp-config.php, you could use to call the notification menu.

    If you’ve completely disabled adminbar, then use the following code instead(it’s copied from bp-core-adminbar.php):

    <?php
    global $bp;
    
    if ( !is_user_logged_in() )
    return false;
    
    echo '<li id="bp-adminbar-notifications-menu"><a>loggedin_user->domain . '">';
    _e( 'Notifications', 'buddypress' );
    
    if ( $notifications = bp_core_get_notifications_for_user( $bp->loggedin_user->id ) ) { ?>
    <span></span>
    <?php
    }
    
    echo '</a>';
    echo '<ul>';
    
    if ( $notifications ) {
    $counter = 0;
    for ( $i = 0; $i < count($notifications); $i++ ) {
    $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?>
    
    <li></li>
    
    <?php $counter++;
    }
    } else { ?>
    
    <li><a href=&quot;loggedin_user->domain ?>"></a></li>
    
    <?php
    }
    
    echo '</ul>';
    echo '</li>';
    ?>
    

    And as I have found out, the js effect (what you called the “mouse over” effect) is dealt automatically by bp-themes/bp-default/_inc/global.js

    In my case, I’m building a child theme of bp-default, so I don’t have to worry about js, just copy and paste css codes from bp-themes/bp-default/_inc/css/adminbar.css and adjust selectors accordingly.

    If you are not building a child theme of bp-default, then maybe you can try search in the global.js and make some copy and past.

    Good luck !

    #103461

    In reply to: Hide General Settings

    r-a-y
    Keymaster

    Add the following to your theme’s functions.php:

    `function ray_bp_remove_settings() {
    global $bp;

    // removing the existing settings tab
    bp_core_remove_nav_item( $bp->settings->slug );
    }
    add_action( ‘init’, ‘ray_bp_remove_settings’, 0 );

    function ray_bp_readd_settings() {
    global $bp;

    // add a new settings tab to use notifications as default tab
    bp_core_new_nav_item( array( ‘name’ => __(‘Settings’, ‘buddypress’), ‘slug’ => $bp->settings->slug, ‘position’ => 100, ‘show_for_displayed_user’ => false, ‘screen_function’ => ‘bp_core_screen_notification_settings’, ‘default_subnav_slug’ => ‘notifications’ ) );

    // bug in bp_core_remove_subnav_item(), we have to hack the screen function so it displays the notifications screen when you land on /settings/
    if ( $bp->current_component == $bp->settings->slug && $bp->current_action == ‘general’ )
    add_action( ‘wp’, ‘bp_core_screen_notification_settings’, 3 );

    // add back the subnav notifications tab
    $settings_link = $bp->loggedin_user->domain . $bp->settings->slug . ‘/’;

    bp_core_new_subnav_item( array( ‘name’ => __( ‘Notifications’, ‘buddypress’ ), ‘slug’ => ‘notifications’, ‘parent_url’ => $settings_link, ‘parent_slug’ => $bp->settings->slug, ‘screen_function’ => ‘bp_core_screen_notification_settings’, ‘position’ => 20, ‘user_has_access’ => bp_is_my_profile() ) );
    }
    add_action( ‘init’, ‘ray_bp_readd_settings’ );`

    Tested lightly. Encountered a few bugs, but this will work…

    #73847
    Gianfranco
    Participant

    I tried this, doesn’t print anything neaither:

    <ul id="user-menu">
    <li><a href="<?php echo bp_loggedin_user_domain() ?>/profile/edit/">My profile</a></li>
    <li>| <a href="<?php echo bp_loggedin_user_domain() ?>/messages/">My messages</a></li>
    <li>| <a href="<?php echo bp_loggedin_user_domain() ?>/groups/">My groups</a></li>
    <li>| <a href="<?php echo bp_loggedin_user_domain() ?>/friends/">My friends</a></li>
    <li>| <a href="<?php echo bp_loggedin_user_domain() ?>/photos/">My photos</a></li>
    <li>| <a href="<?php echo bp_loggedin_user_domain() ?>/settings/">Settings</a></li>

    <?php function my_bp_adminbar_notifications_menu() {
    global $bp;

    if ( !is_user_logged_in() )
    return false;

    echo '<li id="bp-adminbar-notifications-menu"><a href="' . $bp->loggedin_user->domain . '">';
    _e( 'Notifications', '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 ) { ?>
    <?php $counter = 0; ?>
    <?php for ( $i = 0; $i < count($notifications); $i++ ) { ?>
    <?php $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?>
    <li<?php echo $alt ?>><?php echo $notifications[$i] ?></li>
    <?php $counter++; ?>
    <?php } ?>
    <?php } else { ?>
    <li><a href="<?php echo $bp->loggedin_user->domain ?>"><?php _e( 'No new notifications.', 'buddypress' ); ?></a></li>
    <?php
    }

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

    <?php if( function_exists('my_bp_adminbar_notifications_menu') ) my_bp_adminbar_notifications_menu(); ?>

    </ul>

    Is anything in there correct?

    #73834
    Gianfranco
    Participant

    @r-a-y I tried this:

    <?php function my_bp_adminbar_notifications_menu() {
    global $bp;

    if ( !is_user_logged_in() )
    return false;

    echo '<li id="bp-adminbar-notifications-menu"><a href="' . $bp->loggedin_user->domain . '">';
    _e( 'Notifications', '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 ) { ?>
    <?php $counter = 0; ?>
    <?php for ( $i = 0; $i < count($notifications); $i++ ) { ?>
    <?php $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?>
    <li<?php echo $alt ?>><?php echo $notifications[$i] ?></li>
    <?php $counter++; ?>
    <?php } ?>
    <?php } else { ?>
    <li><a href="<?php echo $bp->loggedin_user->domain ?>"><?php _e( 'No new notifications.', 'buddypress' ); ?></a></li>
    <?php
    }

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

    Which is the same funtion except for the name “my_bp_adminbar_notifications_menu”.

    It doesn’t print anything.

    Probably something with the “bp_core_get_notifications_for_user” that is desabled because of my desabling the default Admin bar?

    I admit that I php is not my strong point at all.

    #73421
    r-a-y
    Keymaster

    Fixed in the 1.2 branch – courtesy Andy:

    https://trac.buddypress.org/changeset/2921

    [EDIT]

    For friend requests… haven’t encountered the other issues above yet.

    stwc
    Participant

    I’ve run in to this with importing a userbase to a Buddypress install. WordPress likes login names to be lowercase, with no spaces, and no non-alphanumerics (except, I think for dashes (‘-‘).

    Users can, of course, make their display name anything they like.

    The follow-on problem though, is with @username notifications in BP1.2+, which work on the login name and not the display name, so if a user has the login username johnsmith and the display name John, only @johnsmith will work.

    (I’ve also just recently encountered a problem in that usernames with dashes cause @notifications to fail. That is, if a username is johnsmith, @johnsmith works, but if his username is john-smith @john-smith fails.)

    #70457
    Mike Pratt
    Participant

    @LwEEs

    You can also place this code anywhere you want and style your own little Notifications Block:

    <!-- Notifications block -->
    <?php
    echo '<li id="notifications-menu"><span id="menu-title">
    <a href="' . $bp->loggedin_user->domain . '">';
    _e( 'Notifications', 'buddypress' );

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

    if ( $notifications ) { ?>
    <?php $counter = 0; ?>
    <?php for ( $i = 0; $i < count($notifications); $i++ ) { ?>
    <?php $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?>
    <li<?php echo $alt ?>><?php echo $notifications[$i] ?></li>
    <?php $counter++; ?>
    <?php } ?>
    <?php } else { ?>
    <li><a href="<?php echo $bp->loggedin_user->domain ?>">
    <?php _e( 'No new notifications.', 'buddypress' ); ?></a></li>
    <?php
    }
    echo '</ul>';
    echo '</li>';
    ?>

    #60124
    kineda
    Participant

    Thanks. That clears things up. The only other problem I’ve encountered is after I deactivate the BuddyPress plugin and re-activate it, I’ll get the follow db errors:

    WordPress database error: [Duplicate key name ‘useritem’]

    ALTER TABLE wp_bp_notifications ADD KEY useritem (user_id, is_new)

    WordPress database error: [Table ‘wp_bp_activity’ already exists]

    RENAME TABLE wp_bp_activity_user_activity_cached TO wp_bp_activity

    WordPress database error: [Duplicate entry ‘1’ for key 1]

    INSERT INTO wp_bp_xprofile_groups VALUES ( 1, ‘Base’, ”, 0 );

    WordPress database error: [Duplicate entry ‘1’ for key 1]

    INSERT INTO wp_bp_xprofile_fields ( id, group_id, parent_id, type, name, is_required, can_delete ) VALUES ( 1, 1, 0, ‘textbox’, ‘Name’, 1, 0 );

    #51652
    r-a-y
    Keymaster

    Just experienced the OP’s problem.

    I looked into it and found a tentative fix… though a BP dev will need to look at the code.

    In “bp-core/bp-core-notifications.php”, look for the bp_core_notifications_for_user() function.

    Then look for these lines:

    $item_id = ( 1 == $action_item_count ) ? $component_action_items[0]->item_id : false;
    $secondary_item_id = ( 1 == $action_item_count ) ? $component_action_items[0]->secondary_item_id : false;

    Change this to:

    $item_id = $component_action_items[0]->item_id;
    $secondary_item_id = $component_action_items[0]->secondary_item_id;

    I don’t know why there was a check done for only 1 item and then returning false for more than 1… if a BP dev can explain why, that’d be great.

    Let me know if anyone encounters any problems.

    Trac ticket made.

    #36748

    In reply to: Forum notifications

    fishbowl81
    Participant

    @gpo1

    Due to all communication of buddypress and bbpress being done over xmlrpc, the normal plugins most likely won’t work. I have been looking at ones like a view counter and they require massive modification of buddypress. Because of caching, the forums are not always pulled from bbpress. So it would produce falsely low view count.

    Also, group forums, are just a single forum in bbpress, this changes the administration and moderation of the forums and topics. If someone is a moderator on bbpress, they can moderate the whole site I believe, with buddypress a moderator is only a moderator of that group forum.

    Hope this helps,

    Brad

Viewing 25 results - 51 through 75 (of 75 total)
Skip to toolbar