Function Reference: wlmapi_manage_post

Protects posts and adds them to the membership level.

Parameters

  • level_id (int) – The ID of the level to add posts to
  • post_ids (int) – Accepts an array or comma-seprated list of post IDs

Return

Returns a multi-dimensional array containing operation status and an array containing data for all posts that belong to the specified level.

Example Code

<?php
     $posts = wlmapi_manage_post(1340726008, '1,60,62');
     print_r($posts);
?>

Example Output

Array
(
    [success] => 1
    [posts] => Array
        (
            [post] => Array
                (
                    [0] => Array
                        (
                            [ID] => 1
                            [name] => Hello world!
                            [_more_] => /levels/1340726008/posts/1
                        )

                    [1] => Array
                        (
                            [ID] => 96
                            [name] => Auto Reg
                            [_more_] => /levels/1340726008/posts/96
                        )

                    [2] => Array
                        (
                            [ID] => 62
                            [name] => Another Post with Everything In It 
                            [_more_] => /levels/1340726008/posts/62
                        )

                    [3] => Array
                        (
                            [ID] => 60
                            [name] => An Ordered List Post
                            [_more_] => /levels/1340726008/posts/60
                        )

                )

        )

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

)

Notes

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

,