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

Function Reference: wlmapi_add_member_to_level

Adds a member to a membership level according to the specified arguments.

Parameters

  • level_id (int) – The ID of the level to add the member to
  • args (array) – An array of accepted arguments specified below:
Parameter Description Required Default
Users (array) An array of member IDs to add to the level Required
Cancelled (boolean) Cancellation status for the new member Optional false
CancelDate (int) Unix timestamp of scheduled cancellation date Optional
Pending (boolean) True to require admin approval Optional false
UnConfirmed (boolean) True to require email confirmation Optional false
Timestamp (int) Unix timestamp user was added to level Optional time()
TxnID (string) The transaction ID Optional auto-generated

Return

Returns a multi-dimensional array containing operation status and an array containing all members of the specified level.

Example Code

<?php
     $args = array(
          'Users' => array(11),
          'Pending' => true
     );
     $members = wlmapi_add_member_to_level(1340726008, $args);
     print_r($members);
?>

Example Output

Array
(
    [success] => 1
    [members] => Array
        (
            [member] => Array
                (
                    [0] => Array
                        (
                            [id] => 11
                            [user_login] => wray
                            [user_email] => johnismyhero@wlptest.com
                            [_more_] => /levels/1340726008/members/11
                        )

                    [1] => Array
                        (
                            [id] => 12
                            [user_login] => stu
                            [user_email] => iagreejohnistheman@wlptest.com
                            [_more_] => /levels/1340726008/members/12
                        )

                )

        )

    [supported_verbs] => Array
        (
            [0] => GET
            [1] => POST
        )

)

Notes

This functions returns WLMAPIMethods::add_member_to_level($level_id, $args) 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