Search Results for 'notification user id'
-
AuthorSearch Results
-
March 26, 2015 at 6:21 am #236646
In reply to: No Notifications For Mentions In Comments
briggsy326Participant@xander206 Thanks for the response. 🙂
I had a quick look at the link your provided and I’m not really sure it’s quite what I am looking for.
At present there is already a ‘notifications’ area on the profile page (and on the ‘admin’ bar at the top of the page) and notifications for @ mentions on the profile itself are working and also notifications for friend requests are working too.
The only thing that isn’t working is notifications for @ mentions on comments on posts. Whenever someone replies to a comment on a post and starts it with @ username it is being linked to their profile but it is not sending a notification to that person that they have been mentioned.
Cheers
March 24, 2015 at 4:13 am #236475In reply to: how to add new members to groups automatically?
5highParticipantHi @mrjarbenne,
Thanks so much for helping – I’ve only just found your reply (don’t know what happened to the email notification this time). Anyway, I’ve added it into my bp-custom.php as suggested and Bingo! it works brilliantly. just tried a new test member and I’m instant joined to all 3 of my groups!
Thanks so much for this. Just for clarity for others this is the code i used as per @modemlooper info above:
function automatic_group_membership( $user_id ) { if( !$user_id ) return false; groups_accept_invite( $user_id, $group_id ); } add_action( 'bp_core_activated_user', 'automatic_group_membership' );
I have left the spacing exactly as he’d done, just in case… but maybe I could get rid of some of the extra spaces in it?
Cheers 🙂
March 20, 2015 at 5:58 pm #236290aljo1985ParticipantOkay so I realised that it would only send the activity to stream when you have the email option checked. I also noticed that upon doing that you post 2 pieces of information into the database that are exactly the same.. Well they are not structured the same but the information holds the same data.
This is inside bp_groups_groupmeta and bp_activity
So I have optimized my code to remove duplicate data, well just removed it from posting into groupsmeta really, as it doesn’t need to be in there… Maybe you can optimize your code to post the action in activity only and read from there, rather than have it posted in both. The system is great, don’t get me wrong I am just making suggestions.So I have removed one of your functions on remove action and copied it into my own function with edits to that function. I have added 2 extra fields, drop down boxs to be exact.
Here is my code with a lot of comments as I was trying out many different things, then decided I don’t want it to do that lol. EDIT
<?php // Add custom group fields. // Removed the default add activity stream. file /public_html/wp-content/plugins/buddypress/bp-groups/bp-groups-activity.php for reference. remove_action( 'groups_details_updated', 'bp_groups_group_details_updated_add_activity' ); // On group update. add_action( 'groups_details_updated', 'group_details_update', 10, 3 ); // Updated group details. // Updated group details. function group_details_update( $group_id, $old_group, $notify_members ) { global $bp, $wpdb; // Custom fields. $plain_fields = array( 'server', 'country' //'activity' ); foreach( $plain_fields as $field ) { $key = 'group-' . $field; $metakey = 'h1z1_' . $field; if ( isset( $_POST[$key] ) ) { $value = $_POST[$key]; // Do they want the update notification posted on their activity stream? /*if ($value == '1') $post_activity = true; */ //Make sure they selected an item from the required dropdown boxs. if ($value == 'null') return bp_core_add_message( __( 'There was an error updating group details. Please try again.', 'buddypress' ), 'error' ); else { // changed1 is empty by default, not declared. If empty, get groupmeta. if (empty($changed)) $changed = groups_get_groupmeta( $group_id, $metakey ); //if groupmeta(old value) == posted value changed is empty again, so we can check the next custom field to see if that also has the same old value. if ($changed == $value) $changed = ''; else groups_update_groupmeta( $group_id, $metakey, $value ); } } } // Optional removed checkbox for now.. Might use later /*if ($post_activity == false) return false; */ // Taken from /public_html/wp-content/plugins/buddypress/bp-groups/bp-groups-activity.php // We removed the email notification check so that it will post an activity stream regardless. // Bail if Activity is not active. if ( ! bp_is_active( 'activity' ) ) return false; if ( ! isset( $old_group->name ) || ! isset( $old_group->description ) ) return false; // If the admin has opted not to notify members, don't post an activity item either // Removed, I want updated posted if it sends and email or not. /*if ( empty( $notify_members ) ) { return; }*/ $group = groups_get_group( array( 'group_id' => $group_id, ) ); /* * Store the changed data, which will be used to generate the activity * action. Since we haven't yet created the activity item, we store the * old group data in groupmeta, keyed by the timestamp that we'll put * on the activity item. */ if ( $group->name !== $old_group->name || $group->description !== $old_group->description ) $changed = 'changed'; // If there are no changes, don't post an activity item. if ( empty( $changed ) ) return; $time = bp_core_current_time(); // Don't want a long description of what has been changed inside the details. Also reduces information posted in groupmeta table. //groups_update_groupmeta( $group_id, 'updated_details_' . $time, $changed ); // And finally, update groups last activity.. Currently doesn't in standard. groups_update_groupmeta( $group_id, 'last_activity', $time ); // Since we have removed the information from meta, we will record it directly into action on activity.. // You do not need the same information recorded twice in the database. This needs optimizing. Hence removing update groupmeta.. /* $user_link = bp_core_get_userlink( bp_loggedin_user_id() ); $group_link = '<a href="' . esc_url( bp_get_group_permalink( $group ) ) . '">' . esc_html( $group->name ) . '</a>'; $action = sprintf( __( '%1$s changed the description of the group %2$s from "%3$s" to "%4$s"', 'buddypress' ), $user_link, $group_link, esc_html( $changed['description']['old'] ), esc_html( $changed['description']['new'] ) ); */ // Record in activity streams. return groups_record_activity( array( 'type' => 'group_details_updated', 'item_id' => $group_id, 'user_id' => bp_loggedin_user_id(), 'recorded_time' => $time, ) ); }
If there is bugs in any code, I will find them and fix them.. That’s one of the downsides to being a perfectionist..
I have not fixed the
A few bugs I have found.
From the first post yet, but will be doing after I have had my dinner 🙂
My idea is to have a notification saying that the user has left the group when they leave/kicked/banned/ obviously if its after the 5 minutes mark lol.March 3, 2015 at 12:42 pm #235412In reply to: Email to admin when new user register
Henry WrightModeratorHi @sofijagb
That particular email’s message isn’t filterable but the function which sends the email is pluggable, which means you can write your own function. For more info on pluggable function in WordPress, check out:
https://codex.wordpress.org/Pluggable_Functions
The function you’ll need to override is
wp_new_user_notification()
Hope this info helps!
February 17, 2015 at 1:31 pm #234608In reply to: Can't Accept Friend Requests
tammywashingtonParticipantSorry about the lack of information. See the updated information:
We are currently hosting on Amazon’s cloud running Amazon Web Services. Our PhP version is 5.4.31. Using the latest version of the Sweet Date theme. We have four major plugins installed. BuddyPress 2.2.0., bbPress 2.5.4, s2Member Framework Version 150203 + s2Member Pro v150203 and Event Espresso 4.6.6.p. The other plugin do not control permissions,groups our user classifications.
We are not sure exactly when this problem occurred because we were not using the friend request feature. However we did test this successfully in the past but are not sure of the plugin versions.
The changes we recently made were the following:
We had Buddy Press, s2Member and Event Espresso installed with the latest versions. We then installed latest version of bbPress. We created users groups and assigned the appropriate permission of user to subscribe and receive invites to join the group. We learned that members can not join a group unless they are friends with an individual already in a particular group.When we send a friend request to a user that person receives the request. They are able to see the notification in their profile under Friends-Pending Request. At this point everything looks good. The user can see the requester image and can the ability to clink Accept Button or Reject Button. When either of the buttons are clicked nothing happens. We waited for exactly 2 minutes and just refreshed the page. We get the same actions if the Reject Button is selected also. Any advice or help is greatly appreciated.
February 3, 2015 at 9:15 pm #233516In reply to: in profile hide notifications and settings
fanmusicParticipantHi,
Actually no, thats not it, there is no option for that in buddypress, I need to hide the buttons notifications and settings (that are along with profile, messages groupes etc.)
it’s in the front office.thanks a lot
PS : someone posted this, I think it’s on the right track but it doesn’t work :/
[ edited – please use ‘code’ button when posting code ]
Try this in bp-custom.phpfunction fanmusic_remove_profile_nav_remove( $nav ) { $nav = ''; return $nav; } add_filter('bp_get_displayed_user_nav_notifications', 'fanmusic_remove_profile_nav_remove', 10, 1 ); add_filter('bp_get_displayed_user_nav_settings', 'fanmusic_remove_profile_nav_remove', 10, 1 );
February 2, 2015 at 9:51 am #233408In reply to: Notification
Brajesh SinghParticipantHi Christian,
There is one functionality in BuddyPress that allows it. You can see the feature as site wide notice(Mark a message as notice).The problem is currently, only a user with the capability ‘bp_moderate’ can send the notice. Do you want to allow this notification feature for all users or just selected few?
February 1, 2015 at 3:58 pm #233356In reply to: [Resolved] How To Get Notification Count? (Code)?
Brajesh SinghParticipantHi Chaitanya,
Try this code.function bpfr_add_notification_to_page_title( $title, $original_title, $sep ) { //do not change if the user is not logged in if( ! is_user_logged_in() ) return $title; $user_id = get_current_user_id();//logged in user's id $count = bp_notifications_get_unread_notification_count( $user_id ); if( $count > 0 ) $title = sprintf( "You Have %d New Notification(s) - ", $count ); return $title; } add_filter( 'wp_title', 'bpfr_add_notification_to_page_title', 100, 3 );
I have modified the code from your last post. The difference is, It only does it for logged in users. Also, I have decreased the priority to make it work on BuddyPress pages( otherwide bp_modify_title would have overwritten it).
Hope that helps.
February 1, 2015 at 2:58 pm #233352In reply to: [Resolved] How To Get Notification Count? (Code)?
chatty24Participant@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
February 1, 2015 at 2:07 pm #233349In reply to: [Resolved] How To Get Notification Count? (Code)?
danbpParticipantTry 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 );
February 1, 2015 at 12:32 pm #233345In reply to: [Resolved] How To Get Notification Count? (Code)?
chatty24ParticipantI tried using the below code but it is returning the value to zero too 🙁
echo bp_notifications_get_unread_notification_count( bp_loggedin_user_id() );
February 1, 2015 at 12:13 pm #233344In reply to: [Resolved] How To Get Notification Count? (Code)?
Henry WrightModerator…how do I get it?
That depends. For example:
If you want the currently logged-in user:
$user_id = bp_loggedin_user_id();
If the context is a member’s profile page and you want the displayed member:
$user_id = bp_displayed_user_id();
So, depending on the above, what you need may be either:
bp_notifications_get_unread_notification_count( bp_loggedin_user_id() );
or
bp_notifications_get_unread_notification_count( bp_displayed_user_id() );
Because we’re talking about notifications, it’s likely you’ll want the former because you wouldn’t really need to show somebody else’s notifications count.
February 1, 2015 at 11:21 am #233340In reply to: [Resolved] How To Get Notification Count? (Code)?
chatty24ParticipantThanks for the reply but
I used the below code to print the notification count on my page to match it with the notification count which is shown by wordpress and I noticed that the below code returns the value to zero no matter what ever the original notification count is.
echo bp_notifications_get_unread_notification_count( $user_id );
and yes I need unread notification count.
February 1, 2015 at 11:08 am #233338In reply to: [Resolved] How To Get Notification Count? (Code)?
Henry WrightModeratorThere’s 2 types of notifications: a) read and b) unread.
bp_notifications_get_unread_notification_count( $user_id )
will get you the unread count so you could use that value in the comparison you mentioned here.February 1, 2015 at 9:18 am #233333In reply to: [Resolved] How To Get Notification Count? (Code)?
danbpParticipantTry 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++; }
January 21, 2015 at 6:27 pm #232685r-a-yKeymasterWe’re looking to improve the invite process for BuddyPress 2.3.
I’m going to ping @dcavins, as he will be implementing the invite improvements, so he’s aware of this.
Just to answer your questions:
Notification in the profile window’s (there are 3 notifications: message (1) – friends (1) – but in GROUPS there is no notification).
The “Groups > No Pending Invites” nav item is for invites you have requested. Not invites that are pending for the entire group.
The user (A) has posted in a group wall’s and the user (B) has done a comment.
The user (A) hasn’t received notification neither admin toolbar or administration profile windows.Currently, notifications do not occur for activity comments. We’ll likely add this enhancement into core eventually, but for now, you’ll have to use a plugin for this:
The user (A) has opened a forum in a grup. The user (B) has done a comment.
The user (A) has received notification in the administratio toolbar. But when the user (A) has done a comment the user (B) don’t has received the notification.How did user A reply to user B? On the group activity homepage or on the actual group forum topic? If user A replied on the group forum topic, then this sounds like an issue with bbPress, not BuddyPress.
January 17, 2015 at 4:54 pm #232466chatty24ParticipantThe code is working fine. But, now the website is showing this strange behavior. Whenever I try to go to something like, example.com/username/profile or /notifications etc.
It gets me back to, example.com/username
And if I remove the code the error goes away.
Any ideas why is that happening?
Thanks
January 13, 2015 at 3:02 am #231894In reply to: Redirect users to their notifications after login
jessicanaParticipantIn other way, I will be using this code for the whole site except login widgets (like BBpress log in sidebar widget):
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);
For widgets, I need a different function that redirects to the same page where users logs from. Is this possible?
I appreciate the help
January 13, 2015 at 12:29 am #231887In reply to: Redirect users to their notifications after login
jessicanaParticipantOne more question. What if I want users who logs in using the sidebar widget to return to the same page where they were while I want users who logs in using homepage link to be directed to their notifications page?
January 12, 2015 at 11:51 pm #231885In reply to: Redirect users to their notifications after login
shanebpModeratorTry this:
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);
January 2, 2015 at 11:31 pm #231406In reply to: Function to check if group has notifications
danbpParticipantThxs @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,…January 2, 2015 at 6:34 pm #231399In reply to: Function to check if group has notifications
shanebpModeratorNice @danbp, but a couple of issues…
bp_core_get_notifications_for_user
is deprecated.Instead use
bp_notifications_get_notifications_for_user( $user_id, $format = 'string' )
And I’d try using
$format = 'object'
so you can loop thru the results and only display those items related to that group.Of course, this will only get notifications for a single person.
I’m not sure if there would be notifications for a group other than activity update…?January 2, 2015 at 5:52 pm #231398In reply to: Function to check if group has notifications
danbpParticipanthi 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 ! 😉
December 9, 2014 at 11:33 pm #230355In reply to: BuddyPress group avatar spillage across networks
marvcParticipantI have the following on another network:
<?php /* Plugin Name: BP Multi Network Plugin URI: http://wpmututorials.com/news/new-features/multiple-buddypress-social-networks/ Description: Segregate your BP networks in a multi-network WP install (must be installed in the mu-plugins folder) Version: 0.1.1 Author: Ron Rennick Author URI: http://ronandandrea.com/ */ /* Copyright: (C) 2011 Ron Rennick, All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ function ra_bp_multinetwork_filter( $prefix ) { global $wpdb; if( $wpdb->siteid > 1 && $prefix == $wpdb->base_prefix ) { $current_site = get_current_site(); return $wpdb->get_blog_prefix( $current_site->blog_id ); } return $prefix; } add_filter( ‘bp_core_get_table_prefix’, ‘ra_bp_multinetwork_filter’ ); function ra_bp_multinetwork_meta_key_filter( $key ) { global $wpdb; static $user_meta_keys = array( ‘last_activity’ => false, ‘bp_new_mention_count’ => false, ‘bp_favorite_activities’ => false, ‘bp_latest_update’ => false, ‘total_friend_count’ => false, ‘total_group_count’ => false, ‘notification_groups_group_updated’ => false, ‘notification_groups_membership_request’ => false, ‘notification_membership_request_completed’ => false, ‘notification_groups_admin_promotion’ => false, ‘notification_groups_invite’ => false, ‘notification_messages_new_message’ => false, ‘notification_messages_new_notice’ => false, ‘closed_notices’ => false, ‘profile_last_updated’ => false, ‘notification_activity_new_mention’ => false, ‘notification_activity_new_reply’ => false ); if( $wpdb->siteid < 2 || !isset( $user_meta_keys[$key] ) ) return $key; if( !$user_meta_keys[$key] ) { $current_site = get_current_site(); $user_meta_keys[$key] = $wpdb->get_blog_prefix( $current_site->blog_id ) . $key; } return $user_meta_keys[$key]; } add_filter( ‘bp_get_user_meta_key’, ‘ra_bp_multinetwork_meta_key_filter’ );
December 9, 2014 at 11:32 pm #230354In reply to: BuddyPress group avatar spillage across networks
marvcParticipantIn terms of the BP Multi-Network plugin I have the following on one network:
<?php /* Plugin Name: BP Multi Network Plugin URI: http://wpmututorials.com/news/new-features/multiple-buddypress-social-networks/ Description: Segregate your BP networks in a multi-network WP install (must be installed in the mu-plugins folder) Version: 0.1 Author: Ron Rennick Author URI: http://ronandandrea.com/ */ /* Copyright: (C) 2011 Ron Rennick, All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ function ra_bp_multinetwork_filter( $prefix ) { global $wpdb; if( $wpdb->siteid > 1 && $prefix == $wpdb->base_prefix ) { $current_site = get_current_site(); return $wpdb->get_blog_prefix( $current_site->blog_id ); } return $prefix; } add_filter( ‘bp_core_get_table_prefix’, ‘ra_bp_multinetwork_filter’ ); function ra_bp_multinetwork_meta_key_filter( $key ) { global $wpdb; static $user_meta_keys = array( ‘bp_new_mention_count’ => false, ‘bp_favorite_activities’ => false, ‘bp_latest_update’ => false, ‘total_friend_count’ => false, ‘total_group_count’ => false, ‘notification_groups_group_updated’ => false, ‘notification_groups_membership_request’ => false, ‘notification_membership_request_completed’ => false, ‘notification_groups_admin_promotion’ => false, ‘notification_groups_invite’ => false, ‘notification_messages_new_message’ => false, ‘notification_messages_new_notice’ => false, ‘closed_notices’ => false, ‘profile_last_updated’ => false, ‘notification_activity_new_mention’ => false, ‘notification_activity_new_reply’ => false ); if( $wpdb->siteid < 2 || !isset( $user_meta_keys[$key] ) ) return $key; if( !$user_meta_keys[$key] ) { $current_site = get_current_site(); $user_meta_keys[$key] = $wpdb->get_blog_prefix( $current_site->blog_id ) . $key; } return $user_meta_keys[$key]; } add_filter( ‘bp_get_user_meta_key’, ‘ra_bp_multinetwork_meta_key_filter’ );
-
AuthorSearch Results