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

Function Reference: wlmapi_the_level_members

Retrieves all members of the specified level passed through the filter: wlmapi_the_level_members. If no filter is applied, this function will return the unfiltered array, i.e. the same output as wlmapi_get_level_members.

Parameters

  • level_id (int) – The ID of the level to retrieve members from

Return

Returns a string containing the filtered list.

Example Code

<?php
     //On the page displaying the list
     $members = wlmapi_the_level_members(1340726008);
     print_r($members);

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

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

          return $output;
     }

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

Example Output

Notes

This functions returns WLMAPIMethods::the_level_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