Support » Plugin: WP Notification Bell » Add notifications programmatically

  • Resolved eelatfy

    (@eelatfy)


    How to create custom notifications using code, any hook, or filters to add notifications?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author wpdever

    (@wpdever)

    Hi,

    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 them

    wnbell_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

    Hi,

    Are there any examples of this?

    Plugin Author wpdever

    (@wpdever)

    Hi,

    There are no examples, but you can check the includes/buddypress.php or includes/bbpress.php files in the plugin for an idea on how to save the notification.

    efinst0rm

    (@efinst0rm)

    Hi,

    Thank you! I was able to get it working on my end. Is there a hook for wnbell_notification_list_menu / wnbell_notification_list. Since I have to edit menu_bell.php and shortcode.php to get the custom notification to appear in the drop down.

    Thanks

    Plugin Author wpdever

    (@wpdever)

    Hi,

    This hook “wnbell_user_notifications_output” should be enough to get your notification to appear in the box. That’s the one I use for the addons and it’s in both the shortcode.php and outputs.php files.

    It would be better to start a new topic if you need anything else, just in case the original poster keeps getting email notifications for every reply here.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.