Search Results for 'notification user id'
-
Search Results
-
Hi. I have chosen to disable the Notifications component in hopes that users would not receive notification emails. This means, however, that there is no page where users can change their notification settings. When editing the activation and reset password emails, as well as the email sent when group details have been changed, I noticed that there is an Unsubscribe link still showing. Can you please let me know how I am able to prevent the link from showing or customize it to saying Home Page and redirecting those who click it to my home page? I appreciate any feedback which you can provide me. Have a great day.
Trying to modify a block plugin for my website.
All is going well, but the “block” can be bypassed if the blocked user simply @-mentions the blocker-user. The blocker-user will then receive a notification/email from the “blocked” user.
So I’m trying to catch the notification/email prior to anything being sent. Then I’d compare user IDs and cancel it.
What function(s) should I be looking at?
I found this in bp-activity-notifcations.php but unsure if this is what I’m looking for, unless it is? Is this early enough to prevent the email too?
/** * Notify a member when their nicename is mentioned in an activity stream item. * * Hooked to the 'bp_activity_sent_mention_email' action, we piggy back off the * existing email code for now, since it does the heavy lifting for us. In the * future when we separate emails from Notifications, this will need its own * 'bp_activity_at_name_send_emails' equivalent helper function. * * @since 1.9.0 * * @param object $activity Activity object. * @param string $subject (not used) Notification subject. * @param string $message (not used) Notification message. * @param string $content (not used) Notification content. * @param int $receiver_user_id ID of user receiving notification. */ function bp_activity_at_mention_add_notification( $activity, $subject, $message, $content, $receiver_user_id ) { bp_notifications_add_notification( array( 'user_id' => $receiver_user_id, 'item_id' => $activity->id, 'secondary_item_id' => $activity->user_id, 'component_name' => buddypress()->activity->id, 'component_action' => 'new_at_mention', 'date_notified' => bp_core_current_time(), 'is_new' => 1, ) ); } add_action( 'bp_activity_sent_mention_email', 'bp_activity_at_mention_add_notification', 10, 5 );Topic: Add notification
Hello! How I can add a notifications like in admin bar to my site menu. (I don’t use buddypress user widget and users don’t have access to the admin panel. My site menu use like user admin panel).
I need some custom notifications in my website. I have my code bellow, all work correctly, notification is added into database and displayed at the recipient, but without notification text

How i can fix this?
Thank youfunction 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' ); function custom_format_buddypress_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) { // New custom notifications if ( 'custom_action' === $action ) { $custom_title = "You have new notification"; $custom_link = "domain.com"; $custom_text = "You have new notification"; // WordPress Toolbar if ( 'string' === $format ) { $return = apply_filters( 'custom_filter', '<a href="' . esc_url( $custom_link ) . '" title="' . esc_attr( $custom_title ) . '">' . esc_html( $custom_text ) . '</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', 'custom_format_buddypress_notifications', 10, 5 ); function bp_custom_add_notification( $receiver_user_id, $initiator ) { //$post = get_post( $comment_object->comment_post_ID ); //$author_id = $post->post_author; bp_notifications_add_notification( array( 'user_id' => $receiver_user_id, 'item_id' => $initiator, 'secondary_item_id' => $initiator, 'component_name' => 'custom', 'component_action' => 'custom_action', 'date_notified' => bp_core_current_time(), 'is_new' => 1, ) ); } add_action( 'wp_insert_custom_notification', 'bp_custom_add_notification', 99, 2 );Topic: New Topic Notification
Hi,
I have created a custom notification for my site when a post is published, the code used to do this is :-
// this is to add a fake component to BuddyPress. A registered component is needed to add notifications 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, 'publishpost' ); // Return component's with 'custom' appended return $component_names; } add_filter( 'bp_notifications_get_registered_components', 'custom_filter_notifications_get_registered_components' ); // this hooks to post creation and saves the post id function bp_custom_add_notification( $post_id, $post ) { $post = get_post( $post_id ); $author_id = $post->post_author; $blogusers = get_users( array( 'role' => 'staff' ) ); // Array of WP_User objects. foreach ( $blogusers as $user ) { bp_notifications_add_notification( array( 'user_id' => $user->id, 'item_id' => $post_id, 'component_name' => 'publishpost', 'component_action' => 'publishpost_action', 'date_notified' => bp_core_current_time(), 'is_new' => 1, ) ); } } add_action( 'publish_post', 'bp_custom_add_notification', 99, 2 ); /** * Format the BuddyBar/Toolbar notifications * * @since bbPress (r5155) * * @package bbPress * * @param string $action The kind of notification being rendered * @param int $item_id The primary item id * @param int $secondary_item_id The secondary item id * @param int $total_items The total number of messaging-related notifications waiting for the user * @param string $format 'string' for BuddyBar-compatible notifications; 'array' for WP Toolbar */ function custom_format_buddypress_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) { // New custom notifications if ( 'publishpost_action' === $action ) { $post = get_post( $item_id ); $author_name = get_the_author_meta('display_name', $post->post_author); $custom_title = bp_core_get_user_displayname( $post->post_author ) . ' published a new post "' . get_the_title( $item_id ) . '"'; $custom_link = get_permalink( $post ); $custom_text = bp_core_get_user_displayname( $post->post_author ) . ' published a new post "' . get_the_title( $item_id ) . '"'; // WordPress Toolbar if ( 'string' === $format ) { $return = apply_filters( 'publishpost_filter', '<a href="' . esc_url( $custom_link ) . '" title="' . esc_attr( $custom_title ) . '">' . esc_html( $custom_text ) . '</a>', $custom_text, $custom_link ); // Deprecated BuddyBar } else { $return = apply_filters( 'publishpost_filter', array( 'text' => $custom_text, 'link' => $custom_link ), $custom_link, (int) $total_items, $custom_text, $custom_title ); } return $return; } if ( 'bbp_new_reply' === $action ) { $topic_id = bbp_get_reply_topic_id( $item_id ); $topic_title = bbp_get_topic_title( $topic_id ); $topic_link = wp_nonce_url( add_query_arg( array( 'action' => 'bbp_mark_read', 'topic_id' => $topic_id ), bbp_get_reply_url( $item_id ) ), 'bbp_mark_topic_' . $topic_id ); $title_attr = __( 'Topic Replies', 'bbpress' ); if ( (int) $total_items > 1 ) { $text = sprintf( __( 'You have %d new replies', 'bbpress' ), (int) $total_items ); $filter = 'bbp_multiple_new_subscription_notification'; } else { if ( !empty( $secondary_item_id ) ) { $text = sprintf( __( 'You have %d new reply to %2$s from %3$s', 'bbpress' ), (int) $total_items, $topic_title, bp_core_get_user_displayname( $secondary_item_id ) ); } else { $text = sprintf( __( 'You have %d new reply to %s', 'bbpress' ), (int) $total_items, $topic_title ); } $filter = 'bbp_single_new_subscription_notification'; } // WordPress Toolbar if ( 'string' === $format ) { $return = apply_filters( $filter, '<a href="' . esc_url( $topic_link ) . '" title="' . esc_attr( $title_attr ) . '">' . esc_html( $text ) . '</a>', (int) $total_items, $text, $topic_link ); // Deprecated BuddyBar } else { $return = apply_filters( $filter, array( 'text' => $text, 'link' => $topic_link ), $topic_link, (int) $total_items, $text, $topic_title ); } do_action( 'bbp_format_buddypress_notifications', $action, $item_id, $secondary_item_id, $total_items ); return $return; } } add_filter( 'bp_notifications_get_notifications_for_user', 'custom_format_buddypress_notifications', 1, 5 );How can i create the same for a new bbpress topic? i’m thinking i need to change this code section but not sure how
// this hooks to post creation and saves the post id function bp_custom_add_notification( $post_id, $post ) { $post = get_post( $post_id ); $author_id = $post->post_author; $blogusers = get_users( array( 'role' => 'staff' ) ); // Array of WP_User objects. foreach ( $blogusers as $user ) { bp_notifications_add_notification( array( 'user_id' => $user->id, 'item_id' => $post_id, 'component_name' => 'publishpost', 'component_action' => 'publishpost_action', 'date_notified' => bp_core_current_time(), 'is_new' => 1, ) ); } } add_action( 'publish_post', 'bp_custom_add_notification', 99, 2 );I am using woffice as the theme, bbpress version 2.5.14, buddypress version 4.1.0 and the latest version of wordpress
Thanks
Hi there,
I was trouble shooting already hosted live website which is already setup buddy press wall.
BuddyPress – Version 4.1.0
BuddyBoss Wall – Version 1.3.2
BuddyBoss Media – Version 3.2.2
BuddyPress Activity Filter – Version 2.0.0
Wordpress – Version 4.9.6And user can post on there friend profile and see the posted on user wall. But when mentioned user wall doesn’t display it. Any idea what will causing this issue.
But the wall post will notify and notification will be redirect site-wide-activity page display posts on that page, not on their wall.
Hi
I’m using BuddyPress and upon registration of users, the email notifications are sent using the hosting server which lands 100% of the times at spam folder.
to solve this I’ve installed the WP Mail SMTP plugin but this it didn’t affect BuddyPress Smtp settings.
Please someone with a solution to solve this.
ThanksI am branching pages in this code:
// BuddyPress $arr = explode( '/', $_SERVER['REQUEST_URI'] ); if ( isset($arr[1]) && $arr[1] === 'members' ) : // Pages that only the himself can access if( $arr[3] === 'messages' || $arr[3] === 'settings' || $arr[3] === 'notifications' ) : get_template_part( 'template-parts/page', 'bp-only' ); // Pages that other users can access else : get_template_part( 'template-parts/page', 'bp-public' ); endif; endif;However, on the above code,
$wp_querydoes not work in “page-bp-public.php”.
For example, I use$wp_queryas below to output topic list, but topic title is not output.function my_pre_get_posts( $query ) { $query->set('post_type', 'topic'); } add_action('pre_get_posts','my_pre_get_posts');<?php global $wp_query; ?> <?php if ($wp_query->have_posts()): ?> <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?> <?php echo get_the_title(); ?> <?php endwhile; ?> <?php else: ?> <p>nothing</p> <?php endif; ?>How can I use
$wp_queryon “page-bp-public.php”?・・・
By the way, I
var_dumpto$wp_queryand it will be as follows:<pre><?php var_dump($wp_query->query_vars);?></pre><pre>array(65) { ["page"]=> int(0) ["pagename"]=> string(6) "forums" ["error"]=> string(0) "" ["m"]=> string(0) "" ["p"]=> int(0) ["post_parent"]=> string(0) "" ["subpost"]=> string(0) "" ["subpost_id"]=> string(0) "" ["attachment"]=> string(0) "" ["attachment_id"]=> int(0) ["name"]=> string(6) "forums" ["static"]=> string(0) "" ["page_id"]=> int(0) ["second"]=> string(0) "" ["minute"]=> string(0) "" ["hour"]=> string(0) "" ["day"]=> int(0) ["monthnum"]=> int(0) ["year"]=> int(0) ["w"]=> int(0) ["category_name"]=> string(0) "" ["tag"]=> string(0) "" ["cat"]=> string(0) "" ["tag_id"]=> string(0) "" ["author"]=> string(0) "" ["author_name"]=> string(0) "" ["feed"]=> string(0) "" ["tb"]=> string(0) "" ["paged"]=> int(0) ["meta_key"]=> string(0) "" ["meta_value"]=> string(0) "" ["preview"]=> string(0) "" ["s"]=> string(0) "" ["sentence"]=> string(0) "" ["title"]=> string(0) "" ["fields"]=> string(0) "" ["menu_order"]=> string(0) "" ["embed"]=> string(0) "" ["category__in"]=> array(0) { } ["category__not_in"]=> array(0) { } ["category__and"]=> array(0) { } ["post__in"]=> array(0) { } ["post__not_in"]=> array(0) { } ["post_name__in"]=> array(0) { } ["tag__in"]=> array(0) { } ["tag__not_in"]=> array(0) { } ["tag__and"]=> array(0) { } ["tag_slug__in"]=> array(0) { } ["tag_slug__and"]=> array(0) { } ["post_parent__in"]=> array(0) { } ["post_parent__not_in"]=> array(0) { } ["author__in"]=> array(0) { } ["author__not_in"]=> array(0) { } ["ignore_sticky_posts"]=> bool(false) ["suppress_filters"]=> bool(false) ["cache_results"]=> bool(true) ["update_post_term_cache"]=> bool(true) ["lazy_load_term_meta"]=> bool(true) ["update_post_meta_cache"]=> bool(true) ["post_type"]=> string(0) "" ["posts_per_page"]=> int(1) ["nopaging"]=> bool(false) ["comments_per_page"]=> string(2) "50" ["no_found_rows"]=> bool(false) ["order"]=> string(4) "DESC" } </pre>Users names do not appear when letters are typed after @
The mention “works” notification wise but the autosuggest (I guess this is what it’s called) doesn’t.
Looking in Chrome Console I have an error:
Uncaught SyntaxError: Invalid or unexpected token mentions.min.js?ver=4.1.0:13
/wp-content/plugins/buddypress/bp-activity/js/mentions.min.js?ver=4.1.0
The error icon is shown at the end of line 13:
11 var i={
12 delay:200,hideWithoutSuffix:!0,insertTpl:”@${
13 ID
14 }The console also says that (no error icon there though):
JQMIGRATE: Migrate is installed, version 1.4.1 jquery-migrate.min.js?ver=1.4.1:2
/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1
Topic: How to branch pages
Is there a function to branch pages?
Currently I am supplementing that function with the following code.
$arr = explode( '/', $_SERVER['REQUEST_URI'] ); if ( isset($arr[1]) && $arr[1] === 'members' ) : if( is_user_logged_in() ) : if( bp_loggedin_user_id() == bp_displayed_user_id() ) : if( ( $arr[3] === '' || $arr[3] === 'activity' || $arr[3] === 'profile' || $arr[3] === 'following' || $arr[3] === 'followers' ) && $arr[4] != 'following' && isset($arr[3]) ) : echo 'hello'; elseif( $arr[3] === 'forums' ) : echo 'hello'; elseif( $arr[3] === 'bp-messages' || $arr[3] === 'settings' || $arr[3] === 'notifications' || $arr[3] === 'following' ) : echo 'hello'; endif; else: if( ( $arr[3] === '' || $arr[3] === 'activity' || $arr[3] === 'profile' || $arr[3] === 'following' || $arr[3] === 'followers' ) && isset($arr[3]) ) : echo 'hello'; elseif( $arr[3] === 'forums' && isset($arr[3]) ) : echo 'hello'; endif; endif; else: echo 'guest'; endif; endif;But It’s not cool..
Please inform me if you have a better method to solve the problem than the one previously mentioned.Topic: Customizing notifications
I have real estate theme. I want web hook notifications such that when a user applies for a property on my site, notification with property details and applicant details should be sent to the owner of that property. Is it possible with buddypress notifications? And If yes, please guide me through the steps.