Can we add code in custom menu item

Can we add code in custom menu item

Sunny Adhatrao གིས-
Number of replies: 5

Hi,

I want to show the custom menu item for one cohort other cohorts should not see this tab.


is it proper way to add code.

དཔྱ་སྙོམས་ཀྱི་སྐུགས་ཚུ།: -
In reply to Sunny Adhatrao

Re: Can we add code in custom menu item

Jon Bolton གིས-
Testers གི་པར
You need to have the FilterCodes plugin (or Generico filter) to do this.

With Filtercodes, it would be

{ifincohort CohortID|idnumber}
Content
{/ifincohort}

which will display enclosed content only if user is a member of the specified cohort. You can specify the Cohort ID in your cohort settings or its ID number. Cohort ID can contain a combination of letters from a to z, A to Z, numbers 0 to 9 and underscores. It will not work if it contains spaces, dashes or other special characters.

so in your case…

{ifincohort 15}
Documentary|http://localhost…
{/ifincohort}
In reply to Jon Bolton

Re: Can we add code in custom menu item

Sunny Adhatrao གིས-

Hi John,

I have installed this given plugin and inserted the code in my application. It seems not working properly.




In reply to Sunny Adhatrao

Re: Can we add code in custom menu item

Randy Thornton གིས-
Filters, such as the standard ones and Filtercodes, do not yet work properly in Custom menus. But the good new is that this is actively being worked on. Please see Tracker MDL-63219 for details (and vote it up དགའ་འཛུམ་
In reply to Randy Thornton

Re: Can we add code in custom menu item

Jon Bolton གིས-
Testers གི་པར
Sorry, forgot about that because I’d patched mine.

You could patch either the theme or Moodle. Instructions for patching most themes based on Boost since Moodle 3.2 can be found at:

https://github.com/michael-milette/moodle-filter_filtercodes/blob/master/README.md#for-themes-based-on-boost-moodle-32-and-later

To patch Moodle 3.8, use Git to cherry-pick the following patch:
https://github.com/michael-milette/moodle/tree/MDL-63219-M38