1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.4 Hide forum based on user language

Discussion in 'XenForo Questions and Support' started by sbj, Mar 26, 2015.

  1. sbj

    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?
     
    rafass likes this.
  2. Brogan

    Brogan XenForo Moderator Staff Member

    You can use a user group promotion and revoke access to the nodes for the user group.
     
    sbj likes this.
  3. sbj

    sbj Well-Known Member

    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.
     
  4. sbj

    sbj Well-Known Member

    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.
     
  5. Martok

    Martok Well-Known Member

    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.
     
    sbj likes this.
  6. sbj

    sbj Well-Known Member

    Ah, forgot about crons. Right. Thank you.
    Now it works. Changed the cron running at any given minute, so semi-instantaneous.
     
  7. sbj

    sbj Well-Known Member

    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?
     
  8. sbj

    sbj Well-Known Member

    Does Google or any other search engine index your site correctly, when some nodes can't be seen based on selected language?
     
  9. rafass

    rafass Well-Known Member

    interesting. thinking about do the same in my forum.
    great way to have 2 languages.(y)
     
  10. sbj

    sbj Well-Known Member

    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.
     
    rafass likes this.
  11. Brogan

    Brogan XenForo Moderator Staff Member

    Google will index whatever content is available to a regular guest.
     
    sbj likes this.
  12. sbj

    sbj Well-Known Member

    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: Mar 27, 2015
  13. Mike

    Mike XenForo Developer Staff Member

    Promotions wouldn't apply to guests. It only applies to registered users.
     
  14. sbj

    sbj Well-Known Member

    So this doesn't work?
    "Apply this promotion while user is a guest"
    What is the purpose of it then?

    upload_2015-3-27_11-14-7.png
     
  15. Mike

    Mike XenForo Developer Staff Member

    The criteria options apply to various systems so there are places where that applies. This is one place where it doesn't.
     
  16. sbj

    sbj Well-Known Member

    I understand. Very disappointing. Thank you.

    Is there a hardcode way to make the cron run instantaneously, so for registered members this feature works?
     
  17. Mike

    Mike XenForo Developer Staff Member

    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.
     
    sbj likes this.
  18. rafass

    rafass Well-Known Member

    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: Jun 8, 2015

Share This Page