Select Page

Divi Protect and post_password_required

Home Forums Feature Requests Divi Protect and post_password_required

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • Helpful
    Up
    0
    Down
    Not Helpful

    Hello,

    Is there a similar function to the WP built-in function post_password_required to test if a person has logged in to view the password protect content?

    Helpful
    Up
    0
    Down
    Not Helpful

    Are you wanting the ability for people who are logged in to view the content without having to enter a password?

    Helpful
    Up
    0
    Down
    Not Helpful

    Hello, no that’s not what I’m wanting.

    By logged in I meant that the password protected content password has been entered and the cookie set.

    I have a wrapper function in use on links that are output on the protected content, via a shortcode. That works great but I don’t want people to be able to share the link outside of having logged into the password protected content. But if they have the cookie set (the same condition as the WP built-in function) then the link will work.

    The way I’ve used the wrapper function in the past is to check that ( ! post_password_required() ), the link then works and a forced download is pushed to the browser. Otherwise a message is returned to state that they must log in to access the link.

    Helpful
    Up
    0
    Down
    Not Helpful

    I think this only works on password protected pages – as this is technically not a password protected page, it won’t work.

    Are these links on your website? I wonder if I could create the ability to “restrict” certain pages/posts on your website based on the protect section. So there will be an option to specify which pages can ONLY be seen if they have the cookie set on their browser.

    Would this work for you?

    Helpful
    Up
    0
    Down
    Not Helpful

    Yes that’s right, that function only works for password protected posts (via WordPress).

    Not “Restricting” certain pages/posts is the main reason I bought this plugin because it allows for all other content on the page to be visible. If you could create a function that, based on the post ID, returns true or false if the cookie is set for protect content then that would work.

    Helpful
    Up
    0
    Down
    Not Helpful

    based on what post ID – the one you also want to not show or the protect section ID?

    Pretty much if I create a function that checks if the cookie is set for the protect section and returns true or false – this would work for you?

    Helpful
    Up
    0
    Down
    Not Helpful

    The postID could be the page that has the protected postID or the protectedpostID (the protected content post). I can work with either.

    A function like that would be great!

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.