Community Support Forums — WordPress® ( Users Helping Users ) — 2011-12-10T20:27:26-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=16079 2011-12-10T20:27:26-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16079&p=56253#p56253 <![CDATA[Re: Can't restrict <!--more--> or anything before it]]>

By the way, if the link pointed to a page that the user doesn't have access to, that's when he's sent to the Membership Options page to sell him the access, or using conditionals to sell him the access in the very page he can't view. I guess this works fine for most and that's why the "more" link edit had not be asked about earlier.

Statistics: Posted by Cristián Lávaque — December 10th, 2011, 8:27 pm


]]>
2011-12-10T11:02:07-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16079&p=56208#p56208 <![CDATA[Re: Can't restrict <!--more--> or anything before it]]>
I'm surprised this issue did not surface earlier. Any sensible webmaster would want to avoid annoying low level members with a <more> link that leads them to unviewable/unauthorized material. In almost every circumstance I can think of, a friendly nag message should appear where a members privileges ends.

Statistics: Posted by ggandg — December 10th, 2011, 11:02 am


]]>
2011-12-09T11:27:02-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16079&p=56160#p56160 <![CDATA[Re: Can't restrict <!--more--> or anything before it]]> Thanks for the follow-up.
I understand the frustration, and I understand now what you're trying to accomplish.

Just to make a quick point. The <!--more--> tag can NEVER be inside content surrounded by a Shortcode. It's not an s2Member thing, it's related to what I mentioned earlier about WordPress. Breaking content apart inside a Shortcode with the <!--more--> tag will always result in a broken Shortcode.

Now, I think I understand what you're trying to accomplish. You want to make sure the "continue reading..." link is NOT presented in certain cases; and there is a way to accomplish this with WordPress®.


The usual method does not allow this:
Code:
This is the excerpt.
<!--more-->
This is after the more tag.
WordPress will convert <!--more--> into a clickable hyperlink, leading a visitor to the rest of the Post ( i.e. what comes after the <!--more--> tag. )


The more advanced way:
If you look at the documentation here: http://codex.wordpress.org/Customizing_ ... _each_post
You will find that it's also possible to supply your own text for the <!--more--> tag like this:
Code:
This is the excerpt.
<!--more Continue Reading... -->
This is after the more tag.
So now the link will say: "Continue Reading...", or whatever you specify.


Forcing WordPress® NOT to provide a link to the remaining content:
Code:
This is the excerpt.
<!--more -->
This is after the more tag.
Notice the single space here? It tells WordPress® NOT to link to the remaining content ( i.e. there is no more link, nothing for it to say ).


Taking this a step further with s2Member's [s2If /] Conditionals:
Code:
This is the excerpt.
<!--more [s2If current_user_can(access_s2member_level1)]continue reading...[/s2If][s2If current_user_cannot(access_s2member_level1)][/s2If] -->
This is after the more tag.
If they have Level#1 access, we show "continue reading...". If not, we show nothing.


If you're going to do this repeatedly. You might grab this plugin and create a Quicktag to insert this into your Posts automatically. See: http://wordpress.org/extend/plugins/add ... reenshots/

Statistics: Posted by Jason Caldwell — December 9th, 2011, 11:27 am


]]>
2011-12-09T10:33:13-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16079&p=56157#p56157 <![CDATA[Re: Can't restrict <!--more--> or anything before it]]>
Here is what I think you may be missing...

The desired output/flow is this:
Non-logged in users get ABC "You must be logged in to access the rest of this post"
Logged in users get ABC DEF "Read the rest of this post" GHI

In my code, a non-logged in user NEVER gets as far as the <!--more--> link and instead gets a nag message "Log in to access the rest of this post".

ABC [s2If current_user_can(access_s2member_level0)] DEF <!--more--> GHI [/s2If]
[s2If !current_user_can(access_s2member_level0)] You must register and log in to access the rest of this post. [/s2If]

In your code, a non-logged in user ALWAYS gets the <!--more--> link, even though it would lead him to the full post, which is restricted to him (don't forget GHI is restricted).

ABC [s2If current_user_can(access_s2member_level0)]DEF[/s2If] <!--more--> GHI

Here is the problem... it's not a matter of the placement of the <!--more--> tag. If <!--more--> can't be restricted, then it will ALWAYS appear where it is placed, and it will essentially function as a dead link for unauthorized users because the full post is restricted to them. Users should get a nag message at the point in a post where their privileges end, not "Read the rest of this post..." which leads them to the full post which they are unauthorized to view.

How can you possibly get the output/flow shown below without being able to restrict "DEF <!--more--> GHI" as a whole?

Non-logged in users get ABC "You must be logged in to access the rest of this post"
Logged in users get ABC DEF "Read the rest of this post" GHI

Statistics: Posted by ggandg — December 9th, 2011, 10:33 am


]]>
2011-11-30T17:20:31-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16079&p=54259#p54259 <![CDATA[Re: Can't restrict <!--more--> or anything before it]]> ~ Please let me know if this makes sense or not.

First off, this is incorrect with ANY type of Shortcode in WordPress:
Code:
ABC [s2If current_user_can(access_s2member_level0)] DEF <!--more--> GHI [/s2If]

The <!--more--> tag is a separating marker between your Excerpt and the remaining content after your Excerpt. So placing a <!--more--> tag into your content means that you are breaking this content apart into two separate chunks of data for WordPress to use in different ways.

In any Archive View, WordPress will look at these two chunks separately ( which is bad in this case ).
Code:
ABC [s2If current_user_can(access_s2member_level0)] DEF
Code:
GHI [/s2If]
So your Shortcode Conditional is left broken ( i.e. the Shortcode is incomplete ) when these chunks are separated. It will only work as intended, when the full content body is parsed together as one piece, not when it is separated.

So instead, you should do something like this.
Code:
ABC [s2If current_user_can(access_s2member_level0)]DEF[/s2If] <!--more--> GHI

As I see it, this is not a bug. Rather, it has to do with your placement of the <!--more--> tag. Just remember to structure your content so that WordPress can make sense of each section independently, when it needs to ( i.e. in any Archive View ).

Statistics: Posted by Jason Caldwell — November 30th, 2011, 5:20 pm


]]>
2011-11-29T03:10:50-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16079&p=54172#p54172 <![CDATA[Re: Can't restrict <!--more--> or anything before it]]> Statistics: Posted by Cristián Lávaque — November 29th, 2011, 3:10 am


]]>
2011-11-28T05:44:56-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16079&p=54066#p54066 <![CDATA[Re: Can't restrict <!--more--> or anything before it]]>
The problem with your suggestion above is that non-logged in users will get "ABC Read the rest of this post...".

I don't want non-logged in users (or alternatively, low level members) to ever get as far as the link generated by <!--more-->. I want non-logged in users to get "ABC You must register and log in to read the rest of this post." and I want logged in users to get "ABC DEF Read the rest of this post... GHI"

I use the code below to generate a "login nag message" for non-logged in users and to control my blog posts:

ABC [s2If current_user_can(access_s2member_level0)] DEF <!--more--> GHI [/s2If]
[s2If !current_user_can(access_s2member_level0)] You must register and log in to access the rest of this post. [/s2If]

Here is the big problem as stated previously: Non-logged in users get "ABC DEF Read the rest of this post..." instead of "ABC You must register and log in to access the rest of this post."

When non-logged in users click the <!--more--> link or individual post link and are directed to the corresponding single post (example mysite.com/blogpostnumber220/#-more220 or mysite.com/blogpostnumber220) they actually get "ABC You must register and log in to access the rest of this post." which is what they should have gotten in the first place! So... it's critical for Jason to know this problem occurs on my homepage/main blog page (WP->Options->Reading is set to "Your latest posts"). Archive pages and blog pages also suffer from the <!--more--> problem. Only single posts restrict things properly because Wordpress does not generate <!--more--> links on single posts.

I'm surprised the <!--more--> problem hasn't come up sooner. To me, it's a major problem and seems like a potential a security issue since it definitely breaks any shortcode restrictions placed around it (except on single posts). Please let me know what Jason says about this. FYI I'm running WP 3.2.1 with BP 1.5.1 and the problem appears identical in both Firefox and IE. Thanks in advance!

Statistics: Posted by ggandg — November 28th, 2011, 5:44 am


]]>
2011-11-27T19:30:54-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16079&p=54015#p54015 <![CDATA[Re: Can't restrict <!--more--> or anything before it]]>
In the meantime, have you tried this?

Code:
[s2If current_user_can(access_s2member_level0)] DEF [/s2If]
<!--more-->
[s2If current_user_can(access_s2member_level0)] GHI [/s2If]


Also, what are your settings for alt. views? WP Admin -> s2Member -> Restriction Options -> Alt. Views
http://www.s2member.com/content-restric ... ble-video/

Let me know if it helps.

Statistics: Posted by Cristián Lávaque — November 27th, 2011, 7:30 pm


]]>
2011-11-27T11:12:31-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16079&p=53968#p53968 <![CDATA[Can't restrict <!--more--> or anything before it]]>
ABC [s2If current_user_can(access_s2member_level0)] DEF <!--more--> GHI [/s2If]

I've noticed this returns "ABC DEF Read the rest of this post..." for non-logged in users. If I remove <!--more--> non-logged in users get only ABC.

Why is <!--more--> breaking any restrictions before and including the <!--more--> itself? "More" is critically important for controlling long posts and it's also a good point to start restricting content. I want place various restrictions immediately before <!--more--> but they don't have any effect. Is there a work-around or am I missing something??

Statistics: Posted by ggandg — November 27th, 2011, 11:12 am


]]>