michael-milette / moodle-filter_filtercodes

FilterCodes filter for Moodle enables content creators to easily customize and personalize course and site content using plain text tags (no HTML). For premium support, contact us at https://www.tngconsulting.ca/contact
https://moodle.org/plugins/filter_filtercodes
GNU General Public License v3.0
30 stars 42 forks source link

Feature Request: Userfields filter #293

Open kmp8072 opened 5 months ago

kmp8072 commented 5 months ago

Prerequisites

Feature Request - The User Story

I would request for a new type of conditional fiter support, based on user fields like country or language etc. Problem: I want to show some content based on user field, like user timezone, country, authentication methods etc. Currently there is no direct way to do so, untill I create a cohort and show content based on cohort idnumber, but it makes us to do multiple things for a simple task of content showing. Suppose I want to some content to users of a particular country only, then {ifuserfield_country countrycode}{/ifuserfield_country} would be helpful.

Screenshots / Mock-ups

No response

Alterative you have considered

No response

Additional information

No response

Planning on submitting a solution in a pull request (PR)?

Maybe

Code of Conduct

michael-milette commented 5 months ago

Hi @kmp8072 ,

Can you give me the details of a actual real-life situation where you will use it?

Best regards,

Michael Milette

Learnymag commented 5 months ago

Hi @michael-milette, Here is an example.

On moodle, i created a custom field named « client. » I created a custom report for each client.

I want to create an HTML block on the dashboard and grant access to a specific URL for each client.

Below is a simplified example of the code : {ifuserfield_client Exemple1}<a href="https://xxxxx.fr/reportbuilder/view.php?id=20" {ifuserfield_client Exemple2}<a href="https://xxxxx.fr/reportbuilder/view.php?id=21"

Best regards,

Boris

kmp8072 commented 5 months ago

Hi @michael-milette, Thanks for your reply, and extremely sorry for a responding back quite late. Case 1: Suppose I am using a text block on dashboard and I want to show some information to users based on their country, currently I am managing a site which operates in around 46 countries. Because based on user's country cohort can not be assigned untill I used another extra plugin like smart cohort. So if a new user signup from a country he will not see the content if i used cohortidnumber filter untill I assign this user to the respective cohort or an extra plugin is used.

Case2 : Now on course level suppose there are users from different countries and for different country users I want to show some different instructions, which is achievable via group but creating a group is not friendly itself. Neither there ia any group assignment automation. So if I directly have access to filtercodes country filter my job will be done easily.

Here I have taken examples only base on user's country but there can be a lot of scenario's like based on user's timezone or user's authentication method etc. where this filteration will make life easy without a bloat of plugins.

michael-milette commented 5 months ago

Hi @kmp8072 ,

Can you give me an actual usage instead of an abstract example? Imagine such a tag already exists, show me an example with real content for at least 3 countries.

Best regards,

Michael

kmp8072 commented 4 months ago

Hello @michael-milette Here, I am putting few examples of the use cases:

At Dashboard {ifuserfield_country US}A new certification program has been added. You can join at [course/program link]{/ifuserfield_country} {ifuserfield_client GB}We are having an event at Town Hall, you are most welcome to join us.{/ifuserfield_country} {ifuserfield_client CA}Hello, there is a discussion going on about product launching in Canada, please add your suggestions {forumembed - using forumembed filter}{/ifuserfield_country}

At course level {ifuserfield_country US}A new course as a replacement for this course has been launched and you should do the new course at [courselink]. Please don't register for this course. You won't we able to access content because there is restriction applied on the basis of user's country. Now this course is relevant for only Canadian users.[course/program link]{/ifuserfield_country} -- inside a page activity where as content of page i am embedding video links {ifuserfield_country US}[USvideolink]{/ifuserfield_country} {ifuserfield_country CA}[CAvideolink]{/ifuserfield_country} -- inside quiz creation where quiz is part of course completion and I can't restrict this activity based on user profile otherwise course completion won't be achieved. Questions are different for different countries. This can be sparingly useful but we have got situations like this and created a whole new course for that purpose. Question 1. {ifuserfield_country CA}[CA question text]{/ifuserfield_country} {ifuserfield_country US}[US question text]{/ifuserfield_country} Option 1. {ifuserfield_country CA}[CA option 1 text]{/ifuserfield_country} {ifuserfield_country US}[US option 1 text]{/ifuserfield_country}

I hope above use cases make sense.

Best regards,

Krishna Mohan

michael-milette commented 4 months ago

Hi @kmp8072 ,

Thank you for the great examples. I can now see how this would be useful.

Please be aware that filters do not work in all quiz questions. I tried to get that fixed several years ago but I was told that it did not make sense.

Thanks again for taking the time to prepare the examples. I will let you know when I have something for you to try out.

Best regards,

Michael