Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'notification user id'

Viewing 25 results - 301 through 325 (of 772 total)
  • Author
    Search Results
  • #257510
    mshane8
    Participant

    Hey Guys –

    I have a project where its a social community site where all the members create the site content on their own. I have 2 profiles(roles) that all users will fall under (employer & employee). Then I have 3 membership levels for each role (FREE, Standard & Premium). The idea is to pair up these users by category and control the level of access/features they have based on account type. So direct messaging is available only to premium members, push notifications only available to premium members. The more features and ability to build out your profile is based on your membership type. I would obviously add membership plugin to restrict access and capability as well as ecommerce capability for checkout.

    I know bbPress and BuddyPress are forums and social communities but will they integrate well into membership type communities where clients need to pay for additional access to social community and forum features?

    If not, is there a premium application that handles these types of projects?

    Thanks so much!

    #256722
    ah72king
    Participant

    I found a solution that can help

    
    <?php
    // For Custom Notification 
    // Registering Custom Componet 
    function custom_filter_notifications_get_registered_components( $component_names = array() ) {
     
        // Force $component_names to be an array
        if ( ! is_array( $component_names ) ) {
            $component_names = array();
        }
    
        // Add 'custom' component to registered components array
        array_push( $component_names, 'custom' );
     
        // Return component's with 'custom' appended
        return $component_names;
    }
    add_filter( 'bp_notifications_get_registered_components', 'custom_filter_notifications_get_registered_components' );
    
    // Formatting custom with respect to action
    function bp_custom_format_buddypress_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) {
     		
     		//$item_id this your id which you can use to get your respected data
        	$data  = get_my_values_custom_function($item_id); // this is custom function it depend on your needs and data
        	$custom_title = $data->title;
        	$custom_link  = $data->link;
        	$custom_text  = $data->text;
    
        // New custom notifications
        if ( 'custom_action' === $action ) {
            
            // WordPress Toolbar
            if ( 'string' === $format ) {
                $return = apply_filters( 'custom_filter','Your custom notification for <a href="'.$custom_link.'">'.$custom_title.'</a> ', $custom_text, $custom_link );
     
            // Deprecated BuddyBar
            } else {
                $return = apply_filters( 'custom_filter', array(
                    'text' => $custom_text,
                    'link' => $custom_link
                ), $custom_link, (int) $total_items, $custom_text, $custom_title );
            }
            
            return $return;
            
        }
       
    }
    add_filter( 'bp_notifications_get_notifications_for_user', 'bp_custom_format_buddypress_notifications', 10, 5 );
    
    // Adding custom Notification in DB 
    function bp_custom_notification( $item_id, $author_id ) {
    
        if ( bp_is_active( 'notifications' ) ) {   // if notification is active from admin panel
        	// if notification is active from admin panel bp_notifications_add_notification function to add notification into database
            bp_notifications_add_notification( array(                        
                'user_id'           => $author_id, // User to whom notification has to be send
                'item_id'           => $item_id,  // Id of thing you want to show it can be item_id or post or custom post or anything
                'component_name'    => 'custom', //  component that we registered
                'component_action'  => 'custom_action', // Our Custom Action 
                'date_notified'     => bp_core_current_time(), // current time
                'is_new'            => 1, // It say that is new notification
            ) );
        }
    }
    add_action( 'custom_hooks', 'bp_custom_notification', 10, 2);
    /**
    * custom_hooks is action name which will be call by do_action() function
    * bp_custom_notification your function name
    * 10 is priority number
    * 2 is number of parameter 
    */
    
    /****
    * Now Where to call custom_hooks and how 
    */
    
    do_action('custom_hooks', $item_id, $author_id );
    
    /****
    * place it where you want to call this action and pass parameter
    */ 
    
    #256710
    ah72king
    Participant

    I have custom plugin in which i have review approved and delete functions so when i do some sort of bulk action like delete or i approved a review.
    i want to generate a bp custom notifications at that user dashboard or member page which review was approved or deleted
    i place this where i perform approved action

    do_action('review-approved');

    Then i make function below


    function bp_review_add_notification() {
    if ( bp_is_active( 'notifications' ) ) {
    bp_notifications_add_notification( array(
    'user_id' => 1, // this is one because for testing just admin now
    'component_name' => 'review',
    'component_action' => 'review_approved',
    'date_notified' => bp_core_current_time(),
    'is_new' => 1,
    ) );
    }
    }
    add_action( 'review-approved', 'bp_review_add_notification',10,5);

    Review is added in database i checked that but it is not shown on dashboard or member page
    how to do that

    or can you refer any complete guide to create a custom notification upon some action

    socialc
    Participant

    <?php echo bp_notifications_get_unread_notification_count(bp_loggedin_user_id()); ?>

    You can build your own menu using this inside to show the count.

    doubleF
    Participant

    Hello @shanebp,

    I’ve changed the secondary_item_id with : get_current_user_id()

    And it’s the same issue, notification is created but doesn’t seem to be assigned to any profile :/

    Thanks for the help.

    shanebp
    Moderator

    'secondary_item_id' should be the user id of the person creating the notification.
    That might be the problem.

    #255647

    In reply to: Confirmation Email

    Dono12
    Participant

    Thanks for your prompt response and your help but that function did not achieve the goal I was looking for. I wanted the activation Key to come from Cymi User Extra Field. I found a solution from someone with a similar problem but it is a little too extreme for me. The result you get is a Cymi User Extra Field Key/URL, Looks like This(cimy_key=88fddcb568dcf2d6). It involved editing a core Buddypress file wp-content/plugins/buddypress/bp-core/bp-core-filters.php. Can you help with a function for my functions.php or bp-custom to achieve the same goal. If it’s not too much maybe generate the Cymi-Key in the Buddypress Email Template though not a priority. I’m fully aware that editing core files is not practical, especially being that you lose it during updates.

    https://buddypress.org/support/topic/activation-email-key-doesnt-work-i-may-have-the-fix/

    function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta ) {
    
    $activate_url = bp_get_activation_page() . "key=$key";
    $activate_url = esc_url($activate_url);
    $admin_email = get_site_option( 'admin_email' );
    
    if ( empty( $admin_email ) )
    $admin_email = 'support@' . $_SERVER;
    
    // Then it ends with, on line 255
    
    add_filter( 'wpmu_signup_user_notification', 'bp_core_activation_signup_user_notification', 1, 4 );
    #255632

    Topic: Confirmation Email

    in group forum Requests & Feedback
    Dono12
    Participant

    I’m using Cymi User Extra Field, when you enable email confirmation the user gets the Buddypress email template
    with the confirmation link. when the user clicks the link it takes them to the confirmation page of the site prompting them
    to login with username and password. Problem is the user name and password doesnt work. The user gets created because they
    are visible in the users list. How can I fix this problem.
    I’ve disabled the Buddypress sign up for the default WordPress using: BP CUSTOM

    function my_disable_bp_registration() {
      remove_action( 'bp_init',    'bp_core_wpsignup_redirect' );
      remove_action( 'bp_screens', 'bp_core_screen_signup' );
    }
    add_action( 'bp_loaded', 'my_disable_bp_registration' );
    add_filter( 'bp_get_signup_page', "firmasite_redirect_bp_signup_page");
        function firmasite_redirect_bp_signup_page($page ){
            return bp_get_root_domain() . '/wp-login.php?action=register'; 
     }

    and I found this code in a Buddpress Forum:

    https://buddypress.trac.wordpress.org/ticket/3443

    // Change the text on the signup page

    add_filter( 'bp_registration_needs_activation', '__return_false' );
    
    function my_disable_activation( $user, $user_email, $key, $meta = '' ) {
    	// Activate the user
    	bp_core_activate_signup( $key );
    
    	// Return false so no email sent
    	return false;
    }
    add_filter( 'wpmu_signup_user_notification', 'my_disable_activation', 10, 4 );
    
    

    I tried it with the hope that the key would be disabled and the key fired by WordPress would take over but it still didnt work.

    I really don’t care who fires the key I just want the user to be able to login after click the key in their email.

    Mike
    Participant

    How do you position the notification counter for dropdown items? For example,

    array_splice( $items_array, 7, 0, '<li class="bubble">' . friends_get_total_friend_count( bp_loggedin_user_id() ) . '</li>' ); // 0,0 1st position, 1,0 2nd, etc

    if there was a dropdown menu below this menu item (below position 7,0), what would the position be labelled as? I’ve tried 7,1 but no luck.

    #255474
    ljmac
    Participant

    Unfortunately none of these are quite what I’m after – the following code comes close, but I don’t want a login redirect – just a standard redirect from /members/%username%/activity/mentions/ to /members/%username%/activity/. How can I modify this code to achieve my desired outcome?

    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);
    ljmac
    Participant

    Hi,

    I have a Facebook-style wall set up as the default tab for activity on users’ BuddyPress profiles. This makes some of the other subnavs redundant, so I’ve hidden them. However, when a user gets mentioned, the notification sends them to the Mentions tab (which I’ve also hidden). How can I redirect them to their wall (/members/%username%/activity/)? BuddyPress’ dynamic URLs make this much less straightforward than usual.

    #255314
    shanebp
    Moderator

    You should not change that function. You should use the hook.

    Try something like this in your theme functions.php:

    function hosam_delete_notification( $topic_id ) {
    
       // you cannot send an array
       // create individual variables
       $user_id = 386;  // etc
    
       bp_notifications_delete_notifications_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id = false );
    
    }
    add_action( 'bbp_trash_topic', 'hosam_delete_notification' );
    #255243
    sharmavishal
    Participant

    1. In BuddyPress, we by default get to see member page. I want to know how to redirect someone who is logging in/ new user after registration to News feed?

    search for login redirect plugins for buddypress

    2. I want to keep those wall, timeline and all in menu bar instead of profile tab. How to do that?

    check wp admin bar codex or associated plugins

    3. I am unable to hide admin bar/ that WordPress logo bar for non-admin user. no plugin helping me out.

    am aware of atleast 2 plugins which are working for me. u need to test/check which ones work with ur theme/setup

    4. how to make the menu such that signed in user can see log out button and other sign in/ register?

    via buddypress components in the menus. logged in and logged out menu links

    5. how to enable realtime notification and instant messaging private n groups both?

    notification is already there and its real time. i belive there is a group chat plugin for buddypress as well

    6. how to remove show dropdown menu in profile

    that would depend on ur theme which u are using

    PS:- I don’t know PHP much. moreover, I cannot afford to hire someone.

    then this would take much time and effort to customise it as per ur needs

    start from here

    Configure BuddyPress

    #255238
    kunaldas1997
    Participant

    hello there!

    I am new to BuddyPress.
    1. In BuddyPress, we by default get to see member page. I want to know how to redirect someone who is logging in/ new user after registration to News feed?
    2. I want to keep those wall, timeline and all in menu bar instead of profile tab. How to do that?
    3. I am unable to hide admin bar/ that WordPress logo bar for non-admin user. no plugin helping me out.
    4. how to make the menu such that signed in user can see log out button and other sign in/ register?
    5. how to enable realtime notification and instant messaging private n groups both?
    6. how to remove show dropdown menu in profile
    PS:- I don’t know PHP much. moreover, I cannot afford to hire someone.

    #255213
    m1000
    Participant

    After upgrade the custom loop with notifications doesn’t work anymore:

    if ( is_user_logged_in() ) {
       if ( function_exists( 'bp_is_active' ) ) {
    	if ( $notifications = bp_notifications_get_notifications_for_user( bp_loggedin_user_id(), $format = 'string' ) ) { ?>
    	<div class="notif-container">
    	<?php
    	}
    
    	if ( $notifications ) {
    		$counter = 0;
    		for ( $i = 0, $count = count( $notifications ); $i < $count; ++$i ) {
    			$alt = ( 0 == $counter % 2 ) ? ' alt' : ''; ?>
    			<div class="my-notification<?php echo $alt ?>"><?php echo $notifications[$i] ?></div>
    
    			<?php
    			 $counter++;
    			} ?>
    	</div><!-- notif-container -->
    	<?php
    	} else {}
       }
    }

    It returns ‘Array’

    #255157
    Andrew
    Participant

    I’ve been trying to work out how to get the user IDs for the notification items so I can display notification user avatars.

    Is this the best way to do it, I’ve tested this with a few users and seems to work:

    function test_notifications_avatar() {
    	
    	$bp      = buddypress();
    	$user_id = $bp->notifications->query_loop->notification->secondary_item_id;
    	
    	if ( empty( $user_id ) )
    		$user_id = $bp->notifications->query_loop->notification->item_id;
    
    	echo bp_core_fetch_avatar( array( 'item_id' => $user_id, 'type'  => 'thumb' ) );
    }
    #255156
    hosam020
    Participant

    @shanebp Thank you for the kindly reply
    Yes i am using it.
    i think you mean i have to call this action in theme funcation ourside the bp localfile.

    unction bbp_trash_topic( $topic_id = 0 ) {
    
    	// Validate topic ID
    	$topic_id = bbp_get_topic_id( $topic_id );
    
    	if ( empty( $topic_id ) || !bbp_is_topic( $topic_id ) )
    		return false;
    
    		$args = array(
    		'user_id'           => 386,
    		'item_id'           => $topic_id,
    		'secondary_item_id' => 0,
    		'component_name'    => 'forums',
    		'component_action'  => 'new_topic',
    		);
    	
    	bp_notifications_delete_notifications_by_item_id( $args );
    
    	do_action( 'bbp_trash_topic', $topic_id );

    Please ignore the args param just added a notification param to see if will delete it
    but never happend
    Sorry for my bad english i hope u understand me.

    jameshh93
    Participant

    I have been using this code to echo out a bubble for my header however it used to work flawlessly but now it just gives me ” Fatal error: Call to undefined function bp_get_total_unread_messages_count() in C:\Program Files (x86)\Ampps\www\retaggr101\wp-content\themes\twentysixteen\header.php on line 167″

    which kind of makes no sense at all.

    
    		              <?php 
    					  
    					            $count = bp_get_total_unread_messages_count( bp_loggedin_user_id() );
                                           if ( $count > 0 ) {
                                        echo '<div class="site-header-user-notifcations-bubble">'; echo $count; echo '</div>';
                                        } else {
                                       // The notif count is 0.
                                            }
    					  
    					  
    					  ?>

    espcially when this code works

     <?php 
    					  
    					            $count = bp_notifications_get_unread_notification_count( bp_loggedin_user_id() );
                                           if ( $count > 0 ) {
                                        echo '<div class="site-header-user-notifcations-bubble">'; echo $count; echo '</div>';
                                        } else {
                                       // The notif count is 0.
                                            }
    					  
    					  
    					  ?>
    #254722
    Andrew Tegenkamp
    Participant

    When a member requests to join a private group the button shows “Request Sent” but I’d like to change that to say “Request Sent – Cancel” and have that cancel the request (and delete the notification).

    I saw on this post from last year it would need to be a custom function and didn’t see it anywhere but wasn’t sure if that has been added or if there’s a best practice for it.

    Thanks,
    Andrew

    sharmavishal
    Participant

    if it helps following non bp errors with rc1

    Notice: bbp_setup_current_user was called incorrectly. The current user is being initialized without using $wp->init(). Please see Debugging in WordPress for more information. (This message was added in version 2.3.) in wp-includes/functions.php on line 3897

    Notice: bp_setup_current_user was called incorrectly. The current user is being initialized without using $wp->init(). === Trace: #6 wp-content/plugins/wordpress-seo/admin/class-yoast-notification-center.php(421): get_current_user_id() #7 wp-content/plugins/wordpress-seo/admin/class-yoast-notification-center.php(31): Yoast_Notification_Center->retrieve_notifications_from_storage() #8 wp-content/plugins/wordpress-seo/admin/class-yoast-notification-center.php(49): Yoast_Notification_Center->__construct() #9 wp-content/plugins/wordpress-seo/wp-seo-main.php(373): Yoast_Notification_Center::get() #10 [internal function]: load_yoast_notifications(”) #11 wp-includes/plugin.php(525): call_user_func_array(‘load_yoast_noti…’, Array) #12 wp-settings.php(277): do_action(‘plugins_loaded’) #13 /opt/www/hobbysocialnetwork.c in wp-includes/functions.php on line 3897

    even with yoast seo disabled the site doesnt come up

    #254626
    danbp
    Participant

    Private message

    A user must have friends to send private messages or visit the profile of another user to send him a msg.

    Messages

    To get it to work, you need also to enable following options in BP settings:
    – Friend Connections
    – Private messaging
    Additionnally, if you want to be notified by email
    – Notifications

    Whatever the option you activate, best practice is to control how it works on your config. To do that, use only WP, BP and one of Twenty’s theme before activating a third party theme and any other plugin.
    This will ensure you that BP is fully working on a standart WP config.

    Mention

    @mention use AJAX which can in some case, mostly with sophisticated themes or frameworks, lead to conflict. In that case, the culprit isn’t BP or WP, but the theme or a plugin whose code (generally) use a different standart as WP.

    If you get issues with mention or messaging, activate wp_debug in wp-config and check your browser JS console to track down errors. The one or the other can give you precious debug information. You can also use a debug tool like Firebug.

    #254614
    bryanbatcher
    Participant

    I want to remove “Notifications”, “Messages”, and “Settings” from the first nav bar on user pages.

    I’d also like to hide the user header (the profile pic, username, and cover photo section) on certain user pages.

    Any help would be appreciated.

    BP 2.5.3
    WP 4.5.2

    shanebp
    Moderator

    This will remove the Email tab.

    function waqas_remove_friends_activity_nav() {
    	bp_core_remove_subnav_item( 'settings', 'notifications' );
    }
    add_action( 'bp_setup_nav', 'waqas_remove_friends_activity_nav', 15 );

    This will set all the notification settings to ‘no’ for a specific user:

    function waqas_email_notifications( $user_id ) {
    	
    	$settings = bp_settings_get_registered_notification_keys(); 
    	
    	foreach ( $settings as $setting ) {
    		bp_update_user_meta( $user_id, $setting, 'no' );
    	}
    	
    }

    For new users, you could do this:

    function waqas_bp_core_activated_user(  $user_id, $key, $user ) {
         waqas_email_notifications( $user_id );
    }
    add_action( 'bp_core_activated_user', 'waqus_bp_core_activated_user', 10, 3 );
    waqastechlover
    Participant

    Hi all!
    I want to know that how can I remove email tab from the settings page of users profile.
    I mean that when a user opens his profile and go to settings. There is an Email tab to let the user to decide which email notifications he would like to receive. I want to remove this tab completely.
    I also want to disable every email notifications for users by default.
    Please tell me how to do both of these things. I shall be very very grateful!
    Thanks a lot in advance and best Regards, Waqas Ramzan Techlover, Web Master of Blind Help Project (BHP) http://www.blindhelp.tk

    Using latest version of WordPress and BuddyPress and the latest version of responsive theam.

    danbp
    Participant

    Give this a try: (add to bp-custom.php) 1) & 2):

    function bpfr_hide_tabs() {
    global $bp;
    
    	if ( bp_is_user() && !is_super_admin() ) {
    		bp_core_remove_nav_item( 'notifications' );
    		bp_core_remove_subnav_item( 'messages', 'compose' );
    	}
    	
    }
    add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );

    3) With BP and xprofile component activated, a user doesn’t need access to WP dashboard. He can change his profile credentials from front-end.
    Easiest way would be to use this plugin.

    Retrieving them the possibility to change their email is anyway not a good idea. What happen when a user changed from yahoo to gmail, but can’t login because he lost his password ? Where will the new pwd be sent ?

    Perhaps you have also to remove this from the BP usermenu on toolbar ?
    Here’s how you can do it:

    function admin_bar_remove_this(){
    global $wp_admin_bar;
    	$wp_admin_bar->remove_node('my-account-messages-compose');
    }
    add_action('wp_before_admin_bar_render','admin_bar_remove_this');
Viewing 25 results - 301 through 325 (of 772 total)
Skip to toolbar