latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

API/Scripting question

Home Forums Community Forum API/Scripting question

This topic contains 19 replies, has 3 voices. Last updated by  Cristián Lávaque 4 years, 6 months ago.

Topic Author Topic
Posted: Tuesday Jun 12th, 2012 at 11:38 pm #16334

I have been studying on the API/Scripting possibilities.
I could not really find what I am looking for so I wonder if you people could help me out.
On my site I have two types of posts, one type is without access restrictions, the other type is for level 1 only (paying subscribers).

Is there a way, using the s2member shortcodes, to display either one of them?
the next step would be to distinct between categories (I have several languages I support on my site)

List Of Topic Replies

Viewing 19 replies - 1 through 19 (of 19 total)
Author Replies
Author Replies
Posted: Wednesday Jun 13th, 2012 at 9:15 am #16379
Raam Dev
Username: Raam
Staff Member

Hi Boudewijn,

I don’t understand what you mean by “Is there a way, using the s2member shortcodes, to display either one of them?”. Could you please elaborate and/or provide examples?

Posted: Wednesday Jun 13th, 2012 at 2:11 pm #16391

sure,

If you browse to http://reikimagazine-online.com/free-english-articles/
You will see some articles that everybody can read

Going to http://reikimagazine-online.com/paid-articles/
you will see articles that are only accessible for paying subscribers.

The first two don’t have a level restriction, the articles on the second link have a restriction for level 1
What I don’t like about either one is that they both only display the permalink.
(same goes for “Nederlands”)

What I would like is that non paying members (those that cannot log in, because they don’t have passwords etc) can only see the free articles.
Those that log in can see all articles. That way I can get rid of the “for paying customers only” page.

I hope this is clear for you Raam.

Posted: Thursday Jun 14th, 2012 at 7:25 am #16440

I’m still not sure I understand. Do you want to have in the same posts page, a mix of paid and free articles? So that visitors can read the free ones, but the paid ones would take them to the Membership Options page?

Posted: Thursday Jun 14th, 2012 at 9:44 am #16476

You made me think Christian, thanks for the wake-up call.
What I actually want is to keep those two pages, however, I want the text to be displayed as well… up to the More– tag. Right now I can only display the permalink to the pages.
I did find the query_posts() function but it looks like this is taking forever to load the page.
Not unlikely I am doing something wrong, unfamiliar with PHP. Here is the code, using the code insert manager, i run this code just before the content is displayed, with the restriction that the content is never displaying:

<?php
attach_s2member_query_filters();
    query_posts("cat_name=closed_ENG");

    if (have_posts()):
        while (have_posts()):
            the_post();
        /*
        Protected content will be excluded automatically.
        ( based on the current User/Member status )
        */
        endwhile;
    endif;

    wp_reset_query();
detach_s2member_query_filters();
?>
Posted: Friday Jun 15th, 2012 at 6:26 am #16558

Okay, so you want posts protected, to not be in the posts list at all, or do you want them to be there showing up to the “more” tag only?

What are your settings for the Alt. View protection? [hilite path]Dashboard -› s2Member® -› Restriction Options -› Alternative View Protection[/hilite]

Posted: Friday Jun 15th, 2012 at 11:28 am #16597

I want posts to show up to the more– tag. I have nothing set in the alternative view protection.

Posted: Saturday Jun 16th, 2012 at 3:49 am #16648

That’s fine then. Try this:

Edit your latest post and protect it at level 0 or higher, use the “more” tag, save and log out. Then go to your homepage or the category where the post will be, and you should see the post’s title and the content up to the “more” tag, click the link to “continue reading” and you’ll be taken to the Membership Options Page.

Posted: Monday Jun 18th, 2012 at 2:24 am #16754

Are you saying that the above code is correct then?
The page takes forever to load, and once loaded shows nothing.
(FYI, the ‘closed_ENG’ are all English posts with level 1 protection).

This is not going to be easy so it seems.

Posted: Tuesday Jun 19th, 2012 at 5:20 am #16851

No, I wasn’t talking about the code, I was replying to:

I want posts to show up to the more– tag. I have nothing set in the alternative view protection.

Posted: Thursday Jun 21st, 2012 at 11:02 am #17134

I do know how to use the more tag Cristian,

If you look at the links I gave before you see now only the permalinks.
What I want is to show the post text up to the more tag.
The text before the more tag is a kind of teaser. I want that showing on my pages.

Posted: Friday Jun 22nd, 2012 at 7:04 am #17178

If you don’t have the Alt View restrictions active, then the post should be shown in the posts listing (category, tag, homepage), with the content up to the “more” tag (the teaser snippet).

If that’s not what is happening, could you create a test category, in it create a test post restricted at Level 0 with some content and the more tag, and post here the link to the category, please?

Thanks!

Posted: Tuesday Jun 26th, 2012 at 7:43 am #17522

Cristian.

If you goto http://www.reikimagazine-online.com you will see the articles with their excerpts.
Following the links in my reply to Raam you see the other pages, they only show the permalink.
( like this one: http://reikimagazine-online.com/paid-articles/)
I would like those pages to show the excerpt as well.

What I need is a hint how to use PHP code on other pages besides the page that displays the text preceding the “more” tag, that is the only question.
I want the posts, related to that page to display the excerpt as it is created by using the more tag.

Posted: Wednesday Jun 27th, 2012 at 12:27 am #17618

Is http://reikimagazine-online.com/paid-articles/ a category or a normal WP page?

Posted: Wednesday Jun 27th, 2012 at 1:46 am #17622

That is a page for a certain category of posts, being the posts that people are paying for…

Posted: Wednesday Jun 27th, 2012 at 1:56 am #17624

But is it a WordPress category or a WP page you use to list posts?

In which of these is it?
[hilite path]WP Admin -> Posts -> Categories[/hilite]
[hilite path]WP Admin -> Pages[/hilite]

Posted: Wednesday Jun 27th, 2012 at 6:00 am #17630

it is a page that is mapped to a certain category. I use “Map categories to pages” plug-in now with the result as seen on that page.
What I want is to display the content of the posts up to the more tag.
I tried the above code (message #16476) but that takes a lifetime to load, so I assume I do something wrong.

What I am loooking for is what I do wrong in that code (message #16476) and what I should do to correct it.
In teh above code I use

query_posts("cat_name=closed_ENG");

the category name is closed_ENG, I use case sensitivity because I found that many languages are case sensitive.
(Not that I see a use for that, but that is a totally different discussion)

Hoping I made myself clear now.

Posted: Thursday Jun 28th, 2012 at 5:51 am #17732
Raam Dev
Username: Raam
Staff Member

Boudewijn,

Have you seen the following thread? It explains how you can use the <!– more –> tag with s2Member: http://www.primothemes.com/forums/viewtopic.php?f=4&t=16079#p56160

Posted: Friday Jun 29th, 2012 at 9:59 am #17855

To you my Lord of the sacret s2Member knowledge I bow deep, take off my hat and most respectfully greet thou unchallenged knowledge. Teach us thou magic!
But nonetheless, it is not helping me much now. Even thios does NOT show the post to its more tag.
Am I asking the impossible?
ALL i want is to know how I can show posts (WITH THE –MORE– TAG) on a page. This is the 17th or 18th reply in this thread but I still have no answer.

Posted: Saturday Jun 30th, 2012 at 4:10 am #17914

ALL i want is to know how I can show posts (WITH THE –MORE– TAG) on a page. This is the 17th or 18th reply in this thread but I still have no answer.

Sorry, that statement bothered me a bit. What you are trying to do wasn’t clear until you explained it a couple posts earlier #17630. And we aren’t required to provide custom code for something like this, it’s not even an s2Member customization. s2Member® » Support Policy » Fine Lines

You could google how to list category posts, or looked at the category.php template in your theme for clues. You don’t need to worry about s2Member filters since you want the posts listed even if they’re protected, and will only show content up to the “more” tag if you used it. The protection will kick in if they try to open the actual post.

You obviously did some of that research to get the loop code, but you seem to still need [hilite mono]the_content()[/hilite] there to display the content of [hilite mono]the_post()[/hilite]. I had never done this before, just looked it up in the WP codex, so I apologize if you still need to research it a bit more, but I hope it helps.

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

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.