• Hi,

    I have a custom post type that has restrictions set for certain user roles, but the page also has a sidebar from which I want to hide certain content, based on the settings for that page. I want to control this within the (sidebar) template for this post.

    I thought I could use wpmem_get_block_setting() to check the restriction settings, but this returns an ‘undefined function’ error.

    Any suggestions on how to do this?

    Thanks in advance,

    Tibor

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    You could use the following:
    $result = get_post_meta( $post_id, '_wpmem_block', true );

    $result will be:
    0 : not restricted
    1 : restricted
    2 : hidden

    Here’s the tl;dr detail/background:

    Currently, the plugin actually loads hooked to after_setup_theme. That’s why you get an undefined error. The primary reason for the late load is a legacy issue. Long ago, it was done so that plugin users could define pluggable functions for the plugin in the theme functions.php file, so it needed to load after those would be defined. While pluggable functions still exist in the plugin (as they do in WordPress), they are no longer “officially” supported/recommended. At some point, I’ll likely move that hook up to process earlier so that the full API is available in the theme; but I need to do an impact study first (primarily concerned about other unintended issues OTHER than breaking plugged functions in the functions.php file).

    Thread Starter Tibor Paulsch

    (@tibor)

    Ah, that makes sense ?? Thanks for the quick response!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Check which page restrictions are set’ is closed to new replies.