Search Results for 'notification user id'
-
Search Results
-
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,
) );
}}
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!
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 thator can you refer any complete guide to create a custom notification upon some action
Hello,
I have a really weird issue with Buddypresss, I can create notifications but they’re not received by the user… Every components are enabled btw.
If I do :
bp_notifications_add_notification( array( 'user_id' => get_current_user_id(), 'item_id' => 630, 'secondary_item_id' => 1080, 'component_name' => 'my_app', 'component_action' => 'my_app_action', 'date_notified' => bp_core_current_time(), 'is_new' => 1, ) );Where 630 and 1080 are valid WordPress posts and my_app component has been registered sooner.
If I check my database, that’ll create a new entry as expected and I do :
bp_notifications_get_notification(306)(306 is my new notification’s id) It does return the notification object.
However, if I do :
bp_notifications_get_notifications_for_user(3)(3 is the current_user_id())
Then it returns false and bp_notifications_get_all_notifications_for_user() an empty array.
What am I missing ?
Thanks for the help, please let me know if you need more details.
Cheers,
François
Topic: Confirmation Email
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 CUSTOMfunction 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.
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.
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.Topic: Notification avatars
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' ) ); }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. } ?>