wpdever
Forum Replies Created
-
Forum: Plugins
In reply to: [WP Notification Bell] Post Category NotificationsHi,
To create notifications for posts in certain categories only, you can add this to your theme’s functions.php file:
add_filter('wnbell_restrict_post_term','restrict_post_category',10,2); function restrict_post_category($allowed, $post_id){ $categories = array('Some category', 'Another category'); $post_categories = wp_get_post_categories( $post_id, array('fields' => 'ids') ); $allowed = false; foreach($categories as $category){ $cat_id = get_cat_ID($category); if(!$cat_id) continue; if(in_array($cat_id,$post_categories)){ $allowed=true; break; } } return $allowed; }and replace this with your categories:
$categories = array(‘Some category’, ‘Another category’);For the custom post types, I’m not sure what you mean. I can’t test with this theme but let me know if there’s something I should fix.
Forum: Plugins
In reply to: [WP Notification Bell] Call from unrelated theme buttonHi,
If you only need to add the notifications for logged-in users, you can add this next to your button:
<span class="wnbell-count-menu" id="wnbell-count-menu-id"></span> <?php wnbell_menu_script( 600000 ); // interval is 600 seconds ?> <div class="wnbell-dropdown-menu-wrap" id="wnbell-dropdown-menu-wrap-id"> <div class="your_class" > <div class="wnbell-spinner-wrap-menu"> <span class="wnbell-spinner-menu"></span> </div> <div class="wnbell-dropdown-menu" id="wnbell-dropdown-menu-id"></div> </div></div>Forum: Plugins
In reply to: [WP Notification Bell] Add notifications programmaticallyHi,
When the custom action is triggered, you can store it in a new table or in an array in the user_meta table and use this function wnbell_update_user_count( $user_id ) to increment the notification count.
To see this notification in the box, you can use these filter hooks:
wnbell_user_notifications_array : to sort the notifications with the other user notifications before outputting themwnbell_user_notifications_output : returns the html output of a notification item you’ll see in the notification box
To change the css for seen notifications, you can use these hooks:
wnbell_add_unseen : when a user clicks on a notification, you can add its id to an array of viewed notifications
wnbell_seen_data : to get the array of viewed notifications id for a particular user to use for the output
Forum: Plugins
In reply to: [WP Notification Bell] Customize Date DisplayHi,
You can create a new placeholder with this hook ‘wnbell_content_placeholder’. For your case, you can add this to your theme’s functions.php file:
add_filter('wnbell_content_placeholders', 'add_new_date_format', 10, 2); function add_new_date_format($to_replace, $post_id) { $new_post = get_post_meta($post_id, "post_id", true); $to_replace['{{my_date}}'] = get_the_date('M. j, Y', $post_id); return $to_replace; }Then, in Settings->Notification item, replace {{date}} with {{my_date}}.
Forum: Plugins
In reply to: [WP Notification Bell] Feature RequestHi,
I’ll consider adding it in the future. If you need it urgently, you can look at the includes/menu_bell.php file (line 175 to 247) to find how to fetch different types of notifications. On the buddypress plugin side, to modify the menu bar, you can use this filter ‘bp_core_get_notifications_for_user’.
Thanks for the suggestion and I’ll try to look more into but it probably won’t be before next month or later.Forum: Plugins
In reply to: [WP Notification Bell] Bought a premium addon i did not receiveHi,
I’ll mark this as resolved since the issue is fixed.
If anyone has a similar problem, if you log in to your freemius account with the email and password provided in the email you received, you should be able to find the download link in the ‘Downloads’ page.Forum: Plugins
In reply to: [WP Notification Bell] couple of bugsHi,
Thanks for reaching out. I just released an update with the option to add a title to notifications to manage them.
For the css class and id, they’re empty unless you add them in Settings->Notification item, you can check out this option here.
Users should normally be able to see recently added posts notifications. But they can’t see notifications on posts that were published before the plugin activation or when the “Enable new post notification” is unchecked. You can update the last few posts with the option checked to create notifications.
Let me know if you have any other question or suggestion.
Forum: Plugins
In reply to: [WP Notification Bell] Notification Container WidthIf it’s only to change the width, that’s indeed the class. If you’d like to change all the css for the box, you can add a css class or id name in Drop-down box under Settings->General:
Forum: Plugins
In reply to: [WP Notification Bell] Hide Visited NotificationsHi, in that case, you can try this in your theme’s functions.php file (or in a custom plugin):
add_filter("wnbell_notification_conditions", "add_notification_conditions"); function add_notification_conditions() { $condition = ""; $current_user_id = get_current_user_id(); $seen_posts = get_user_meta($current_user_id, 'wnbell_seen_notification_post', true); if (!$seen_posts) { return $condition; } $condition = "AND posts.ID NOT IN(" . wnbell_escape_array($seen_posts) . ")"; return $condition; }Forum: Plugins
In reply to: [WP Notification Bell] Hide Visited NotificationsHi,
Which type of notifications would you like to hide? If it’s notifications created manually, posts or cpts notifications, you can use this filter hook in your theme’s functions.php file: wnbell_notification_conditions to exclude seen notifications.
If it’s user notifications, you can delete seen notifications by adding this to your theme’s functions.php:
add_action(‘wnbell_add_unseen’, ‘delete_seen_callback’,11,1);
function delete_seen_callback($notification_id){
$current_user_id = get_current_user_id();
$user_meta_field = ‘wnbell_unseen_comments’;
$unseen_array = get_user_meta($current_user_id, $user_meta_field, true);
if (!$unseen_array) {
$unseen_array=array();
}
foreach($unseen_array as $key=>$notification){
if($notification[‘type’]===’cfc’ && $notification[‘comment_id’]==$notification_id){
//unset
unset($unseen_array[$key]);
}
}
update_user_meta($current_user_id, ‘wnbell_unseen_comments’, $unseen_array);}
This applies only to comment replies notifications, it needs slight changes for the other user notifications so let me know which type of notifications you’re using.
Hi,
Does it happen when you enable the BuddyPress notifications option or with other types of notifications as well?
I’m unable to replicate this issue so it would help if you can contact me here: [email protected] to see where it’s coming from.Forum: Plugins
In reply to: [WP Notification Bell] Error 500 : admin-ajax.php errorHi,
I just released an update that may fix the issue. You can test it out and let me know if you still have the same problem.
Forum: Plugins
In reply to: [WP Notification Bell] Error 500 : admin-ajax.php errorHi,
Do you still have this problem even after uninstalling and installing the latest version?
If you’re using the logged-in bell, you can contact me here: [email protected] with how to access the website so I can look into it.Forum: Plugins
In reply to: [WP Notification Bell] How to delete “new reply comment notification” ?Hi,
The plugin only stores the last 20 comment notifications. Any older comment is deleted automatically.
There is no easy way to delete notifications automatically after 7 days, but if you’d like a delete button next to each notification, there are hooks to helps you achieve that. I’ve recently made something similar for the asgaros addon, so if you’d like me to send you the code for it, just let me know here: [email protected]
Forum: Plugins
In reply to: [WP Notification Bell] Change iconGreat! You’re welcome!