Closed jb-fol closed 6 months ago
Hi @jb-fol ,
The tags you may be looking for are:
{course_fields}: Displays the custom course fields.
{course_field_shortname} : Displays custom course field. Replace "shortname" with the short name of a custom course field all in lowercase.
NOTE: Respects a custom course field's Visible To setting.
If this is not what you need, please feel free to reopen this ticket.
Best regards,
Michael Milette
Thanks Michael - I’m successfully using course_field_shortname
What I was asking for was the same as in issue #84 which only shows the content if the profile field is populated.
Hi @jb-fol ,
Sorry for the misunderstanding. Please simply add a comment to #84 and you will be automatically notified when I make progress on that ticket.
Best regards,
Michael
Hi @michael-milette, Thanks again for your wonderful plugin and all the other contributions that you make to the Moodle community :-)
Let's say I want to display the following text in a label in a course:
Fruit: {course_field_fruit}
This is of course a "course_field_shortname" tag. And I know that if the relevant course field in that course is empty, nothing will be shown, and if it has content, it would be displayed. The thing is that in any case the preceding "Fruit: " text would be displayed to the user, and it would be strange since if there is not content to show, there would be a "Fruit: " text without something to follow it.
Is there any creative solution that you can think about, that would help us in this kind of scenario?
Hi @acquaalta ,
I've had to deal with that too. What I did in the past was to give the course field a default value like (not set yet), (to be completed) or (none).
Beyond that, we would need a new ifempty or something like that.
Best regards,
Michael
Prerequisites
Feature Request - The User Story
As a user, I can see relevant content from custom course fields if the data exists.
Same functionality already exists for user profile fields with ifprofile_field_shortname
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)?
No
Code of Conduct