1. Home
  2. API
  3. Function Reference
  4. 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

  • 11
  • wray
  • johnismyhero@wlptest.com
  • 12
  • stu
  • iagreejohnistheman@wlptest.com

Notes

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

Updated on August 14, 2020

Was this article helpful?

Related Articles

Not the solution you were looking for?
Click the link below to submit a support ticket
Submit Ticket