Can I show a certain number of characters of a post?

Divinum Fiat

Well-known member
Hi all, I'm having a bit of a challenge. I divided my forums into a 'free' and a 'paid' section just recently. And I understand that the 'paid' and now hidden section no longer gets picked up by Google. So visitors have dropped.

Is there a way to show a certain number of characters or words of the first post in each thread to 'free' members but then make the rest for 'upgraded' members only?

Right now I am showing the forum name and the thread title, but as soon as they click on the thread title it tells them that they must upgrade. I'd like them to see just a few sentences of the post before they make upgrade (and so that Google) can index that page.

Can this be done?
 
I don't have a test XenForo installation online to try it, but in the "post" template you might be able to create a conditional, such as:
Code:
<xen:if is="!{xen:helper ismemberof, $visitor, x}">
{xen:helper snippet, $message, 20}
<xen:else />
$message
</xen:if>

"If user isn't a member of x, show 20 words, else, show full message".

If I had a test install I'd try it myself!
 
Thank you both!

I think I had originally installed this, Borbole, and I really liked it. For some reason I can't find it in the add-on list anymore. So the quest is about the extra modification. Is it possible to have the add-on functioning in the 'free' forum and show x-number of sentences and have it work modified in the 'paid' forum where it also shows x-number of sentences (simply so Google can pick it up) but then as, James is saying, the full post would show to paying members and prompt guest and free members to upgrade? Not a script writer so don't know if the snippet above would work. If not, are you able to write a mod for your add-on?
 
Borbole, I installed the mod and I discovered that it does some funky thing of giving me an error page when there is a post with a poll. Your mod doesn't seem to work the moment there is a poll in the post, it won't even show the page but give an error page saying there is an internal configuration error (some white, blank page with black writing). I do quite a few polls in the free forum area, do you know of this being a problem and can it be fixed?
 
I managed to recreate this with a template edit:
<xen:if is="{$contentTemplate} == 'thread_view'">
<xen:if is="{$visitor.user_id}">{xen:raw $message.messageHtml}
<xen:else />
{xen:helper snippet, {xen:helper striphtml, $message.messageHtml}, 20}
</xen:if>
</xen:if>

You need to change the conditional (the first red part) to the group(s) you want to see the full message, such as: {xen:helper ismemberof, $visitor, x, y, z}.

You then need to change the 20 to the amount of characters you wish the other users to see.

This is in the message template by the way.
 
Thank you, James! I will try it although I'm not quite sure what to enter and I need to make sure the posts are not getting error messages that have polls. Right now when I enable the mod 'as is' it will give error messages and not even display the page. Let's see what Borbole says, then I'll get bold and try to insert your mod. You rock!!
 
Well, then something is messing with the polls. For example, I just re-activated the mod and set forum #23 as the test forum. The mod works for some of the posts but not others. Here are some that I get error messages for as a non-member, simply browsing as a guest.

this one does NOT have a poll but page still give "internal server error"

http://www.corefreedom.com/threads/how-to-love-how-to-forgive-hitler-and-animal-cruelty.691/

This one DOES have a poll and it also gives an "internal server error"

http://www.corefreedom.com/threads/is-love-a-feeling-a-choice-fate-or-something-else.682/

Also, is there a way to show only the first x-number of words of the FIRST post but not the answers also? As it is it shows x-number of posts on all subsequent answers also.
 
For the free forum it's fine if the answers or parts thereof, show. But for the paid forum I just want x-number of words showing so Google can pick up on the forums. But people should know that they need to be a paid member to see the full post. If I can achieve these 2 things then I'm happy.

But I still have the issue that some of the posts redirect to an internal server error page when the mod is active. As soon as I deactivate it, I can view it again as a guest.
 
Back
Top Bottom