Availability conditions: Restriction by language

availability_language
Maintained by Renaat Renaat Debleu
Restrict module and section access based on user language.
455 sites
312 downloads
26 fans

Language filters are great, but sometimes they can make your resources and activities very complex. This availability condition makes it easy to show an English resource only to English users and an activity in French only to French speaking students.

WARNING: The Moodle Mobile app relies on the user profile language and/or course language to show or hide a resource: the language selected in the app does NOT prevail. So if use the French language in the Moodle App and working with an English phone, this module will restrict access based on the English language...

Check the global documentation about conditional availability conditions: https://docs.moodle.org/en/Conditional_activities_settings


Screenshots

Screenshot #0
Screenshot #1
Screenshot #2

Contributors

Renaat
Renaat Debleu (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Renaat
    Thu, 25 Jun 2015, 10:11 PM
    Hello Iñigo,

    Indeed the language selected in the app should prevail. But honestly, I do not know how this can be accomplished. So perhaps you could do both: report the issue on github and in the tracker.

    I will update the plugin to warn about this problem and I posted a question on the Moodle Mobile forum to have a clue how this issue could be solved.
  • Picture of Iñigo Zendegi Urzelai
    Wed, 8 Jul 2015, 8:44 PM
    Hi Renaat,

    I've read your post on the Moodle Mobile forum [1], we'll see if Juan confirms it can be done.

    Thanks!

    [1]: https://moodle.org/mod/forum/discuss.php?d=315805
  • Picture of Mauro Villoldo
    Sat, 8 Aug 2015, 3:53 AM
    Hi Renaat,

    I just installed your plugin in our 2.7, but the activities keep showing...
    Not available unless: The student's language is English (en)
    In your screenshot shows (Hidden otherwise) and this is the behavior we need...
    Am I missing something here? maybe my moodle version differs yours...
    Just to clarify...

    what we need is if the students switch the interface to english they should see the english content and when they switch to spanish they should see the spanish content.

    Thanks!
  • Renaat
    Sat, 8 Aug 2015, 3:41 PM
    Click on the eye icon!

    If the eye is SHUT then english students will not see the activity at all.
    If the eye is OPEN the students who do not speak english will see the activity but it will be greyed out and have information about why they can't access it yet.

    See the global documentation (https://docs.moodle.org/29/en/Conditional_activities_settings)
  • Picture of Mauro Villoldo
    Mon, 10 Aug 2015, 9:26 PM
    Oopss, I feel stupid now... :P

    Renaat, thank you very much for this plugin and for your help, the plugin work as expected now!

    Thanks again!
  • Picture of jake sullivan
    Wed, 19 Aug 2015, 4:10 AM
    Hi Renaat, is it possible to use your plugin in moodle version 2.5? I'm a newbie in moodle development, how do I install the plugin in the first place?
  • Picture of jake sullivan
    Thu, 20 Aug 2015, 4:17 AM
    I'm a newbie in moodle development, how do I install this plugin?
  • Renaat
    Thu, 20 Aug 2015, 3:57 PM
    Conditional activities are 2.7+ only. So it is not possible to use the plugin in version 2.5.

    Installation:

    1. Unpack the zip file into the availability/condition/ directory. A new directory will be created called language.
    2. Go to Site administration > Notifications to complete the plugin installation.
  • Picture of Brandon Jimenez
    Wed, 10 Feb 2016, 10:30 PM
    Hi, I'm currently running a Moodle 2.9.3+ site and planning to update it to Moodle 3 or 3.1 (sometime in the future), and i would love to know if you guys have already tested your plug in a Moodle 3+ environment? When would you have it certified?

    Thanks
  • Renaat
    Thu, 11 Feb 2016, 11:12 PM
    Hi Brandon,

    The current version (2014092000) supports Moodle version 2.7, 2.8, 2.9 and 3.0. Personally, I run three Moodle 3.0 sites and one test 3.1 site where the plugin is installed. Some weeks after the release of 3.1 (after some extra testing), this future version will also be supported.

    But what do you exactly mean with 'having it certified'?

  • Picture of Brandon Jimenez
    Thu, 11 Feb 2016, 11:17 PM
    Probably my bad as i was thinking in the Moodle 3 badge for official plugins, but as long as it runs, who really cares about badges? smile
  • Picture of Jean-Baptiste CROUIGNEAU
    Thu, 14 Apr 2016, 11:52 PM
    Hello,

    Is there a way to hide a course based on user language ?
    I have some courses in english, and the same courses in french (but separate courses). I would like to filter depending on user language.

    Best regards
  • Renaat
    Fri, 15 Apr 2016, 2:17 AM
    Hello Jean-Baptiste,

    availability conditions are module level: You can hide or show modules, not courses,

    If you want to filter data depending on user language, you could modify your theme renderer:

    class theme_????_core_course_renderer extends core_course_renderer {

    protected function coursecat_coursebox(coursecat_helper $chelper, $course, $additionalclasses = '') {
    switch(current_language()) {
    case 'fr':
    // Show French courses only
    default:
    // Show English courses only
    ...

    Greetings,


  • Picture of Alexander Mogutnov
    Fri, 18 Nov 2016, 7:50 AM
    Hi Renaat, Many thanks for the plugin!
    I want to do the same as Jean-Baptiste (show/hide courses based on user language), but I'm not a developer. Can you please describe how to do that in more detail? I have 3.1. Thank you so much!

    Best regards,
    Alexander
  • Renaat
    Fri, 18 Nov 2016, 5:03 PM
    Hi Alexander

    First, let me state that there is no such thing as hiding a course. If a user gets a link via mail or does a search, he/she will find your course, if he/she can access the course depends on the enrolment settings. The only thing I suggested is that it is possible to hide certain courses in the list of all courses.

    So have a look at the theme plugins (https://moodle.org/plugins/?q=type:theme), a lot of them modified the method to show the list of courses/categories to have a more beautiful page. But if you can modify the way they are presented, you can also modify if they are shown or not.

    As a non programmer, it will be difficult (you will need to create a child theme and overriding the coursecat_coursebox method), but give it a try. You never know you have hidden talents as a programmer!

    Greetings
    R
1 2 3
Please login to post comments