original_string: public static function get_potential_subscribers($context, $groupid, $fields, $sort = '') {
          global $DB;
  
          // Only active enrolled users or everybody on the frontpage.
          list($esql, $params) = get_enrolled_sql($context, 'mod/forum:allowforcesubscribe', $groupid, true);
          if (!$sort) {
              list($sort, $sortparams) = users_order_by_sql('u');
              $params = array_merge($params, $sortparams);
          }
  
          $sql = "SELECT $fields
                  FROM {user} u
                  JOIN ($esql) je ON je.id = u.id
              ORDER BY $sort";
  
          return $DB->get_records_sql($sql, $params);
      }
code: public static function get_potential_subscribers($context, $groupid, $fields, $sort = '') {
          global $DB;
  
          // Only active enrolled users or everybody on the frontpage.
          list($esql, $params) = get_enrolled_sql($context, 'mod/forum:allowforcesubscribe', $groupid, true);
          if (!$sort) {
              list($sort, $sortparams) = users_order_by_sql('u');
              $params = array_merge($params, $sortparams);
          }
  
          $sql = "SELECT $fields
                  FROM {user} u
                  JOIN ($esql) je ON je.id = u.id
              ORDER BY $sort";
  
          return $DB->get_records_sql($sql, $params);
      }
code_tokens: public static function get_potential_subscribers ( $ context , $ groupid , $ fields , $ sort = '' ) { global $ DB ; // Only active enrolled users or everybody on the frontpage. list ( $ esql , $ params ) = get_enrolled_sql ( $ context , 'mod/forum:allowforcesubscribe' , $ groupid , true ) ; if ( ! $ sort ) { list ( $ sort , $ sortparams ) = users_order_by_sql ( 'u' ) ; $ params = array_merge ( $ params , $ sortparams ) ; } $ sql = "SELECT $fields
                  FROM {user} u
                  JOIN ($esql) je ON je.id = u.id
              ORDER BY $sort" ; return $ DB -> get_records_sql ( $ sql , $ params ) ; }
docstring: Get the list of potential subscribers to a forum.
  
  @param context_module $context the forum context.
  @param integer $groupid the id of a group, or 0 for all groups.
  @param string $fields the list of fields to return for each user. As for get_users_by_capability.
  @param string $sort sort order. As for get_users_by_capability.
  @return array list of users.
docstring_tokens: Get the list of potential subscribers to a forum .