Function Reference: wlmapi_the_level

Displays data for the specified membership level passed through the filter: wlmapi_the_level. If no filter is applied, this function will return the unfiltered array, i.e. the same output as wlmapi_get_level.

Parameters

  • level_id (int) – The ID of the level to display

Return

Returns a string containing the filtered data.

Example Code

<?php
     function filter_level($level) {
          //Navigate down to the levels array
          $level_array = $level['level'];

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

          //Loop through levels to get level name
          foreach ( $level_array as $k=>$level ) {
               if ( $k != '_more_' ){
                    $output .= '<li>' . ucwords(
                              str_replace('_', ' ', $k)
                         ) . ': ' . $level . '</li>';
               }
          }

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

          return $output;
     }

     add_filter('wlmapi_the_level', 'filter_level');
?>

Example Output

  • Id: 1340726008
  • Name: Test Level 1
  • Registration Url: bjkpz8
  • After Login Redirect: global
  • After Registration Redirect: global
  • Access All Pages: 0
  • Access All Categories: 0
  • Access All Posts: 0
  • Access All Comments: 0
  • No Expiry: 1
  • Expiry:
  • Expiry Period:
  • Sequential Upgrade To:
  • Sequential Upgrade After:
  • Sequential Upgrade Method:
  • Member Count: 3
  • Require Captcha: 0
  • Require Email Confirmation: 0
  • Require Admin Approval: 0
  • Grant Continued Access: 0
  • Disable Existing Users Link: 0
  • Registration Date Reset: 0
  • Uncancel On Registration: 0
  • WordPress Role: subscriber
  • Level Order:
  • Remove From Levels:

Notes

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