Details

    • Affected Branches:
      MOODLE_23_STABLE
    • Rank:
      43076

      Description

      This contribution extends the system used for user profiles. Custom fields and categories can now be defined for courses, and potentially other objects.

      The full description is at https://github.com/silecs/moodle-course-custom-fields/wiki/Custom-fields-for-courses

      The repository is https://github.com/silecs/moodle-course-custom-fields

      Please review this contribution.

        Issue Links

          Activity

          Hide
          Michael de Raadt added a comment -

          Thanks for sharing that.

          Perhaps you could add some details about what this change allows users to do.

          Show
          Michael de Raadt added a comment - Thanks for sharing that. Perhaps you could add some details about what this change allows users to do.
          Hide
          François Gannaz added a comment -

          Alright, there's a need for a description between the 2 short sentences in this ticket and the long wiki page referenced above. The goal is to add many metadata to courses. This is mainly a structural development, so there are only 2 interface changes.

          1. Any user (with the right global capabilities) can define custom fields for courses. These fields are organized in custom categories (not the course categories). The interface for defining the fields and categories is the same as the UI for defining user profiles (it shares much of the code and the same SQL tables, though the data is independent).

          2. Any user (with the right local capabilities) that creates or modifies a course can fill in values for the existing custom fields.

          An example :
          1. In the menu, I choose the page "Site administration > Courses > Course custom fields".
          2. I use the drop-down list "Create a new field" at the bottom of the page to define a checkbox field.
          3. In the form that appears, I give this custom field a unique name, a long name ("Passing is required") and a description. The other lines of the form are kept at their default values (e.g. default category: "Other fields").
          4. Now I create a new course: at the bottom of the form, there's a fieldset whose name is "Other fields" and that contains a checkbox with the label "Passing is required".

          Show
          François Gannaz added a comment - Alright, there's a need for a description between the 2 short sentences in this ticket and the long wiki page referenced above. The goal is to add many metadata to courses. This is mainly a structural development, so there are only 2 interface changes. 1. Any user (with the right global capabilities) can define custom fields for courses. These fields are organized in custom categories (not the course categories). The interface for defining the fields and categories is the same as the UI for defining user profiles (it shares much of the code and the same SQL tables, though the data is independent). 2. Any user (with the right local capabilities) that creates or modifies a course can fill in values for the existing custom fields. An example : 1. In the menu, I choose the page "Site administration > Courses > Course custom fields". 2. I use the drop-down list "Create a new field" at the bottom of the page to define a checkbox field. 3. In the form that appears, I give this custom field a unique name, a long name ("Passing is required") and a description. The other lines of the form are kept at their default values (e.g. default category: "Other fields"). 4. Now I create a new course: at the bottom of the form, there's a fieldset whose name is "Other fields" and that contains a checkbox with the label "Passing is required".
          Hide
          Dan Poltawski added a comment -

          Hi François,

          What branch is this based off? Can you provide a github diff url?

          Show
          Dan Poltawski added a comment - Hi François, What branch is this based off? Can you provide a github diff url?
          Hide
          François Gannaz added a comment -

          Hi Dan
          The branch is named "WIP_course_custom_fields". It is the default branch for the project page on Github.
          I don't know how to display a branch diff in Github, so here is a paste, thanks to nopaste-cli: http://paste.ubuntu.com/1132547/
          BTW, the diff is a bit large:

          $ git diff MOODLE_23_STABLE..WIP_course_custom_fields | wc -l
          6033

          Show
          François Gannaz added a comment - Hi Dan The branch is named "WIP_course_custom_fields". It is the default branch for the project page on Github. I don't know how to display a branch diff in Github, so here is a paste, thanks to nopaste-cli: http://paste.ubuntu.com/1132547/ BTW, the diff is a bit large: $ git diff MOODLE_23_STABLE..WIP_course_custom_fields | wc -l 6033
          Hide
          Ludek Sulak added a comment -

          Hallo,
          We are using this extension(patch) in one of our Moodle implementation. We are very happy for this extension, but we have some problems.

          The situation is:
          We have installed Moodle ver. 2.2.5+ and we want to upgrade to MOODLE_23_STABLE..WIP_course_custom_fields.
          During the upgrade process we get the system error message "Cannot downgrade moodle from 2012062500.02 to 2012062500.02."
          Any idea where is the problem?

          Next situation:
          We have installed MOODLE_23_STABLE..WIP_course_custom_fields. We have added some custom attributes to the course, it works OK. But, after we deleted that course, the custom attributes still persist in the database.

          Question:
          When this extension will be integrated into the moodle standard package?

          Thank you for your response.
          Best regards

          Show
          Ludek Sulak added a comment - Hallo, We are using this extension(patch) in one of our Moodle implementation. We are very happy for this extension, but we have some problems. The situation is: We have installed Moodle ver. 2.2.5+ and we want to upgrade to MOODLE_23_STABLE..WIP_course_custom_fields. During the upgrade process we get the system error message "Cannot downgrade moodle from 2012062500.02 to 2012062500.02." Any idea where is the problem? Next situation: We have installed MOODLE_23_STABLE..WIP_course_custom_fields. We have added some custom attributes to the course, it works OK. But, after we deleted that course, the custom attributes still persist in the database. Question: When this extension will be integrated into the moodle standard package? Thank you for your response. Best regards
          Hide
          François Gannaz added a comment -

          Both problems are fixed in the Moodle clone. I can't answer the question about the integration of this patch, of course.

          Show
          François Gannaz added a comment - Both problems are fixed in the Moodle clone. I can't answer the question about the integration of this patch, of course.
          Hide
          Mindaugas added a comment -

          Hello,
          when and in which version this issue will be resolved and implemented?
          Thanks

          Show
          Mindaugas added a comment - Hello, when and in which version this issue will be resolved and implemented? Thanks
          Hide
          Ludek Sulak added a comment -

          Hi François,

          We are still experimenting with this great extension, but we would like to discus with you a new problem.

          If we create a new account on login/signup.php page, and we fill the form, after the submit we obtain the message:

          Fatal error: Call to undefined function profile_validation() in /var/www/moodle/login/signup_form.php on line 188 Call Stack: 0.0008 677208 1.

          {main}

          () /var/www/moodle/login/signup.php:0 0.1960 35286048 2. moodleform->get_data() /var/www/moodle/login/signup.php:51 0.1960 35286048 3. moodleform->is_validated() /var/www/moodle/lib/formslib.php:606 0.1960 35286264 4. moodleform->validate_defined_fields() /var/www/moodle/lib/formslib.php:509 0.1971 35289984 5. login_signup_form->validation() /var/www/moodle/lib/formslib.php:560

          Can you help us with this?
          Thank you very much,
          best regards

          Show
          Ludek Sulak added a comment - Hi François, We are still experimenting with this great extension, but we would like to discus with you a new problem. If we create a new account on login/signup.php page, and we fill the form, after the submit we obtain the message: Fatal error: Call to undefined function profile_validation() in /var/www/moodle/login/signup_form.php on line 188 Call Stack: 0.0008 677208 1. {main} () /var/www/moodle/login/signup.php:0 0.1960 35286048 2. moodleform->get_data() /var/www/moodle/login/signup.php:51 0.1960 35286048 3. moodleform->is_validated() /var/www/moodle/lib/formslib.php:606 0.1960 35286264 4. moodleform->validate_defined_fields() /var/www/moodle/lib/formslib.php:509 0.1971 35289984 5. login_signup_form->validation() /var/www/moodle/lib/formslib.php:560 Can you help us with this? Thank you very much, best regards
          Hide
          François Gannaz added a comment -

          @Ludek
          Hi.
          The bug you mentioned is fixed in the github repository. We don't use the self-inscription process, so we were never hit by this bug.

          Our client is using a variant of this code in production with thousands of users. I have backported (cherry-picked as says git) a few changes to the branch published on github. Unfortunately, as time pass by, it will be harder for us to fix or enhance this forked code. It will also be harder to merge it into the stable Moodle branches.

          Please, could an official developer review this feature? It's been 3 months and a half since the ticket/pull-query was opened.

          Show
          François Gannaz added a comment - @Ludek Hi. The bug you mentioned is fixed in the github repository. We don't use the self-inscription process, so we were never hit by this bug. Our client is using a variant of this code in production with thousands of users. I have backported (cherry-picked as says git) a few changes to the branch published on github. Unfortunately, as time pass by, it will be harder for us to fix or enhance this forked code. It will also be harder to merge it into the stable Moodle branches. Please, could an official developer review this feature? It's been 3 months and a half since the ticket/pull-query was opened.
          Hide
          Jenny Gray added a comment - - edited

          There was some discussion about custom fields more generally in Moodle at the recent Developer meeting in Perth. You may wish to participate in the discussion at https://moodle.org/mod/forum/discuss.php?d=215422.

          I doubt that any solution solely aimed at courses would be accepted into core at this time, while we're actively investigating the more general solution (my personal view only - I'm sure other HQ participants in this issue will correct me if they disagree!!).

          However, if you want an official developer to review your work, you will need to submit it for Peer Review through the tracker workflow. If you haven't done already, please read http://docs.moodle.org/dev/Peer_reviewing_checklist and http://docs.moodle.org/dev/Integration_Review to make sure that you've covered everything that they'll be looking for.

          Show
          Jenny Gray added a comment - - edited There was some discussion about custom fields more generally in Moodle at the recent Developer meeting in Perth. You may wish to participate in the discussion at https://moodle.org/mod/forum/discuss.php?d=215422 . I doubt that any solution solely aimed at courses would be accepted into core at this time, while we're actively investigating the more general solution (my personal view only - I'm sure other HQ participants in this issue will correct me if they disagree!!). However, if you want an official developer to review your work, you will need to submit it for Peer Review through the tracker workflow. If you haven't done already, please read http://docs.moodle.org/dev/Peer_reviewing_checklist and http://docs.moodle.org/dev/Integration_Review to make sure that you've covered everything that they'll be looking for.
          Hide
          François Gannaz added a comment -

          Thank you Jenny Gray for this interesting link to this discussion. We'll soon contribute to it.

          As stated in the description of this ticket, the metadata system we developed can be applied to any kind of object. But since our purpose was to use this on courses, we only implemented an interface to handle course custom fields.

          Could you please elaborate on our "need to submit it for Peer Review through the tracker workflow"? If we missed a step in the procedure for integration and peer reviewing, please tell us explicitly. The two links you gave seem to be addressed at Moodle developers that review and integrate contributions into the main code. Of course, we followed the official guides: http://docs.moodle.org/dev/Guidelines_for_contributed_code and http://docs.moodle.org/dev/Coding .

          Show
          François Gannaz added a comment - Thank you Jenny Gray for this interesting link to this discussion. We'll soon contribute to it. As stated in the description of this ticket, the metadata system we developed can be applied to any kind of object. But since our purpose was to use this on courses, we only implemented an interface to handle course custom fields. Could you please elaborate on our "need to submit it for Peer Review through the tracker workflow"? If we missed a step in the procedure for integration and peer reviewing, please tell us explicitly. The two links you gave seem to be addressed at Moodle developers that review and integrate contributions into the main code. Of course, we followed the official guides: http://docs.moodle.org/dev/Guidelines_for_contributed_code and http://docs.moodle.org/dev/Coding .
          Hide
          Jenny Gray added a comment -

          I understood from your earlier comments that you are offering this work for inclusion in the main code. Is that not true?

          See also http://docs.moodle.org/dev/Process, where you have reached the section on peer review and you may find this helpful too https://moodle.org/mod/forum/discuss.php?d=207872

          Show
          Jenny Gray added a comment - I understood from your earlier comments that you are offering this work for inclusion in the main code. Is that not true? See also http://docs.moodle.org/dev/Process , where you have reached the section on peer review and you may find this helpful too https://moodle.org/mod/forum/discuss.php?d=207872
          Hide
          François Gannaz added a comment -

          This ticket was created to ask for inclusion of our patch into the main repository. So, yes, we are offering this work for inclusion.

          I'm sorry, but I don't understand how the instructions you pointed out apply to me. As stated in the forum post you mentioned, "the request peer review button only appears if the bug is assigned to you": I can't assign the bug to myself, it already has an assignee.

          Show
          François Gannaz added a comment - This ticket was created to ask for inclusion of our patch into the main repository. So, yes, we are offering this work for inclusion. I'm sorry, but I don't understand how the instructions you pointed out apply to me. As stated in the forum post you mentioned, "the request peer review button only appears if the bug is assigned to you": I can't assign the bug to myself, it already has an assignee.
          Hide
          Jenny Gray added a comment -

          Then I think you need one of the HQ people to help you, as you don't appear to have the right level of permissions to do what you are asking.

          Show
          Jenny Gray added a comment - Then I think you need one of the HQ people to help you, as you don't appear to have the right level of permissions to do what you are asking.
          Hide
          Nadav Kavalerchik added a comment -

          Hi François Gannaz,

          Researching about "Custom course fields", I came across this issue. And I would like to help you prepare it for core integration or at least code review. So please see if you can help me clear out some questions, first.
          I was looking at a recent diff between your Moodle 24 path and a stable Moodle 2.4 release. (link to diff) Is this correct?
          If so...

          • You need to assign yourself to this issue (If you can not, I will help you do that)
          • Then, you need to get an updated local copy of Moodle's master branch and create a branch out of it, let's say "git checkout -b MDL-34634_master origin/master"
          • Apply all your patches and push it into github.com/silecs/moodle-course-custom-fields
          • Go back to this tracker and fill in the proper major fields (pull from repository, pull master branch and pull master diff)
          • Then, click the "request peer review" button.
          Show
          Nadav Kavalerchik added a comment - Hi François Gannaz , Researching about "Custom course fields", I came across this issue. And I would like to help you prepare it for core integration or at least code review. So please see if you can help me clear out some questions, first. I was looking at a recent diff between your Moodle 24 path and a stable Moodle 2.4 release. ( link to diff ) Is this correct? If so... You need to assign yourself to this issue (If you can not, I will help you do that) Then, you need to get an updated local copy of Moodle's master branch and create a branch out of it, let's say "git checkout -b MDL-34634 _master origin/master" Apply all your patches and push it into github.com/silecs/moodle-course-custom-fields Go back to this tracker and fill in the proper major fields (pull from repository, pull master branch and pull master diff) Then, click the "request peer review" button.
          Hide
          Guillaume Allegre added a comment -

          Hi Nadav,

          I'm a work colleague of François Gannaz, who is on vacations these days.

          As a previous comment from Jenny Gray, we found this discussion https://moodle.org/mod/forum/discuss.php?d=215422,
          where it appears that other ways are being (loosely) studied to include this functionality into Moodle core.
          So, to be honest, we are not confident any longer that François' patch will eventually be included.

          I will let François give a longer answer when he is back.

          Show
          Guillaume Allegre added a comment - Hi Nadav, I'm a work colleague of François Gannaz, who is on vacations these days. As a previous comment from Jenny Gray, we found this discussion https://moodle.org/mod/forum/discuss.php?d=215422 , where it appears that other ways are being (loosely) studied to include this functionality into Moodle core. So, to be honest, we are not confident any longer that François' patch will eventually be included. I will let François give a longer answer when he is back.
          Hide
          Nadav Kavalerchik added a comment -

          Hi Guillaume Allegre,

          Thank you for the quick reply!

          I think the whole concept of implementing generic Metadata in Moodle's core is stucked (Every discussion/issue is dated a year ago) and I wish to help it move forward.

          I found the following resources:

          I would love to get some feedback or status from Moodle HQ on all of this (or even if Martin Dougiamas could have a quick look?)

          Show
          Nadav Kavalerchik added a comment - Hi Guillaume Allegre , Thank you for the quick reply! I think the whole concept of implementing generic Metadata in Moodle's core is stucked (Every discussion/issue is dated a year ago) and I wish to help it move forward. I found the following resources: https://tracker.moodle.org/browse/CONTRIB-3527 https://tracker.moodle.org/browse/MDL-18319 https://tracker.moodle.org/browse/MDL-34634 Totara's course custom patch : https://moodle.org/mod/forum/discuss.php?d=203936#p903046 Remote-Learner's ELIS : https://moodle.org/mod/forum/discuss.php?d=203936#p889626 https://moodle.org/mod/forum/discuss.php?d=215422 block boaidp: https://tracker.moodle.org/browse/CONTRIB-3517 block, mod, repository: https://moodle.org/plugins/view.php?plugin=mod_sharedresource And linked some of them to this issue. I would love to get some feedback or status from Moodle HQ on all of this (or even if Martin Dougiamas could have a quick look?)
          Hide
          Marina Glancy added a comment -

          Hi guys,
          just to mention here that using the course formats API in 2.4 you can add as many custom fields to the course format as you want (called "course format options") and they will be backed up and restored together with the other course information.
          If several course formats are used on the site and they share the same names for the additional options, the values will be preserved when switching between those formats. For example, weeks and topics share 'numsections' and 'hiddensections'.

          When you introduce the new custom course fields you also need to create some interface to show those fields and showing the course information is the responsibility of the course format anyway. So it may be a double work.

          Dev docs: http://docs.moodle.org/dev/Course_formats

          Regards
          Marina

          Show
          Marina Glancy added a comment - Hi guys, just to mention here that using the course formats API in 2.4 you can add as many custom fields to the course format as you want (called "course format options") and they will be backed up and restored together with the other course information. If several course formats are used on the site and they share the same names for the additional options, the values will be preserved when switching between those formats. For example, weeks and topics share 'numsections' and 'hiddensections'. When you introduce the new custom course fields you also need to create some interface to show those fields and showing the course information is the responsibility of the course format anyway. So it may be a double work. Dev docs: http://docs.moodle.org/dev/Course_formats Regards Marina
          Hide
          Nadav Kavalerchik added a comment -

          Thank you Marina Glancy for the info! I was not aware of it.

          It does seem interesting but I (Actually... we, The Israeli ministry of Education) need a solution for all the courses regardless the course format, and much more. We already set up an exchange hub for LMSes (not just Moodle) resources, activities and courses. And we need a proper (standardized) way to add metadata to items (a course,a resource and an activity) when they are exported out of Moodle and shared.

          Show
          Nadav Kavalerchik added a comment - Thank you Marina Glancy for the info! I was not aware of it. It does seem interesting but I (Actually... we, The Israeli ministry of Education) need a solution for all the courses regardless the course format, and much more. We already set up an exchange hub for LMSes (not just Moodle) resources, activities and courses. And we need a proper (standardized) way to add metadata to items (a course,a resource and an activity) when they are exported out of Moodle and shared.
          Hide
          Elizabeth Dalton added a comment -

          I would really like to see this move forward for 2.6. Presently we have three different kinds of data being crammed into the "Course ID" field because it's the only field available, and when I create reports I have to parse this field to get the information out again. This field is also not visible to everyone who needs to see it. As I posted in the discussion linked above, I worry that we are letting "perfect" be the enemy of "good" by delaying this integration to evaluate other possible implementations. If there is a serious concern that this method has substantial performance risks, then those should be addressed, but otherwise, why wait?

          Show
          Elizabeth Dalton added a comment - I would really like to see this move forward for 2.6. Presently we have three different kinds of data being crammed into the "Course ID" field because it's the only field available, and when I create reports I have to parse this field to get the information out again. This field is also not visible to everyone who needs to see it. As I posted in the discussion linked above, I worry that we are letting "perfect" be the enemy of "good" by delaying this integration to evaluate other possible implementations. If there is a serious concern that this method has substantial performance risks, then those should be addressed, but otherwise, why wait?
          Hide
          François Gannaz added a comment -

          I'm the author of the proposed patch. I'll be blunt: it's a bit late to revive this offer. I'll try to work on it next week, with no guarantee I'll succeed in a limited time. Comments on the technical documentation I submitted in 2012-07 would be much appreciated.
          Now, I'll try to be constructive, but I'm on for a big rant.

          On the technical side, the patch was developed for Moodle 2.3. We proposed it more than 13 months ago. Unfortunately, there were changes in the "user profile" API in v2.4. IIRC, these changes were undocumented in the wiki, and unused in the PHP code of M2.4, yet they were added to Moodle. We chose not to port them when we migrated our forked Moodle to v2.4. I mean we have a working patch for Moodle 2.4 (in the same github repository), but the new (unused) 2.4 profile API was deleted because it would have duplicated our own API. I haven't looked at v2.5, but if this new API is used, it will conflict with ours. Even setting this aside, there have been 13 months of Moodle development, so it would be a hard work to replay this massive patch on the master branch.

          On the human side, I haven't worked on this part of the code for months, and I'm reluctant to go back to it. Seeing how the previous internal process of "investigating the more general solution" went immediately astray then died with no visible progress (see forum link in a 2012-11-19 note above), I'm not confident that Moodle's team has an idea of what they think suitable for generic metadata. The new profile API I've talked about is another reason for my disillusion: if generic metadata were being investigated, then introducing an API for user-specific metadata was a bad idea, and probably shows a lack of internal communication. I'm afraid I'll redo this patch for nothing. One year ago, did anyone at least read the technical documentation I submitted with the patch?

          Show
          François Gannaz added a comment - I'm the author of the proposed patch. I'll be blunt: it's a bit late to revive this offer. I'll try to work on it next week, with no guarantee I'll succeed in a limited time. Comments on the technical documentation I submitted in 2012-07 would be much appreciated. Now, I'll try to be constructive, but I'm on for a big rant. On the technical side, the patch was developed for Moodle 2.3. We proposed it more than 13 months ago. Unfortunately, there were changes in the "user profile" API in v2.4. IIRC, these changes were undocumented in the wiki, and unused in the PHP code of M2.4, yet they were added to Moodle. We chose not to port them when we migrated our forked Moodle to v2.4. I mean we have a working patch for Moodle 2.4 (in the same github repository), but the new (unused) 2.4 profile API was deleted because it would have duplicated our own API. I haven't looked at v2.5, but if this new API is used, it will conflict with ours. Even setting this aside, there have been 13 months of Moodle development, so it would be a hard work to replay this massive patch on the master branch. On the human side, I haven't worked on this part of the code for months, and I'm reluctant to go back to it. Seeing how the previous internal process of "investigating the more general solution" went immediately astray then died with no visible progress (see forum link in a 2012-11-19 note above), I'm not confident that Moodle's team has an idea of what they think suitable for generic metadata. The new profile API I've talked about is another reason for my disillusion: if generic metadata were being investigated, then introducing an API for user-specific metadata was a bad idea, and probably shows a lack of internal communication. I'm afraid I'll redo this patch for nothing. One year ago, did anyone at least read the technical documentation I submitted with the patch?

            People

            • Votes:
              27 Vote for this issue
              Watchers:
              27 Start watching this issue

              Dates

              • Created:
                Updated: