XF 1.4 Hide forum based on user language

sbj

Well-known member
Hey,

I know that for notices you can make a user criteria to show a notice based on user language.

Is there a way to hide forums/nodes/categories based on user language?
 
Ahhhh, ok.

So I create a new user group and revoke access to the nodes I want. And then I create a user group promotion based on user language. Makes sense.

I could also make a custom user field. And then based on custom user field I could also hide forums, right?

Very clever, great! Thank you Brogan.
 
Ok, I need some help.

So I created a new user group X and for it I revoked to view all nodes I wanted.
And then I created a user group promotion based on "User is browsing with the following language: English" and "add the user to that new user group X".
So far so good. When browsing with English, then I can't see those nodes. But when I switch back to other language, still I can't see those nodes.

How to demote back? Based on user promotion this shouldn't happen. Because only when I browse with English I should be in that new user group. But it treats me like I am always in that group, no matter when I change the language back.
 
So far so good. When browsing with English, then I can't see those nodes. But when I switch back to other language, still I can't see those nodes.

How to demote back? Based on user promotion this shouldn't happen. Because only when I browse with English I should be in that new user group. But it treats me like I am always in that group, no matter when I change the language back.
User group promotions aren't instantaneous when a user no longer meets the criteria (or vice versa). The user group promotions cron runs every hour. For testing purposes, if you see the groups when viewing in English and then change to another language, if you manually run the cron you should no longer see those nodes.
 
  • Like
Reactions: sbj
User group promotions aren't instantaneous when a user no longer meets the criteria (or vice versa). The user group promotions cron runs every hour. For testing purposes, if you see the groups when viewing in English and then change to another language, if you manually run the cron you should no longer see those nodes.
Ah, forgot about crons. Right. Thank you.
Now it works. Changed the cron running at any given minute, so semi-instantaneous.
 
It is a bit annoying that the promotion is not instantaneous.
Is there a method to make a cron run instantaneously when it is triggered?
 
interesting. thinking about do the same in my forum.
great way to have 2 languages.(y)
Except the promotion isn't instantaneous (so when you change language, you have to wait till the view is applied), it is really awesome.
Why? You can technically run 2 forums in 1 forum. Also your sidebar things will be treated like that (I use AndyB's, so events sidebar, recent posts, etc.).

That means, when someone is surfing in English, he/she only will see messages in English and Events in English, and the forum index will only show couple of nodes. So you don't have a large forum index page, which would be normally the case because it contains nodes for 2 languages.
And when someone is surfing in your primary language (Italian, Spanish, Polish, etc.), they will only see categories and messages (and sidebar stuff) only in their own language. That would be a bilingual forum. You could make that multi-lingual and make that 5 languages or whatever.

But the only thing is maybe indexing (waiting for an answer) and the promotion isn't instantaneous, so a bit confusing for new members.

But you can have 2 communities combined in 1 forum.
 
Google will index whatever content is available to a regular guest.
Just to clarify it, a regular guest might not see all available nodes because it is based on the selected language. But will bots see everything, no matter what?
Guest 1 will browse with language A, so he can only see nodes 1-5.
Guest 2 will browse with language B, so he can only see nodes 6-10.
Will be the indexing include 1-10?

edit:
It might be that I can't make user promotions for guests, is this the case?
 
Last edited:
I understand. Very disappointing. Thank you.

Is there a hardcode way to make the cron run instantaneously, so for registered members this feature works?
 
There isn't really a way to run it instantly (unless you calculate it on every page view which is expensive). Otherwise, having the cron run more frequently is really the only option.
 
  • Like
Reactions: sbj
So, this can not be achieved editing forum_list or node_list and using this nice conditional?
Code:
<xen:if is="{$visitor.language_id} == x">
Forums, Categories, Content,
</xen:if>
 
Last edited:
Top Bottom