Search Results for 'notification user id'
-
Search Results
-
I posted up on this a little while ago, and danbp was a boss and helped me out, and I thought I could get it to work, but the end fix ended up unfortunately not really fixing the problem.
I’m having difficulty with a profile tab that is supposed to link to a separate forums profile (wpForo) via a dynamic link that recognizes the displayed user’s page. danbp set me up with something like the below, I changed a bit to make it work better…
function tab_custom_link_to_page() { if ( bp_is_page( 'BP_MEMBERS' ) || bp_is_activity_component() || bp_is_profile_component () || bp_is_groups_component () || bp_is_notifications_component () || bp_is_messages_component () || bp_is_settings_component () || bp_is_following_component () || bp_is_followers_component () ) { $link = bp_get_root_domain() . '/community/profile/'. bp_get_displayed_user_username(); echo '<li><a href="'. $link .'">Community</a></li>'; } } add_action( 'bp_member_options_nav', 'tab_custom_link_to_page', 10 );
but I couldnt change the location of the tab, using code or BuddyBoss Reorder Tabs plugin, which is an issue because the theme I’m using (BuddyBoss Boss.) hides the tabs at the end under a clickable “…”. I spoke to someone at BuddyBoss and they told me I wouldn’t be able to move the tab unless it was registered as a “bp_core_new_nav_item( array(“, which requires an array like:
function add_communityprofile_tab() { global $bp; bp_core_new_nav_item( array( 'name' => 'Community', 'slug' => 'community', 'parent_url' => $bp->displayed_user->domain, 'parent_slug' => $bp->profile->slug, 'position' => 200, 'default_subnav_slug' => 'community' ) ); } add_action( 'bp_setup_nav', 'add_communityprofile_tab', 100 );
which works fine until I have to link it, apparently I can’t use the tab array/slug thing to reach a dynamic link without the same “$bp->displayed_user->domain”. The link I’m trying to reach is currently at:
http://localhost/wordpress/community/profile/*displayeduser*/
from:
http://localhost/wordpress/users/*displayeduser*/
If nobody has any helpful suggestions otherwise, I’m thinking the best route might be to have the page
http://localhost/wordpress/users/*displayeduser*/community/
redirect to
http://localhost/wordpress/community/profile/*displayeduser*/
via a dynamic redirect…I’m trying to figure out how to do that.
If anyone has any helpful advice it would be super appreciated. My boss wants me to take the site live this week and I think I’m just about there…aside from this huge disconnect between the two separate user profiles…not too bad for someone who has barely any idea what they’re doing. but yeah, sorry for the super long post. thanks for reading and hopefully you can throw me a line.
– Andrew
I am going to create a new custom notification for a user that if someone mention the user in any review with @, the related user will get a email and a new notification has been generated, this notification I created dynamically, but I get empty message showing on user profile notification area, I checked the db_table for notification as well it has proper entries as well,
$description = apply_filters_ref_array( 'bp_notifications_get_notifications_for_user', array( $notification->component_action, $notification->item_id, $notification->secondary_item_id, 1, 'string', $notification->component_action, $notification->component_name, $notification->id ) );
In the above line I found that ‘bp_notifications_get_notifications_for_user’ filter return me the empty description of my notification from line no 523 in function “bp_get_the_notification_description” of file buddypress/bp-notifications/bp-notifications-template.php
Below is my custom code for generate notification:
//add new notification mention_in_comment function mention_in_comment_filter_notifications_publish_post_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, 'mention_in_comment' ); // Return component's with 'custom' appended return $component_names; } add_filter( 'bp_notifications_get_registered_components', 'mention_in_comment_filter_notifications_publish_post_get_registered_components' ); //show new notification text function bp_mention_in_comment_format_buddypress_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) { // New custom notifications if ( 'mention_in_comment_action' === $action ) { $comment_info = get_comment( $item_id ); $author_name = ($comment_info->user_id) ? get_the_author_meta( 'display_name', $comment_info->user_id ) : $comment_info->comment_author; $custom_title = $author_name. ' mentioned you in a new comment on '.get_the_title($comment_info->comment_post_ID); $custom_link = get_comment_link( $comment_info->comment_ID ); $custom_text = $author_name. ' mentioned you in a new comment: <br/>' . $comment_info->comment_content; // WordPress Toolbar if ( 'string' === $format ) { $return = apply_filters( 'mention_in_comment_filter', '' . esc_html( $custom_text ) . '', $custom_text, $custom_link ); // Deprecated BuddyBar } else { $return = apply_filters( 'mention_in_comment_filter', array( 'text' => $custom_text, 'link' => $custom_link ), $custom_link, (int) $total_items, $custom_text, $custom_title ); } //var_dump($return); return "Just say hello."; } } add_filter( 'bp_notifications_get_notifications_for_user', 'bp_mention_in_comment_format_buddypress_notifications', 1, 5 ); //add notification to the mentioned user $notification = bp_notifications_add_notification( array( 'user_id' => $user_id, 'item_id' => $comment->comment_ID, 'secondary_item_id' => $user_id, 'component_name' => 'mention_in_comment', 'component_action' => 'mention_in_comment_action', 'date_notified' => bp_core_current_time(), 'is_new' => 1) );
Could you please let me knwo what is wrong with my code or something else, how can more debug and solve this.
Sorry for the double-post. I can’t close the other…and he’s not rightful.
I actually have this code to display the notifications on header and it works.I just want to know how i can get a “count” condition for the notifications, and if it’s more than 1, that’s change the class “pending-count” to “pending-count-alert”…
Thanks by advance
function my_nav_menu_notif_counter($menu) { if (!is_user_logged_in()) return $menu; else $notif = '<li ><a class="ab-item" href="' . bp_core_get_user_domain(bp_loggedin_user_id() ) . 'notifications/">'. __('').'<span id="ab-pending-notifications" class="pending-count">'. __(''). bp_notifications_get_unread_notification_count( bp_loggedin_user_id() ) .'</span> </a></li>'; $count = !empty( $notif ) ? count( $notif ) : 0; $menu = $menu . $notif; return $menu; } add_filter( 'wp_nav_menu_items', 'my_nav_menu_notif_counter' ); add_filter( 'show_admin_bar', '__return_false' ); ?>
Hi Everyone !
One year ago, i try to put the notifications of the Buddypress bar into my header.
And, thanks to the members of this forum, it works succesfully.
I have now a new item on my menu, and it’s a count of the notifications.But i want to see immediatly when there is a new notification !
I would like to change the color of the notification bubble only when there is a new (ou more) notification !
Can you help me ? :/There is my actual php code, on the bp-custom.php
function my_nav_menu_notif_counter($menu) { if (!is_user_logged_in()) return $menu; else $notif = '<li ><a class="ab-item" href="' . bp_core_get_user_domain(bp_loggedin_user_id() ) . 'notifications/">'. __('').'<span id="ab-pending-notifications" class="pending-count alert">'. __(''). bp_notifications_get_unread_notification_count( bp_loggedin_user_id() ) .'</span> </a></li>'; $menu = $menu . $notif; return $menu; } add_filter( 'wp_nav_menu_items', 'my_nav_menu_notif_counter' ); add_filter( 'show_admin_bar', '__return_false' );
Sorry if my english is bad, i’m french
I have bad knowledges in Php, but i can try to understand the codeWP 4.4.5
BP 2.6.2Hi all
Im very new to this WordPress and right now I need help with BuddyPress, since I cannot find anything comprehensible on the net.
I am creating a dating website and what I want to do is:
1. On the homepage, have a registration form for non users AND a log in section for members.
See example like Facebook.com. It is important that there is space for images next to the registration form.2. New users can look around the site, but they cannot make contact with other members until they have validated their email account. Is it possible to show a notification/reminder on every page they visit?
Im grateful for any help ( but please have patience with me, Im not used to computers! )
BR, PositivaMussar
I am sending to notification to multiple users with following code
bp_notifications_add_notification( array( 'user_id' => 3,1, 'item_id' =>$postid, 'component_name' => 'Event2', 'component_action' => 'custom_action', 'date_notified' => bp_core_current_time(), 'is_new' => 1, ) );
but notification is only send to first user id 3. How I will send the notification to multiple user id. Please help
I installed https://wordpress.org/plugins/postman-smtp/ on my WP (v 4.6) + BuddyPress (v 2.6.2) site, then configured it to use my Gmail account’s SMTP server settings.
The emails sent by the site uses the SMTP settings when:
– A member registers and PMPRo (https://tl.wordpress.org/plugins/paid-memberships-pro/) sends out an email confirmation
– Emails sent using the plugin (https://wordpress.org/plugins/email-users/)(I can see these sent emails in the “Sent” folder of my Gmail account.)
However, when BuddyPress sends out an email (e.g. email notification for friend request, etc.), it seems to ignore the SMTP server settings I have configured. Instead, it uses the server’s default.
How do I make BuddyPress email notifications send using my Gmail SMTP server settings?
I was able to create my custom email notification. I would like to add an option in the settings so that user can enable/disable this email notification. Has anyone successfully implemented like this before? Any ideas on how to do this?
My theme does not support notification alert so i used this code to show the notification count:
<?php echo bp_notifications_get_unread_notification_count(bp_loggedin_user_id()); ?>But it is not clickable, can someone please help me with the link that i can paste inside the
a href = ” ” <?php echo bp_notifications_get_unread_notification_count(bp_loggedin_user_id()); ?> /aso that it can redirect them to their notification page slug ?
currently it http://www.example.comh/members/rvnamb/notifications/
how can i replace rvnamb with the currently logged in user id ? i searched a lot but could not find a solution
Hi guys, I created a custom notification that is added when an user receive a like on a custom post type.
All good unitl now, but I noticed that if the post receive 2 likes, from 2 different users, the user receive only the first notification and not the second one.
Any help would be really appreciated.
//Component declaration if(!function_exists('my_custom_register_wiki_notification')) { function my_custom_register_wiki_notification() { // Register component manually into buddypress() singleton buddypress()->my_custom_wiki = new stdClass; // Add notification callback function buddypress()->my_custom_wiki->notification_callback = 'my_custom_wiki_like_format_notifications'; // Now register components into active components array buddypress()->active_components['my_custom_wiki'] = 1; } }; //Notification format declaration if(!function_exists('my_custom_wiki_like_format_notifications')) { function my_custom_wiki_like_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) { // New custom notifications if ( 'my_custom_wiki_like' === $action ) { $wiki_post = get_post( $item_id ); $post_title = get_the_title( $item_id ); $custom_title = sprintf( esc_html__( 'Your post "%1$s" received a like', 'my_custom' ), $post_title ); $custom_text = sprintf( esc_html__( 'Your post "%1$s" received a like', 'my_custom' ), $post_title ); $custom_link = get_permalink( $item_id ); // WordPress Toolbar if ( 'string' === $format ) { $return = apply_filters( 'my_custom_wiki_like_format', '<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( 'my_custom_wiki_like_format', array( 'text' => $custom_text, 'link' => $custom_link ), $custom_link, (int) $total_items, $custom_text, $custom_title ); } return $return; } return $action; } } //Function that add the notification when like is triggered function my_custom_add_like() { //... //... if(my_custom_is_wiki_like_notification_enabled()) { bp_notifications_add_notification( array( 'user_id' => $post_object->post_author, 'item_id' => $post_id, 'secondary_item_id' => get_current_user_id(), 'component_name' => 'my_custom_wiki', 'component_action' => 'my_custom_wiki_like', 'date_notified' => bp_core_current_time(), 'is_new' => 1, ) ); } }
Hi,
I’m working on a wordpress website, and using Buddypress. I wanted to add posts notifications and it worked fine, except when I tried to filter them. First you need to know how I want to filter them.
– I’ve a profile field named ‘Field’ which is a dropdown list with 5 options.
– I have also 5 post categories with the exact names of the ‘Field’ values.
– When a post is added, If it has (e.g. A,B,C) categories I want a notification for every user who has his ‘Field’ value is equal to A,B or C.Here is my code:
foreach (users as $user) {
$acc_type = xprofile_get_field_data(‘Field’, $user->ID);
if (in_category($acc_type,$post_id)) {
bp_notifications_add_notification( array(
‘user_id’ => $user->ID,
‘item_id’ => $post_id,
‘component_name’ => ‘custom’,
‘component_action’ => ‘custom_action’,
‘date_notified’ => bp_core_current_time(),
‘is_new’ => 1,
) );
}}
I created many custom notifications on my theme, such as notification on post comments, but after a post is commented and the notification is sent, the listing of posts and of other custom post types display a 404 page.
This happens only on the listing page of posts, not on the single post pages.
I really hope in an help.
This is my code: