Skip to:
Content
Pages
Categories
Search
Top
Bottom

Problem with bp_notifications_get_notifications_for_user


  • salvatore77
    Participant

    @salvatore77

    I need to get all notifications for a user, programmatically. I have used bp_notifications_get_notifications_for_user, but with this function i get only unread notications, why? I need to have all notifications, read and unread

Viewing 1 replies (of 1 total)

  • shanebp
    Moderator

    @shanebp

    That’s because the function makes a call to another function that calls a class function that has a param that defaults to ‘only new’.

    Open: buddypress\bp-notifications\classes\class-bp-notifications-notification.php
    and look at the args for public static function get( $args = array() )

    Untested, but try:

    $notifications = BP_Notifications_Notification::get( array( 
    	'user_id' => get_current_user_id(),
    	'is_new'  => 'both'				
    ) );
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar