Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-44148

portfolio_plugin_base::set_user_config doesn't return a value; erroneous error message on user option save

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5.5, 2.6.2
    • Fix Version/s: 2.5.6, 2.6.3
    • Component/s: Portfolio
    • Labels:
    • Database:
      Any
    • Testing Instructions:
      Hide
      1. As administrator, install a user-configurable portfolio plugin, e.g. https://github.com/jethac/moodle-wordpress-publish
      2. Enable it and make it visible for all users
      3. As a user, edit your portfolio settings (i.e. Administration -> My profile settings -> Portfolios -> Configure -> [name of WordPress plugin instance]) and attempt to save
      4. Without the fix installed: verify that an instancenotsaved error is printed, despite the requested config settings being saved successfully to table mdl_portfolio_instance_user. Code that emits the error is at user/portfolio.php:80 (user/portfolio.php is a procedural php file, so no class/function specifics).
      5. With the fix installed: verify that Moodle successfully saves the data and does not erroneously emit an instancenotsaved error
      Show
      As administrator, install a user-configurable portfolio plugin, e.g. https://github.com/jethac/moodle-wordpress-publish Enable it and make it visible for all users As a user, edit your portfolio settings (i.e. Administration -> My profile settings -> Portfolios -> Configure -> [name of WordPress plugin instance] ) and attempt to save Without the fix installed: verify that an instancenotsaved error is printed, despite the requested config settings being saved successfully to table mdl_portfolio_instance_user. Code that emits the error is at user/portfolio.php:80 (user/portfolio.php is a procedural php file, so no class/function specifics). With the fix installed: verify that Moodle successfully saves the data and does not erroneously emit an instancenotsaved error
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-44148-master

      Description

      As per topic; set_user_config (lib/portfolio/plugin.php:604) doesn't have a codepath that returns a value, as far as I can see. In three out of the four places it's called in base Moodle 2.6.1 the return value isn't actually used, but it is expected and used in one, with unfortunate consequences - if a portfolio plugin is user-configurable, an instancenotsaved error message is thrown when saving configuration data despite db writes succeeding.

      REPRODUCTION STEPS:

      • Install a user-configurable portfolio plugin, e.g. https://github.com/jethac/moodle-wordpress-publish
      • Enable portfolios, and set up an instance of your plugin.
      • As a regular user, attempt to configure your portfolio (Administration -> My profile settings -> Portfolios -> Configure; click the wrench next to the name of your plugin).
      • Submit a save request.

      WHAT I EXPECTED:
      I expected to see a "Portfolio saved successfully" message, and then to be redirected back to Administration -> My profile settings -> Portfolios -> Configure

      WHAT ACTUALLY HAPPENS:
      The data submitted is successfully saved / updated in the database (I used pgAdmin to inspect), but an erroneous instancenotsaved message is displayed.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jethac Jetha Chan
                Reporter:
                jethac Jetha Chan
                Peer reviewer:
                Rajesh Taneja
                Integrator:
                Marina Glancy
                Tester:
                Petr Skoda
                Participants:
                Component watchers:
                Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  12/May/14