Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter nasgaard

    (@nasgaard)

    Thanks very much for your response. I will rework my plugin using your suggested API.

    Thread Starter nasgaard

    (@nasgaard)

    @nwjames Thank you for your response. I have seen two issues which I think have the same fundamental cause. If I mark a document private, I cannot see the document, even if logged in as admin. Using a different plugin that provides access controls, if I restrict access to the document, even if public, it cannot be seen. It thinks I am not logged on.
    I have traced it to what I think is a setup issue when the post is being processed. In the second case the plugin adds the filter add_action( ‘template_redirect’, ‘rcp_redirect_from_premium_post’, 999 );. I have instrumented the first few lines of this function

    function rcp_redirect_from_premium_post() {
    global $rcp_options, $user_ID, $post, $wp_query;
    error_log(“In rcp_redirect_from_premium_post. user id is $user_ID, post is :” . print_r($post, TRUE));

    When I am attempting to display the document, $user_ID is always 0, therefore the code thinks no-one is logged on. If I observe this with any other post, including other custom post types, it gives me the ID of the logged on user.
    As I mentioned, this only occurs in my commercial hosting environment. On a local (RPi) server it works perfectly. I suspect it has something to do with the fact a document is a custom post, but I have no idea why. I was hoping this might jog a memory.

Viewing 2 replies - 1 through 2 (of 2 total)