Search Results for 'notification user id'
-
AuthorSearch Results
-
January 28, 2016 at 10:43 am #249233KookidookiParticipant
Thank you!
It works fine, but when a (non-administrator) user is logged in, they cannot log out anymore because the logout button is missing which you can find in the “Howdy… [name][avatar][settings][logout button]” box at the upper right side. Also missing is the name of the user with his avatar, messages / notifications, etc. So this box is missing.
So what I need is a script that hides the admin bar on the front end when you’re logged out, but is visible when you’re logged in.
Any idea?
ThanX!
January 2, 2016 at 3:30 pm #248285In reply to: How to create a Like notification?
ibuddybookParticipantThank you for your reply Mr.Henry Wright…
How to insert the code????? how to change the Parameters???. i am not understand. please tell me step by step…
here is my code…
/buddypress/bp-activity/bp-activity-notifications.php<?php /** * BuddyPress Activity Notifications. * * @package BuddyPress * @subpackage ActivityNotifications */ // Exit if accessed directly. defined( 'ABSPATH' ) || exit; /* Emails *********************************************************************/ /** * Send email and BP notifications when a user is mentioned in an update. * * @since 1.2.0 * * @uses bp_notifications_add_notification() * @uses bp_get_user_meta() * @uses bp_core_get_user_displayname() * @uses bp_activity_get_permalink() * @uses bp_core_get_user_domain() * @uses bp_get_settings_slug() * @uses bp_activity_filter_kses() * @uses bp_core_get_core_userdata() * @uses wp_specialchars_decode() * @uses get_blog_option() * @uses bp_is_active() * @uses bp_is_group() * @uses bp_get_current_group_name() * @uses apply_filters() To call the 'bp_activity_at_message_notification_to' hook. * @uses apply_filters() To call the 'bp_activity_at_message_notification_subject' hook. * @uses apply_filters() To call the 'bp_activity_at_message_notification_message' hook. * @uses wp_mail() * @uses do_action() To call the 'bp_activity_sent_mention_email' hook. * * @param int $activity_id The ID of the activity update. * @param int $receiver_user_id The ID of the user who is receiving the update. */ function bp_activity_at_message_notification( $activity_id, $receiver_user_id ) { // Don't leave multiple notifications for the same activity item. $notifications = BP_Core_Notification::get_all_for_user( $receiver_user_id, 'all' ); foreach( $notifications as $notification ) { if ( $activity_id == $notification->item_id ) { return; } } $activity = new BP_Activity_Activity( $activity_id ); $subject = ''; $message = ''; $content = ''; // Now email the user with the contents of the message (if they have enabled email notifications). if ( 'no' != bp_get_user_meta( $receiver_user_id, 'notification_activity_new_mention', true ) ) { $poster_name = bp_core_get_user_displayname( $activity->user_id ); $message_link = bp_activity_get_permalink( $activity_id ); $settings_slug = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings'; $settings_link = bp_core_get_user_domain( $receiver_user_id ) . $settings_slug . '/notifications/'; $poster_name = stripslashes( $poster_name ); $content = bp_activity_filter_kses( strip_tags( stripslashes( $activity->content ) ) ); // Set up and send the message. $ud = bp_core_get_core_userdata( $receiver_user_id ); $to = $ud->user_email; $subject = bp_get_email_subject( array( 'text' => sprintf( __( '%s mentioned you in an update', 'buddypress' ), $poster_name ) ) ); if ( bp_is_active( 'groups' ) && bp_is_group() ) { $message = sprintf( __( '%1$s mentioned you in the group "%2$s": "%3$s" To view and respond to the message, log in and visit: %4$s --------------------- ', 'buddypress' ), $poster_name, bp_get_current_group_name(), $content, $message_link ); } else { $message = sprintf( __( '%1$s mentioned you in an update: "%2$s" To view and respond to the message, log in and visit: %3$s --------------------- ', 'buddypress' ), $poster_name, $content, $message_link ); } // Only show the disable notifications line if the settings component is enabled. if ( bp_is_active( 'settings' ) ) { $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link ); } /** * Filters the user email that the @mention notification will be sent to. * * @since 1.2.0 * * @param string $to User email the notification is being sent to. */ $to = apply_filters( 'bp_activity_at_message_notification_to', $to ); /** * Filters the @mention notification subject that will be sent to user. * * @since 1.2.0 * * @param string $subject Email notification subject text. * @param string $poster_name Name of the person who made the @mention. */ $subject = apply_filters( 'bp_activity_at_message_notification_subject', $subject, $poster_name ); /** * Filters the @mention notification message that will be sent to user. * * @since 1.2.0 * * @param string $message Email notification message text. * @param string $poster_name Name of the person who made the @mention. * @param string $content Content of the @mention. * @param string $message_link URL permalink for the activity message. * @param string $settings_link URL permalink for the user's notification settings area. */ $message = apply_filters( 'bp_activity_at_message_notification_message', $message, $poster_name, $content, $message_link, $settings_link ); wp_mail( $to, $subject, $message ); } /** * Fires after the sending of an @mention email notification. * * @since 1.5.0 * * @param BP_Activity_Activity $activity Activity Item object. * @param string $subject Email notification subject text. * @param string $message Email notification message text. * @param string $content Content of the @mention. * @param int $receiver_user_id The ID of the user who is receiving the update. */ do_action( 'bp_activity_sent_mention_email', $activity, $subject, $message, $content, $receiver_user_id ); } /** * Send email and BP notifications when an activity item receives a comment. * * @since 1.2.0 * * @uses bp_get_user_meta() * @uses bp_core_get_user_displayname() * @uses bp_activity_get_permalink() * @uses bp_core_get_user_domain() * @uses bp_get_settings_slug() * @uses bp_activity_filter_kses() * @uses bp_core_get_core_userdata() * @uses wp_specialchars_decode() * @uses get_blog_option() * @uses bp_get_root_blog_id() * @uses apply_filters() To call the 'bp_activity_new_comment_notification_to' hook. * @uses apply_filters() To call the 'bp_activity_new_comment_notification_subject' hook. * @uses apply_filters() To call the 'bp_activity_new_comment_notification_message' hook. * @uses wp_mail() * @uses do_action() To call the 'bp_activity_sent_reply_to_update_email' hook. * @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_to' hook. * @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_subject' hook. * @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_message' hook. * @uses do_action() To call the 'bp_activity_sent_reply_to_reply_email' hook. * * @param int $comment_id The comment id. * @param int $commenter_id The ID of the user who posted the comment. * @param array $params {@link bp_activity_new_comment()}. * @return bool */ function bp_activity_new_comment_notification( $comment_id = 0, $commenter_id = 0, $params = array() ) { // Set some default parameters. $activity_id = 0; $parent_id = 0; extract( $params ); $original_activity = new BP_Activity_Activity( $activity_id ); if ( $original_activity->user_id != $commenter_id && 'no' != bp_get_user_meta( $original_activity->user_id, 'notification_activity_new_reply', true ) ) { $poster_name = bp_core_get_user_displayname( $commenter_id ); $thread_link = bp_activity_get_permalink( $activity_id ); $settings_slug = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings'; $settings_link = bp_core_get_user_domain( $original_activity->user_id ) . $settings_slug . '/notifications/'; $poster_name = stripslashes( $poster_name ); $content = bp_activity_filter_kses( stripslashes($content) ); // Set up and send the message. $ud = bp_core_get_core_userdata( $original_activity->user_id ); $to = $ud->user_email; $subject = bp_get_email_subject( array( 'text' => sprintf( __( '%s replied to one of your updates', 'buddypress' ), $poster_name ) ) ); $message = sprintf( __( '%1$s replied to one of your updates: "%2$s" To view your original update and all comments, log in and visit: %3$s --------------------- ', 'buddypress' ), $poster_name, $content, $thread_link ); // Only show the disable notifications line if the settings component is enabled. if ( bp_is_active( 'settings' ) ) { $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link ); } /** * Filters the user email that the new comment notification will be sent to. * * @since 1.2.0 * * @param string $to User email the notification is being sent to. */ $to = apply_filters( 'bp_activity_new_comment_notification_to', $to ); /** * Filters the new comment notification subject that will be sent to user. * * @since 1.2.0 * * @param string $subject Email notification subject text. * @param string $poster_name Name of the person who made the comment. */ $subject = apply_filters( 'bp_activity_new_comment_notification_subject', $subject, $poster_name ); /** * Filters the new comment notification message that will be sent to user. * * @since 1.2.0 * * @param string $message Email notification message text. * @param string $poster_name Name of the person who made the comment. * @param string $content Content of the comment. * @param string $thread_link URL permalink for the activity thread. * @param string $settings_link URL permalink for the user's notification settings area. */ $message = apply_filters( 'bp_activity_new_comment_notification_message', $message, $poster_name, $content, $thread_link, $settings_link ); wp_mail( $to, $subject, $message ); /** * Fires after the sending of a reply to an update email notification. * * @since 1.5.0 * * @param int $user_id ID of the original activity item author. * @param string $subject Email notification subject text. * @param string $message Email notification message text. * @param int $comment_id ID for the newly received comment. * @param int $commenter_id ID of the user who made the comment. * @param array $params Arguments used with the original activity comment. */ do_action( 'bp_activity_sent_reply_to_update_email', $original_activity->user_id, $subject, $message, $comment_id, $commenter_id, $params ); } /* * If this is a reply to another comment, send an email notification to the * author of the immediate parent comment. */ if ( empty( $parent_id ) || ( $activity_id == $parent_id ) ) { return false; } $parent_comment = new BP_Activity_Activity( $parent_id ); if ( $parent_comment->user_id != $commenter_id && $original_activity->user_id != $parent_comment->user_id && 'no' != bp_get_user_meta( $parent_comment->user_id, 'notification_activity_new_reply', true ) ) { $poster_name = bp_core_get_user_displayname( $commenter_id ); $thread_link = bp_activity_get_permalink( $activity_id ); $settings_slug = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings'; $settings_link = bp_core_get_user_domain( $parent_comment->user_id ) . $settings_slug . '/notifications/'; // Set up and send the message. $ud = bp_core_get_core_userdata( $parent_comment->user_id ); $to = $ud->user_email; $subject = bp_get_email_subject( array( 'text' => sprintf( __( '%s replied to one of your comments', 'buddypress' ), $poster_name ) ) ); $poster_name = stripslashes( $poster_name ); $content = bp_activity_filter_kses( stripslashes( $content ) ); $message = sprintf( __( '%1$s replied to one of your comments: "%2$s" To view the original activity, your comment and all replies, log in and visit: %3$s --------------------- ', 'buddypress' ), $poster_name, $content, $thread_link ); // Only show the disable notifications line if the settings component is enabled. if ( bp_is_active( 'settings' ) ) { $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link ); } /** * Filters the user email that the new comment reply notification will be sent to. * * @since 1.2.0 * * @param string $to User email the notification is being sent to. */ $to = apply_filters( 'bp_activity_new_comment_notification_comment_author_to', $to ); /** * Filters the new comment reply notification subject that will be sent to user. * * @since 1.2.0 * * @param string $subject Email notification subject text. * @param string $poster_name Name of the person who made the comment reply. */ $subject = apply_filters( 'bp_activity_new_comment_notification_comment_author_subject', $subject, $poster_name ); /** * Filters the new comment reply notification message that will be sent to user. * * @since 1.2.0 * * @param string $message Email notification message text. * @param string $poster_name Name of the person who made the comment reply. * @param string $content Content of the comment reply. * @param string $settings_link URL permalink for the user's notification settings area. * @param string $thread_link URL permalink for the activity thread. */ $message = apply_filters( 'bp_activity_new_comment_notification_comment_author_message', $message, $poster_name, $content, $settings_link, $thread_link ); wp_mail( $to, $subject, $message ); /** * Fires after the sending of a reply to a reply email notification. * * @since 1.5.0 * * @param int $user_id ID of the parent activity item author. * @param string $subject Email notification subject text. * @param string $message Email notification message text. * @param int $comment_id ID for the newly received comment. * @param int $commenter_id ID of the user who made the comment. * @param array $params Arguments used with the original activity comment. */ do_action( 'bp_activity_sent_reply_to_reply_email', $parent_comment->user_id, $subject, $message, $comment_id, $commenter_id, $params ); } } /** * Helper method to map action arguments to function parameters. * * @since 1.9.0 * * @param int $comment_id ID of the comment being notified about. * @param array $params Parameters to use with notification. */ function bp_activity_new_comment_notification_helper( $comment_id, $params ) { bp_activity_new_comment_notification( $comment_id, $params['user_id'], $params ); } add_action( 'bp_activity_comment_posted', 'bp_activity_new_comment_notification_helper', 10, 2 ); /** Notifications *************************************************************/ /** * Format notifications related to activity. * * @since 1.5.0 * * @uses bp_loggedin_user_domain() * @uses bp_get_activity_slug() * @uses bp_core_get_user_displayname() * @uses apply_filters() To call the 'bp_activity_multiple_at_mentions_notification' hook. * @uses apply_filters() To call the 'bp_activity_single_at_mentions_notification' hook. * @uses do_action() To call 'activity_format_notifications' hook. * * @param string $action The type of activity item. Just 'new_at_mention' for now. * @param int $item_id The activity ID. * @param int $secondary_item_id In the case of at-mentions, this is the mentioner's ID. * @param int $total_items The total number of notifications to format. * @param string $format 'string' to get a BuddyBar-compatible notification, 'array' otherwise. * @return string $return Formatted @mention notification. */ function bp_activity_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) { switch ( $action ) { case 'new_at_mention': $activity_id = $item_id; $poster_user_id = $secondary_item_id; $at_mention_link = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/'; $at_mention_title = sprintf( __( '@%s Mentions', 'buddypress' ), bp_get_loggedin_user_username() ); $amount = 'single'; if ( (int) $total_items > 1 ) { $text = sprintf( __( 'You have %1$d new mentions', 'buddypress' ), (int) $total_items ); $amount = 'multiple'; } else { $user_fullname = bp_core_get_user_displayname( $poster_user_id ); $text = sprintf( __( '%1$s mentioned you', 'buddypress' ), $user_fullname ); } break; } if ( 'string' == $format ) { /** * Filters the @mention notification for the string format. * * This is a variable filter that is dependent on how many items * need notified about. The two possible hooks are bp_activity_single_at_mentions_notification * or bp_activity_multiple_at_mentions_notification. * * @since 1.5.0 * * @param string $string HTML anchor tag for the mention. * @param string $at_mention_link The permalink for the mention. * @param int $total_items How many items being notified about. * @param int $activity_id ID of the activity item being formatted. * @param int $poster_user_id ID of the user posting the mention. */ $return = apply_filters( 'bp_activity_' . $amount . '_at_mentions_notification', '<a href="' . esc_url( $at_mention_link ) . '" title="' . esc_attr( $at_mention_title ) . '">' . esc_html( $text ) . '</a>', $at_mention_link, (int) $total_items, $activity_id, $poster_user_id ); } else { /** * Filters the @mention notification for any non-string format. * * This is a variable filter that is dependent on how many items need notified about. * The two possible hooks are bp_activity_single_at_mentions_notification * or bp_activity_multiple_at_mentions_notification. * * @since 1.5.0 * * @param array $array Array holding the content and permalink for the mention notification. * @param string $at_mention_link The permalink for the mention. * @param int $total_items How many items being notified about. * @param int $activity_id ID of the activity item being formatted. * @param int $poster_user_id ID of the user posting the mention. */ $return = apply_filters( 'bp_activity_' . $amount . '_at_mentions_notification', array( 'text' => $text, 'link' => $at_mention_link ), $at_mention_link, (int) $total_items, $activity_id, $poster_user_id ); } /** * Fires right before returning the formatted activity notifications. * * @since 1.2.0 * * @param string $action The type of activity item. * @param int $item_id The activity ID. * @param int $secondary_item_id @mention mentioner ID. * @param int $total_items Total amount of items to format. */ do_action( 'activity_format_notifications', $action, $item_id, $secondary_item_id, $total_items ); return $return; } /** * 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 ) { if ( bp_is_active( 'notifications' ) ) { 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 ); /** * Mark at-mention notifications as read when users visit their Mentions page. * * @since 1.5.0 * * @uses bp_notifications_mark_all_notifications_by_type() */ function bp_activity_remove_screen_notifications() { if ( ! bp_is_active( 'notifications' ) ) { return; } // Only mark read if you're looking at your own mentions. if ( ! bp_is_my_profile() ) { return; } bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->activity->id, 'new_at_mention' ); } add_action( 'bp_activity_screen_mentions', 'bp_activity_remove_screen_notifications' ); /** * Mark at-mention notification as read when user visits the activity with the mention. * * @since 2.0.0 * * @param BP_Activity_Activity $activity Activity object. */ function bp_activity_remove_screen_notifications_single_activity_permalink( $activity ) { if ( ! bp_is_active( 'notifications' ) ) { return; } if ( ! is_user_logged_in() ) { return; } // Mark as read any notifications for the current user related to this activity item. bp_notifications_mark_notifications_by_item_id( bp_loggedin_user_id(), $activity->id, buddypress()->activity->id, 'new_at_mention' ); } add_action( 'bp_activity_screen_single_activity_permalink', 'bp_activity_remove_screen_notifications_single_activity_permalink' ); /** * Delete at-mention notifications when the corresponding activity item is deleted. * * @since 2.0.0 * * @param array $activity_ids_deleted IDs of deleted activity items. */ function bp_activity_at_mention_delete_notification( $activity_ids_deleted = array() ) { // Let's delete all without checking if content contains any mentions // to avoid a query to get the activity. if ( bp_is_active( 'notifications' ) && ! empty( $activity_ids_deleted ) ) { foreach ( $activity_ids_deleted as $activity_id ) { bp_notifications_delete_all_notifications_by_type( $activity_id, buddypress()->activity->id ); } } } add_action( 'bp_activity_deleted_activities', 'bp_activity_at_mention_delete_notification', 10 );
December 28, 2015 at 4:00 pm #248156jscmalParticipantHere the list of plugins installed in this moment:
advanced-lazy-load
advanced-recent-posts
affiliates-manager
affiliates-manager-simple-membership-integration
akismet
bp-activity-autoloader
bp-activity-comment-notifier
bp-activity-shortcode
buddypress
buddypress-cover-photo
buddypress-first-letter-avatar
buddypress-followers
buddypress-media
buddypress-members-only
buddypress-sticker
cookie-law-info
ewww-image-optimizer
eyes-only-user-access-shortcode
favorites
fb-like-notification-for-buddypress
google-analytics-dashboard-for-wp
hashbuddy
invite-anyone
jetpack
mailchimp-for-wp
options-importer
options-optimizer
redirection
simple-ajax-chat
simple-membership
simple-membership-after-login-redirection
simple-membership-custom-messages
simple-membership-form-shortcode
simple-membership-mailchimp-integration
simple-membership-menu
simple-membership-wp-user-import
stream
testimonials-by-woothemes
user-role-editor
user-switching
woosidebars
wordpress-database-reset
wordpress-importer
wordpress-seo
wp-optimize
wp-postviews
wp-super-cache
wp-sweep
wp-symposium-toolbar
wp-useronline
wp-video-lightboxDecember 27, 2015 at 3:34 am #248123jscmalParticipantAbout the WordPress Debug, the log track always these errors:
[27-Dec-2015 03:30:31 UTC] PHP Notice: bp_setup_current_user was called <strong>incorrectly</strong>. The current user is being initialized without using $wp->init(). Please see <a href="https://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information. (This message was added in version 1.7.) in /home/xxxxx/wp-includes/functions.php on line 3787 [27-Dec-2015 03:30:31 UTC] PHP Notice: The called constructor method for WP_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /home/xxxxx/wp-includes/functions.php on line 3619 [27-Dec-2015 03:30:31 UTC] PHP Notice: bp_core_get_notifications_for_user is <strong>deprecated</strong> since version 1.9! Use bp_notifications_get_notifications_for_user() instead. in /home/xxxxx/wp-includes/functions.php on line 3568
What can I do to manage this situation?
Please, help me!
December 15, 2015 at 12:32 pm #247776AntonioParticipantHi Henry and r-a-y, I have the same request and I have to thank you for the replies.
Specifically I would add a notification when a user read a received message, so i guess whene a message (or thread?) is marked as read.
If I have to use these functions and hook as well, I understand how to use them, the only thing that I don’t know is how to get IDs. For example when I perform
bp_after_message_thread_content
, in the function that I call, how can I get the id of the thread? Adter I gues I have to get the id of the last message of that thread for change its meta, how can I get that id?Please give me some suggestions and let me know if there are better ways for this.
Sorry for my poor english.December 9, 2015 at 4:11 pm #247589In reply to: Hide count – please help a PHP newbie
shanebpModeratorif ( bp_notifications_get_unread_notification_count( bp_loggedin_user_id() ) != 0 ) $notif .= '<li class="notify"><a href=" ' .$notif_url. ' ">Notifications <div class="notifynumber topnavcount">'. bp_notifications_get_unread_notification_count( bp_loggedin_user_id() ).'</div></a></li>'; else $notif .= '<li class="notify"><a href=" ' .$notif_url. ' ">Notifications</a></li>';
December 9, 2015 at 2:29 pm #247583In reply to: Hide count – please help a PHP newbie
shanebpModeratorTry:
function my_counter_nav_menu($menu) { $notif_url = bp_core_get_user_domain(bp_loggedin_user_id()) .'notifications/'; $friends_url = bp_core_get_user_domain(bp_loggedin_user_id()) .'friends/'; $msg_url = bp_core_get_user_domain(bp_loggedin_user_id()) .'messages/'; if (!is_user_logged_in()) return $menu; $notif = '<li class="notify"><a href=" ' .$friends_url. ' ">Connections <div class="friendnumber topnavcount">'.friends_get_friend_count_for_user( bp_loggedin_user_id() ) .'</div></a></li>'; if ( bp_notifications_get_unread_notification_count( bp_loggedin_user_id() ) != 0 ) $notif .= '<li class="notify"><a href=" ' .$notif_url. ' ">Notifications <div class="notifynumber topnavcount">'. bp_notifications_get_unread_notification_count( bp_loggedin_user_id() ).'</div></a></li>'; if ( bp_get_total_unread_messages_count( bp_loggedin_user_id() ) != 0 ) $notif .= '<li class="notify"><a href=" ' .$msg_url. ' ">Messages <div class="messagenumber topnavcount">'.bp_get_total_unread_messages_count( bp_loggedin_user_id() ) .'</div></a></li>'; $menu .= $notif; return $menu; } add_filter( 'wp_nav_menu_items', 'my_counter_nav_menu' );
November 29, 2015 at 7:31 pm #247266Henry WrightModeratorIs there a table in the DB that deals specifically with notifications?
Yes. That’d be
bp_notifications
If so, I guess I could just empty it before I emptied the stream and stream meta tables.
Shout up if anyone thinks that could be a problem.
Instead of deleting directly from the database, you should use these functions:
bp_notifications_delete_notifications_by_type()
bp_notifications_delete_notifications_by_item_id()
bp_notifications_delete_all_notifications_by_type()
bp_notifications_delete_notifications_from_user()
Alternatively, if none of these quite suit your need, go straight for the class method:
BP_Notifications_Notification::delete()
October 18, 2015 at 12:01 pm #245639In reply to: Can I @everyone when I message?
Henry WrightModeratorOne additional feature I was thinking about, a bit of a leap, would be that ability of the user to configure their own user group to send mentions to, a subset of their friends that they may wish to send shouts to.
Setting up arbitrary groups of members is a good idea, but I think that functionality should belong in a separate plugin. This plugin just hooks into existing collections of users such as friends, mods, group members etc.
Also, currently the notification message includes the text @group, I was wondering about removing this to enable to nicer formatting for the message.
The notification text can be localised using a language file. See the Customizing Labels, Messages, and URLs article for info on how you can do that.
October 5, 2015 at 1:39 pm #245073In reply to: Logged in Links
WebitseoParticipant@shanebp: I don’t understand. Why are all the BP pages listed as options for only logged in users in the Menu widget except for the Members page (and Register and Log in, ofcourse)? I only want logged in members to see the member directory, for the sake of the privacy of my members. I can add the page via the regular pages menu, but then it is visible in the menu to everyone even if they are logged out. Or if I go to http://www.site.com/members/ when not logged in, the page with the list of members is visible. I would like the members directory to be private. I don’t understand why BP left this out of the menu for logged in users only. If this is not possible, is there a way to block the /members/ page from the public that won’t mess anything up?
In fact, I just checked all the logged-in links in a different browser that I’m not logged in to, and the members, activities, groups, friends and profile pages are ALL visible! Doesn’t that defeat the whole purpose of having a membership community that requires registration????? At least messages, notifications, and settings are locked. Am I missing something?
October 2, 2015 at 5:18 pm #245017cisdevParticipantHello @henrywright,
Thanks for your reply.i am working with my custom code but i am unable to do,i have try many times with my added custom code.in Notification section I want accept and reject both button functionality on notification section in place of Read|Delete action and also want same functionality like accept and reject both button working and also i want hide and remove when user accept or reject
friend request then notification should be hide or remove from notification section.Please if you have any code or solution please share.
September 30, 2015 at 6:51 pm #244944pnetParticipantFor what ever reason I did not receive the email notification for your response.
My users are showing now, I figured out what I was doing wrong.
September 10, 2015 at 8:28 pm #244254In reply to: Hide Buddypress pages from google serch.
djstevebParticipant@nithin270 – any changes you make for search spiders is going to take weeks (at minimum) before they are reflected in the search results.
I suggest doing some robots.txt additions (will list mine below) – however realize that long ago google made a decisions that even if your robots.txt says to disallow crawling something, if another page on the web links to your subpage that is blocked by robots.txt, it will still show the url in the search results – but have a description something like “this sites robots.txt prevents google from displaying description of this result”.
There has been debate about that decision, but it is what it is.
The only way to really prevent a page showing up in results is to hide it behind a password (like htpasswd) – however google does normally remove results if that page (or header info of images) includes “noindex” in the head of the page (there is a tricky way to add this to images – it was pointed out to me in the google webmaster forums)
given that bp pages like members are kind of pseudo pages, using something like yoast (currently as far as I know) – will not give you an option to add noindex, nofollow to your member pages..
you may be able to modify the code I got from wpmudev that checks “if is member page, then add meta description as…” –
( http://premium.wpmudev.org/forums/topic/bp-meta-tite-description-for-groups-and-members-pages#post-806736 )
to… also check “if is members page” – then add “meta name=”robots” content “noindex, nofollow”..
(something like that)that should remove your members pages next time google crawls your site and the crawlers send the info back to the main algo/index..
I think there is a way to log into google webmaster tools if you have claimed /verified your site and click on urls to ask the big G to remove them as well. (I have not messed with that stuff in a while )
I also suggest adding a robots.txt file similar to this:
Disallow: */activity/p/*
Disallow: /docs/
Disallow: *send-invites*
Disallow: */groups/*members*
Disallow: */groups/*media*
Disallow: *widget-title*
Disallow: *members/*activity*
Disallow: *members/*notifications*
Disallow: *members/*friends*
Disallow: *members/*groups*
Disallow: *members/*docs*
Disallow: *members/*media*
Disallow: *acpage*
Disallow: *messages*
Disallow: *friends*
Disallow: *settings*
Disallow: /*/comment-page*
Disallow: *register*
Disallow: *login*
Disallow: *profile*
Disallow: *admin*
Disallow: *includes*
Disallow: *content*to prevent some other quirky indexing issues with bp.
If your member profile stuff is sacred, then I would hunt the forums here for what others have been messing with that prevents profile info from being displayed if a user is not logged in… as there are plenty of indexing spiders that will not follow the robots.txt or robots index rules in <head> – in fact some specifically look for these things and purposely crawl and scrape stuff that is blocked –
Disclaimer: I am not an expert, not a real coder. Research these things with other sources, your situation may vary.
September 9, 2015 at 11:30 pm #244204In reply to: Logged in home page
danbpParticipantTo redirect your users to their friends activities page on login, you can use this:
function bpdev_redirect_to_profile( $redirect_to_calculated, $redirect_url_specified, $user ){ if( empty( $redirect_to_calculated ) ) $redirect_to_calculated = admin_url(); //if the user is not site admin,redirect to his/her profile $url = bp_core_get_user_domain( $user->ID ) .'activity/friends/'; if( isset( $user->ID) && ! is_super_admin( $user->ID ) ) return $url; else return $redirect_to_calculated; /*if site admin or not logged in,do not do anything much*/ } add_filter( 'bp_login_redirect', 'bpdev_redirect_to_profile', 11, 3 );
Snippet source: http://buddydev.com/buddypress/buddypress-trick-redirect-users-to-their-profile-on-login/
To add a home button to the main menu, use WP’s menu builder. But this doesn’t let you add a dynamic button going to EACH user profile, only to yours. You will have to code this.
See from here how to do this:
https://buddypress.org/support/topic/how-to-get-notification-count-code/#post-244069
You need to introduce this:
$url = bp_core_get_user_domain( $user->ID ) .'activity/friends/';
September 5, 2015 at 7:29 am #244069In reply to: [Resolved] How To Get Notification Count? (Code)?
danbpParticipanthi ailyroot,
no time to sort out what you need, but see here 3 snippets using different wya to add such item to a theme main menu or custom menu, with fixed or free position… Test and take the one you need.
//fixed position function my_nav_menu_notif_counter($menu) { if (!is_user_logged_in()) return $menu; else $notif = '<li>Notif '. bp_notifications_get_unread_notification_count( bp_loggedin_user_id() ) .'</li>'; $menu = $menu . $notif; return $menu; } add_filter( 'wp_nav_menu_items', 'my_nav_menu_notif_counter' ); //choose position function my_nav_menu_positioned_notif_counter( $items, $args ) { if( $args->theme_location == 'primary' ) // only for primary menu { $items_array = array(); while ( false !== ( $item_pos = strpos ( $items, '<li', 3) ) ) { $items_array[] = substr($items, 0, $item_pos); $items = substr($items, $item_pos); } $items_array[] = $items; array_splice($items_array, 0, 0, '<li>Notif '. bp_notifications_get_unread_notification_count( bp_loggedin_user_id() ) .'</li>'); // 0,0 is first position, 1,0 is second, etc $items = implode('', $items_array); } return $items; } add_filter('wp_nav_menu_items','my_nav_menu_positioned_notif_counter', 10, 2); // depending the theme, $theme_location may vary and this one use a menu ID function my_notif_link( $items, $args ) { $theme_location = 'primary';// Theme Location slug $existing_menu_item_db_id = 6; // menu id $new_menu_item_db_id = 66; // unique id number $label = 'Notificationas '. bp_notifications_get_unread_notification_count( bp_loggedin_user_id() ); $url = bp_core_get_user_domain(bp_loggedin_user_id()) .'notifications/'; if ( $theme_location !== $args->theme_location ) { return $items; } $new_links = array(); if ( is_user_logged_in() ) { // only if user is logged-in, do sub-menu link $item = array( 'title' => $label, 'menu_item_parent' => $existing_menu_item_db_id, 'ID' => 'fugit', // menu name 'db_id' => $new_menu_item_db_id, 'url' => $url, 'classes' => array( 'menu-item' ) ); $new_links[] = (object) $item; // Add the new menu item to our array unset( $item ); // in case we add more items below $index = count( $items ); // integer, the order number. // Insert the new links at the appropriate place. array_splice( $items, $index, 0, $new_links ); // 0,0 is first position, 1,0 is second, etc } return $items; } add_filter( 'wp_nav_menu_objects', 'my_notif_link', 10, 2 );
Happy testing 😉
September 5, 2015 at 3:36 am #244065In reply to: [Resolved] How To Get Notification Count? (Code)?
AilyRootParticipantHi guys
we are looking for solution to get buddypress notifications work on our theme, we know it will be shown on wordpress’s default top tool bar but we want it to show somewhere else.We are using WP 4.3 with buddypress 2.3.3, we have added these to theme’s functions.php
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 );
then we add these to theme ‘s menu location
<?php echo bp_notifications_get_unread_notification_count( bp_loggedin_user_id() ); ?>
but it is showing nothing, what is the correct steps to make this work please?
thanks
September 1, 2015 at 4:24 am #243926In reply to: Incorrect Member Profile URL in Notifications
tr1stessaParticipantHello danbp,
Sorry for my late reply. I tried testing out with the twenty fifteen theme but it won’t show the notifications. I am also not using any notifications plugin (I tried on but didn’t resolve the issue either). No other errors are being generated, all links are working except for the user profile in the notification. It seems to be automatically adding the root folder and the members folder into the URL instead of just going directly to the user profile URL. Is there anything in the notifications php that I can edit to fix this?Thanks!
TeriAugust 28, 2015 at 8:59 am #243760ctuxboyParticipantHello,
– I activate the original WP twentyfifteen-theme, and i see no errors in the developer console (Chrome browser)
Is this an issue? Have more people this?
Can i adding manually the private button links?This are the installed plugins:
– All In One WP Security
– Black Studio TinyMCE Widget
– Bowe Codes
– BP Registration Options
– Bp Stickers
– BuddyPress Members only
– BuddyPress
– Child Theme Configurator
– Contact Form 7
– Duplicator
– Events Manager
– FB like notification for buddypress
– Loco Translate
– Page Builder by SiteOrigin
– Peter’s Login Redirect
– Really Simple CAPTCHA
– SiteOrigin Widgets Bundle
– User Switching (deactivated for the moment!)
– WP StatisticsThe strange thing is that all the buttons showing correctly in the user profiles when nothing a friend.
(sorry for my bad english!)
August 18, 2015 at 9:01 am #243321In reply to: Need urgent help with BP notifications
chicho1969Participantokay, This is almost done, but is really rare, not everything works as it should.
First of all, this is not a pluggin, I am writing all these code in bp-functions.php in my bududdypress folder within my theme folder. (this may be my problem).
Step by step:
1st Problem setup globals is not working as it espected:define( 'BP_NOTIFIER_CELBIRTHDAY_SLUG', 'celbirthday_notifier' ); function celbirthday_notifier_setup_globals () { global $bp, $wpdb; $bp = buddypress(); $bp->celbirthday_notifier = new stdClass(); $bp->celbirthday_notifier->id = 'celbirthday_notifier'; //I asume others are not going to use this is $bp->celbirthday_notifier->slug = BP_NOTIFIER_CELBIRTHDAY_SLUG; $bp->celbirthday_notifier->notification_callback = 'celbirthday_notifier_format_notifications'; //show the notification $bp->active_components[$bp->celbirthday_notifier->id] = $bp->celbirthday_notifier->id; do_action( 'bp_setup_globals' ); }
This function is not doing nothing unless I call it directly:
celbirthday_notifier_setup_globals ();
I Know this is not the proper way, but it is the only way I found to make it run.
Does anyone know why it does not work properly?Continue with the notification:
//Format notifications function celbirthday_notifier_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) { if ( 'new_birthday' === $action ) { if ( (int) $total_items > 1 ) { if ( 'string' === $format ) { $famoso_name = get_the_title( $secondary_item_id ); return apply_filters( 'celebrities_multiple_verifications_notification','Say Happybirthday to '.$famoso_name); } } else { if ( 'string' === $format ) { //falta definir $famoso_link y mas $famoso_name = get_the_title( $secondary_item_id ); return apply_filters( 'celebrities_single_verifications_notification','Say Happybirthday to '.$famoso_name); // $return = apply_filters( $filter, '<a href="' . esc_url( $famoso_link ) . '" title="birthday anounce">' . esc_html( $text ) . '</a>', (int) $total_items, $text, $famoso_link ); // $message = apply_filters( 'bp_activity_at_message_notification_message', $message, $poster_name, $content, $message_link, $settings_link ); } } } do_action( 'celbirthday_notifier_format_notifications', $action, $item_id, $secondary_item_id, $total_items ); return false; }
ok, this format function is working right, although I have to do some more work. After it, I have two more functions (mark and delete notifications) wich are also working fine.
//mark notification function celebrities_mark_screen_notifications() { global $bp; bp_notifications_mark_notifications_by_item_id( $bp->loggedin_user->id, $bp->celbirthday_notifier->id, 'new_birthday', $secondary_item_id = false, $is_new='0'); } add_action( 'bp_notifications_screen', 'celebrities_mark_screen_notifications' );
and…
function celbirthday_notifier_remove_screen_notifications() { global $bp; bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->profile->slug, 'new_birthday' ); } add_action( 'bp_notifications_screen', 'celbirthday_notifier_remove_screen_notifications' ); add_action( 'xprofile_screen_display_profile', 'celbirthday_notifier_remove_screen_notifications' );
As I say, this works fine, but a I am not sure if I need the second “add_action” (xprofile screen).
And finally, to add notification I use this code (which is not working)://Adding notification function buddypress_celebrities_add_notification() { if ( bp_is_active( 'notifications' ) ) { $fecha_act = date("Y-m-d"); $res_birth = $wpdb->get_results( "SELECT wp_best_favs.user_id, wp_postmeta.post_id FROM wp_best_favs LEFT JOIN wp_postmeta ON ( wp_postmeta.post_id = wp_best_favs.celeb_ID ) WHERE ( wp_postmeta.meta_key = 'fecha_na') AND (DAY( <code>wp_postmeta</code>.<code>meta_value</code> ) = DAY( '$fecha_act' )) AND (MONTH( <code>wp_postmeta</code>.<code>meta_value</code> ) = MONTH( '$fecha_act' )) "); $res_birth = array_filter($res_birth); $matriz = objectToArray($res_birth); //I use this function to convert objet array to simple array if(count($matriz)==0) { // está vacío } else { global $wpdb; $bp = buddypress(); $current_time = bp_core_current_time(); foreach ($matriz as $v1) { $famoso_id = $v1[post_id]; $receiver_user_id = $v1[user_id]; $args = array( 'user_id' => $receiver_user_id, 'item_id' => $famoso_id, 'secondary_item_id' => $famoso_id, 'component_name' => $bp->celbirthday_notifier->slug, 'component_action' => 'new_birthday', 'date_notified' => $current_time, 'is_new' => 1, ); bp_notifications_add_notification( $args ); } } } } do_action( 'bp_init', 'buddypress_celebrities_add_notification' );
So this is my bigger problem:
Add notifications (function buddypress_celebrities_add_notification()) is not working.
I am pretty sure this is because I am not hooking properly, but I tried so many hooks and none of it did work.
I Know the code is fine because if I comment the two first lines and the two last lines (so I run the code not as a function) the notifications are being added to database.Anyone can help me, to find a proper hook, or just pointing me in the right direction.
Thanks in advance.August 13, 2015 at 6:02 pm #243161In reply to: Need urgent help with BP notifications
chicho1969ParticipantThanks @danbp ,
I´ll try to explain you:I have a custom_post_type (celebrities). it real name is “famosos”.
BuddyPressUsers can mark any celebrity as fasvourite.
This part is working fine.
So now, I am trying to send a notification (to users that have marked as favorite certain celebriry) that “today” is that celebrity´s birthday.For that purpose, I have a SQL query that works fine and gives me an array with budypress user id and the celebritie post id. (this is also working fine)
SO I have to setup a custom notificationa that checks every day that SQL QUery to gets users and celebrities ids to notify user about today´s birthday (of their favourite celebrities)
and this is what I did at first:
define( 'BP_ACTIVITY_CELBIRTHDAY_SLUG', 'celbirthday_notifier' ); function celbirthday_notifier_setup_globals () { $bp = buddypress(); $bp->celbirthday_notifier = new stdClass(); $bp->celbirthday_notifier->id = 'celbirthday_notifier'; //I asume others are not going to use this is $bp->celbirthday_notifier->slug = BP_ACTIVITY_CELBIRTHDAY_SLUG; $bp->celbirthday_notifier->notification_callback = 'celbirthday_notifier_format_notifications'; //show the notification $bp->active_components[$bp->celbirthday_notifier->id] = $bp->celbirthday_notifier->id; do_action( 'celbirthday_notifier_setup_globals' ); } add_action( 'bp_setup_globals', 'celbirthday_notifier_setup_globals' );
and then try to format the notification:
function celbirthday_notifier_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) { if ( 'new_birthday' === $action ) { $famoso_name = get_the_title( $secondary_item_id ); $subject = 'Celebrity birthday'; $message = 'Say happy birthday to $famoso_name'; $content = 'Tody is $famoso_name birthday .....somethin else '; if ( (int) $total_items > 1 ) { $text = sprintf( __( 'You have %d celebrities birthday', 'bbpress' ), (int) $total_items ); $filter = 'bp_activity_at_message_notification_message'; } else { if ( !empty( $secondary_item_id ) ) { //nada } else { $text = sprintf( __( 'You have %d new birthday of %s', 'bbpress' ), (int) $total_items, $famoso_name ); } $filter = 'bp_activity_at_message_notification_message'; } } if ( 'string' === $format ) { //falta definir $famoso_link y mas $return = apply_filters( $filter, '<a href="' . esc_url( $famoso_link ) . '" title="birthday anounce">' . esc_html( $text ) . '</a>', (int) $total_items, $text, $famoso_link ); // $message = apply_filters( 'bp_activity_at_message_notification_message', $message, $poster_name, $content, $message_link, $settings_link ); } } do_action( 'celbirthday_notifier_format_notifications', $action, $item_id, $secondary_item_id, $total_items );
and then add notification this way:
function buddypress_celebrities_add_notification( $fecha_act, $famoso_name, $receiver_user_id) { if ( bp_is_active( 'notifications' ) ) { $fecha_act = date("Y-m-d"); $res_birth = $wpdb->get_results( "SELECT wp_best_favs.user_id, wp_postmeta.post_id FROM wp_best_favs LEFT JOIN wp_postmeta ON ( wp_postmeta.post_id = wp_best_favs.celeb_ID ) WHERE ( wp_postmeta.meta_key = 'fecha_na') AND (DAY( <code>wp_postmeta</code>.<code>meta_value</code> ) = DAY( '$fecha_act' )) AND (MONTH( <code>wp_postmeta</code>.<code>meta_value</code> ) = MONTH( '$fecha_act' ) ) ") ; $res_birth = array_filter($res_birth); $matriz = objectToArray($res_birth); //convertimos el array de objetos en array normal para manejarlo mas facil $current_time = bp_core_current_time(); if(count($matriz)==0) { // está vacío } else { global $wpdb; $bp = buddypress(); $subject = 'Celebrity birthday'; $message = '1 Say happy birthday to $famoso_name'; $content = '2 Say happy birthday to $famoso_name'; foreach ($matriz as $v1) { $famoso_id = $v1[post_id]; $famoso_name = get_the_title ($v1[post_id]); $receiver_user_id = $v1[user_id]; $args = array( 'user_id' => $receiver_user_id, 'item_id' => $famoso_id, 'secondary_item_id' => $famoso_id, 'component_name' => $bp->celbirthday_notifier->id, 'component_action' => 'new_birthday', 'date_notified' => $current_time, 'is_new' => 1, ); bp_notifications_add_notification( $args ); } } } } add_action( 'new_birthday', 'buddypress_celebrities_add_notification', 10, 1 );
so far this is what I am trying to do, hope you understand.
Thanks in advance.August 13, 2015 at 5:07 pm #243158In reply to: New User Notification Email to Admin
michaelpfaffParticipantI figured this out by cobbling together some code. Just copy this into a new .php file, upload to /plugins and activate. You’ll need to change ‘Referrer’ to whatever profile field you have instead.
<?php /* Plugin Name: Custom New User Email Description: Changes the copy in the email sent out to new users */ // Redefine user notification function if ( !function_exists('wp_new_user_notification') ) { function wp_new_user_notification( $user_id, $plaintext_pass = '' ) { $user = get_userdata( $user_id ); // The blogname option is escaped with esc_html on the way into the database in sanitize_option // we want to reverse this for the plain text arena of emails. $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); // find the profile field for referrer $field1 = xprofile_get_field_data( 'Referrer', $user_id ); $message = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n"; $message .= sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n"; $message .= sprintf(__('E-mail: %s'), $user->user_email) . "\r\n\r\n"; $message .= sprintf(__('Referrer: %s'), $field1) . "\r\n"; @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message); if ( empty($plaintext_pass) ) return; $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n"; $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n"; $message .= wp_login_url() . "\r\n"; wp_mail($user->user_email, sprintf(__('[%s] Your username and password'), $blogname), $message); } } ?>
August 13, 2015 at 4:03 pm #243155In reply to: Need urgent help with BP notifications
chicho1969ParticipantThanks for reply.
Yes I read those articles (…and much more), but still not understanding, Sorry about it, thus I am asking for help.
I don,t understand what do you mean with use a function name twice:
(// do_action( ‘setup_globals’ ); This is commented) ,is this a better way to do it?:
function sr_notifications_test_setup_globals () { global $bp, $current_blog; $bp->sr_notifications_test = new stdClass(); $bp->sr_notifications_test->id = 'sr_notifications_test'; $bp->sr_notifications_test->slug = 'sr_notifications_test'; $bp->sr_notifications_test->notification_callback = 'sr_format_notifications_test'; $bp->active_components[$bp->sr_notifications_test->id] = $bp->sr_notifications_test->id; do_action( 'sr_notifications_test_setup_globals ' ); } add_action( 'bp_notification_settings', 'sr_notifications_test_setup_globals ' );
Anyway, what I understood is that I have to write those 3 functions to make my custom notifications works:
1.- setup_globals
2.- format_notifications (called from set_up_globals, notification_callback)
If Iunderstood you´, the filter I have to use is bp_notifications_get_notifications_for_user
3.- _add_notificationis this the right way?
August 12, 2015 at 4:01 pm #243087In reply to: Need urgent help with BP notifications
chicho1969ParticipantOk, now I am trying this:
//function class function setup_globals( $args = array() ) { global $bp; $sr_notifications_test_slug = 'sr_notifications_test'; parent::setup_globals( array( 'id' => 'sr_notifications_test', 'slug' => $sr_notifications_test_slug, 'notification_callback' => array( $this, 'sr_format_notifications_test' ) ) ); /* Register this in the active components array */ $bp->active_components[$sr_notifications_test_slug] = 'sr_notifications_test'; // do_action( 'setup_globals' ); } //format notofication function sr_format_notifications_test( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) { switch ( $action ) { case 'my_test': $link = get_permalink( $item_id ); $text = 'Test Notification'; $return = apply_filters( $filter, array( 'text' => $text, 'link' => $link ), $link, (int) $total_items, $text, $link, $item_id, $secondary_item_id ); break; } do_action( 'sr_format_notifications_test', $action, $item_id, $secondary_item_id, $total_items ); return $return; } //Notification added to DB: bp_notifications_add_notification( array( 'user_id' => $user_id, 'item_id' => $activity->id, 'secondary_item_id' => $activity->user_id, 'component_name' => buddypress()->activity->id, 'component_action' => 'my_test', 'date_notified' => bp_core_current_time(), 'is_new' => 1 ) ); print_r ($bp->active_components[$sr_notifications_test_slug]);
and this is the error I have: (still the same)
WordPress database error: [Table 'WP_db_funs.n' doesn't exist] SELECT * FROM n WHERE component_name IN ('activity') AND component_action IN ('my_test') AND is_new = 1 WordPress database error: [Incorrect table name ”] INSERT INTO (user_id,item_id,secondary_item_id,component_name,component_action,date_notified,is_new) VALUES (0,0,0,'activity','my_test','2015-08-12 15:57:21′,1)
Please if anybody Knows about this I will apreciate any help 🙁
Table ‘WP_db_funs.n’ doesn’t exist how come?? table n ??
August 11, 2015 at 9:36 pm #243060In reply to: [Resolved] Add Count Near Nav Menu
danbpParticipantI tested the snippet on Buddy theme, so i’m pretty sure you have a user menu. This menu is on WP’s Toolbar. You see it when you’re logged in.
To choose an item position, you have to do it differently, as explained here:
[Resolved] Position Notification Counter Bubble after Specific Navigation Tab ID
For more about menu handling and functions, see WP Codex, as this is not really related to BuddyPress. Now it’s your turn to work a little !
August 11, 2015 at 6:57 pm #243051In reply to: [Resolved] Add Count Near Nav Menu
gurselgunacarParticipant@danbp you are my hero. i tried to find this code for 2 weeks 🙂 you solved that. my theme doesnt contain user menu. So i need to add count of notification. Lastly how can we move this menu items left side of menu?
-
AuthorSearch Results