original_string: public static function count_user_subscriptions($userid = 0) {
          global $DB, $USER;;
          if ($userid == 0) {
              $userid = $USER->id;
          }
          $sql = self::get_subscription_join_rule_sql(true);
          $sql .= "WHERE s.userid = :userid";
  
          return $DB->count_records_sql($sql, array('userid' => $userid));
      }
code: public static function count_user_subscriptions($userid = 0) {
          global $DB, $USER;;
          if ($userid == 0) {
              $userid = $USER->id;
          }
          $sql = self::get_subscription_join_rule_sql(true);
          $sql .= "WHERE s.userid = :userid";
  
          return $DB->count_records_sql($sql, array('userid' => $userid));
      }
code_tokens: public static function count_user_subscriptions ( $ userid = 0 ) { global $ DB , $ USER ; ; if ( $ userid == 0 ) { $ userid = $ USER -> id ; } $ sql = self :: get_subscription_join_rule_sql ( true ) ; $ sql .= "WHERE s.userid = :userid" ; return $ DB -> count_records_sql ( $ sql , array ( 'userid' => $ userid ) ) ; }
docstring: Get count of subscriptions for a given user.
  
  @param int $userid Id of the user for which the subscription needs to be fetched. Defaults to $USER;
  
  @return int number of subscriptions
docstring_tokens: Get count of subscriptions for a given user .