• Resolved freedom667

    (@freedom667)


    I want to make a checkbox selects to a page. So, If a user does not has any levels, then all levels will showing to user. If user has a level, then the level will not showing to user. How can I do it?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter freedom667

    (@freedom667)

    any help?

    Plugin Author Joachim Jensen

    (@intoxstudio)

    It is currently not possible to get all levels via the PHP API, but I have noted this request down so it will be added in a future version.

    Since all levels are custom post types, you can use this snippet to get all levels

    $levels = get_posts([
        'numberposts' => -1,
        'post_type'   => 'restriction',
        'post_status' => [
            'publish'
        ],
    ]);

    and then use the PHP API to find out what levels a given user have: https://dev.institute/docs/restrict-user-access/developer-api/

    Thread Starter freedom667

    (@freedom667)

    giving this error:

    Warning: Illegal offset type in isset or empty wp-content/plugins/restrict-user-access/helpers/collection.phpon line76

    Plugin Author Joachim Jensen

    (@intoxstudio)

    That error message indicates that you are passing a wrong type somewhere, possibly a level object when it should be a level ID.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘What is PHP code of displaying level names?’ is closed to new replies.