Show unlock post message to logged out users

Hi there,

I can’t seem to find the answer anywhere. All I want to do is restrict part of a post and then when users scroll down to read the full post they get the following:

“This post requires premium membership or free membership. Please login or register to continue reading.”

Then there is a username and password login box/register button with captcha.

Once the user logs in this message disappear and they can see the full post.

What shortcode can I use?

Thanks in advance!

Hi Andrew.

Yes, you can do that. Use a conditional, where if the user isn’t logged in he gets the login box (you can use the s2Member-Login shortcode, or use some other plugin’s shortcode, or your own code to add this login form), and if the person is logged in, show the content.

See:

I hope that helps! :slight_smile:

Thanks Christian, I was looking in the conditional section of the KBs but it seems a bit over my head.

I see now that I can modify the title/message on the login pro-form. What I don’t really understand how to do is mix together the login shortcode with the conditional.

Is there a guide for mixing them together or does one sit within the [] of the other?

Hi Christian, I think I worked it out after playing around with it.

One question. Can you wrap this login code into a box? Can you have a title and then sub-hesding text?

What do you mean by a box and title and subheading? For the login box? Do you have an example of what you have in mind?

Here is an example. I would like to wrap everything in a box and have a heading and then some text under it. This would obviously disappear after logging in.

Any limitations to use CSS? Also, s2M allows the usual WP login page to be styled.

I styled the login page, it looks good.

This is a login box to insert into posts.

I have no experience with CSS but I can ask my designer to do it.