original_string: public static function count_unread_popup_notifications($useridto = 0) {
          global $USER, $DB;
  
          if (empty($useridto)) {
              $useridto = $USER->id;
          }
  
          return $DB->count_records_sql(
              "SELECT count(id)
                 FROM {notifications}
                WHERE id IN (SELECT notificationid FROM {message_popup_notifications})
                  AND useridto = ?
                  AND timeread is NULL",
              [$useridto]
          );
      }
code: public static function count_unread_popup_notifications($useridto = 0) {
          global $USER, $DB;
  
          if (empty($useridto)) {
              $useridto = $USER->id;
          }
  
          return $DB->count_records_sql(
              "SELECT count(id)
                 FROM {notifications}
                WHERE id IN (SELECT notificationid FROM {message_popup_notifications})
                  AND useridto = ?
                  AND timeread is NULL",
              [$useridto]
          );
      }
code_tokens: public static function count_unread_popup_notifications ( $ useridto = 0 ) { global $ USER , $ DB ; if ( empty ( $ useridto ) ) { $ useridto = $ USER -> id ; } return $ DB -> count_records_sql ( "SELECT count(id)
                 FROM {notifications}
                WHERE id IN (SELECT notificationid FROM {message_popup_notifications})
                  AND useridto = ?
                  AND timeread is NULL" , [ $ useridto ] ) ; }
docstring: Count the unread notifications for a user.
  
  @param int $useridto the user id who received the notification
  @return int count of the unread notifications
  @since 3.2
docstring_tokens: Count the unread notifications for a user .