1. Home
  2. Knowledge Base
  3. API
  4. Function Reference
  5. Function Reference: wlmapi_the_members

Function Reference: wlmapi_the_members

Retrieves a list of all members passed through the filter: wlmapi_the_members. If no filter is applied, this function will return the unfiltered array, i.e. the same output as wlmapi_get_members.

Parameters

This function accepts no parameters.

Return

Returns a string containing the filtered list.

Example Code

<?php
     //On the page displaying the levels
     $members = wlmapi_the_members();
     echo $members;

     //In theme functions file or plugin
     function filter_members($members) {
          //Navigate down to the members array
          $members_array = $members['members']['member'];

          //Start output
          $output = '<ul>';

         //Loop through members to get member username and id
         foreach ( $members_array as $member ) {
              $output .= '<li>' . $member['id'] . '</li>';
              $output .= '<li>' . $member['user_login'] . '</li>';
         }

         //End output
         $output .= '</li>';

         return $output;
}

     add_filter('wlmapi_the_members', 'filter_members');
?>

Example Output

  • 1
  • localhost
  • 12
  • stu

Notes

This functions returns WLMAPIMethods::the_members() in core/api-helper/class-api-methods.php

Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support