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.

Different membership for different languages

Home Forums Community Forum Different membership for different languages

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

Topic Author Topic
Posted: Tuesday Jul 10th, 2012 at 11:41 am #18814
Nigel
Username: enquirer32

continued/…

I thought I had worked it out but something is wrong so would be grateful if you could suggest something:

I have 3 languages on my site – I want one of them to be free viewing – no login required or anything. The other two require a subscription. I am using the latest version of WP with qTranslate and the qTranslate slug plugin which also serves for translation of categories and tags. Basically each post is then entered in one window with tabs for each language for the post and excerpt, slug etc (but not tag or category which are set from their own admin pages).

I created a tag: english (English), which I also translated into french (french) and Chinese (Chinese). So if you are on the english language page you see the ‘english’ tag, on the french page you see the ‘french’ tag etc. Importantly you don’t see ‘english’ if you are on the ‘french’ page.

I then created a custom capability – ‘english’. I modified a user (‘testing user’) to include this cc in their profile – edit user>cc > english.

I edited a post to include the cc but without any other kind of restriction eg if the cc wasn’t there everyone should be able to read it. My intention was that the article in English would require membership and in Chinese, say it would not require anything.

These are the affects:

1. logged out user cannot see the post in english NOR can he view the post in French or Chinese even though their url is a little different e.g. english version mysite.com/2951/name of post/; french version mysite.com2951/nom de post/ etc and bearing in mind what I said about about where the tags appear/don’t appear.

2. logged in as ‘testing user’ can see the posts in all languages – OK, you would expect this since he has access to the English and the other two are ‘freeview’

3. logged in user without the specific cc can’t read the post in any of the languages – this is wrong. He should be able to read the French and Chinese as a minimum.

Any suggestions? Many thx. Just getting to grips with some more of this fantastic plugin’s capabilities.

List Of Topic Replies

Viewing 12 replies - 1 through 12 (of 12 total)
Author Replies
Author Replies
Posted: Wednesday Jul 11th, 2012 at 2:30 am #18876
Raam Dev
Username: Raam
Staff Member

Hi Nigel,

I’m not sure how the qTranslate plugin works, but it sounds like it uses one post (2951) within WordPress and creates three different versions for display (2951/name-of-post/, 2951/nom-de-post/, etc.).

When you use s2Member to restrict a post (2951) to a specific Custom Capability, s2Member restricts that post (2951) to the Custom Capability. It has no knowledge of the different versions created by qTranslate.

So when a user without the Custom Capability tries to access the post (2951), he’s denied access to all three versions because as far as s2Member knows, he’s trying to access post 2951, which requires a custom capability that he doesn’t have.

If qTranslate allows you to assign different categories or tags to the three different versions of the post (e.g., english, french, chinese), then you could use the s2Member Category or Tag restrictions (Dashboard -› s2Member® -› Restriction Options -› Category Access Restrictions) to restrict access.

Posted: Wednesday Jul 11th, 2012 at 5:56 am #18901
Nigel
Username: enquirer32

hi – thanks but none of this works. Your developer probably knows why and could you ask him if I find someone to write some script I can resolve this – perhaps he could indicate which file and approx where in the file I might find the passages where this doesn’t really work with translated tags etc. Otherwise, any other ideas?

Posted: Wednesday Jul 11th, 2012 at 3:33 pm #18949
Nigel
Username: enquirer32

OK I have worked an approach which is a little cumbersome and if you can suggest another way which is more effecient I would certainly appreciate it.

I use your shortcode conditionals in the English version of the post:
[s2If !current_user_can(access_s2member_level0)]
You need to be a subscriber to view this content – please visit the subscribe (link here) page.
[/s2If]
[s2If current_user_can(access_s2member_level1)]
Premium content here
[/s2If]
Nothing, obviously in the other pages. But this is all manual and rather a pain… !

Mny thx.

Still… it works! That’s something.

Posted: Friday Jul 13th, 2012 at 12:56 am #19110
Raam Dev
Username: Raam
Staff Member

Hi Nigel,

You said “none of this works”. Can you tell me what you tried?

Posted: Friday Jul 13th, 2012 at 2:39 am #19133
Nigel
Username: enquirer32

Sorry, if I wasn’t clear. This works.
When I wrote “Nothing, obviously in the other pages.” I just meant that I don’t put any code in the French / Chinese pages. The only thing is that I must do this manually on each post and if I decide to deactivate the plugin I’ll be left with all these codes?

Posted: Friday Jul 13th, 2012 at 7:35 am #19157

Right, if you deactivate s2Member, then the s2Member shortcodes for conditions won’t be parsed anymore. If this worries you, you can use PHP conditions instead. [hilite path]Dashboard -› s2Member® -› API / Scripting -› Advanced PHP Conditionals[/hilite]

Posted: Friday Jul 13th, 2012 at 8:21 am #19163
Nigel
Username: enquirer32

Any other suggestions – clearly there is an issue with the way S2 picks up tags/categories? Many thx.

Posted: Saturday Jul 14th, 2012 at 5:03 am #19215
Raam Dev
Username: Raam
Staff Member

Nigel,

Can you explain what the issue is with s2Member’s tags/categories restriction feature?

Posted: Saturday Jul 14th, 2012 at 8:28 am #19247
Nigel
Username: enquirer32

Please see above – surely it is clear from what I have already written???!!

Posted: Sunday Jul 15th, 2012 at 6:43 am #19288

Nigel said:
Please see above – surely it is clear from what I have already written???!!

The description of what you are trying to set up is a bit confusing for us, remember that we’re not seeing what you see, and from the written description we still haven’t got a clear picture.

Nigel said:
2. logged in as ‘testing user’ can see the posts in all languages – OK, you would expect this since he has access to the English and the other two are ‘freeview’

3. logged in user without the specific cc can’t read the post in any of the languages – this is wrong. He should be able to read the French and Chinese as a minimum.

The only way I’m making sense of this is if you have all the different languages in the same page, and then protecting the whole page with the custom capability “english”. Is that what it is?

If so, then it’s clear that someone without the ccap “english” wouldn’t be able to see the other languages either, he wouldn’t see that page at all and instead be redirected to the Membership Options page, because the whole page is protected, not just the English section.

Forgive me if I have it wrong and please explain as clearly as possible how you’re setting this up so we understand and can assist you better.

Thanks!

Posted: Monday Jul 16th, 2012 at 3:32 am #19324
Nigel
Username: enquirer32

You’ve got it. However, in the set-up given that the categories and tags are all translated each page in each language have separate tags/categories – they aren’t the same. It would seem, however, that s2 is protecting the whole page ignoring these tags/categories? To try and be clearer, the English version may have the tag ‘english’ but it doesn’t have the tag ‘francais’. So, the English part of the post should be protected but not the French part since it doesn’t have the tag ‘english’. Is this asking too much? One of the great benefits for the future would be if S2 supported multi-language sites – this must be the way forward in the future?? Many thx.

Posted: Wednesday Jul 18th, 2012 at 5:33 am #19601

Thanks for confirming it.

Well, s2Member can’t tell apart what parts of a post are in what language from the tag you’re using. The only way to protect just a part of the post would be using conditionals, either shortcode or PHP.

[hilite path]Dashboard -› s2Member® -› API / Scripting -› Simple/Shortcode Conditionals[/hilite]
[hilite path]Dashboard -› s2Member® -› API / Scripting -› Advanced PHP Conditionals[/hilite]

I hope that helps. :)

Viewing 12 replies - 1 through 12 (of 12 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.