Plugin parameters are being overwritten on save. Casting of jos_plugin_params database table fields in the \Hubzero\Plugin\Params::oneByPlugin method was causing the issue. Effect was to only allow for one row per object id, causing for example all group plugins to share the same row in the database, leading to lost parameter settings.
Brief summary of fixed code
Changed the oneByPlugin method to NOT cast the two string fields to integer. Also made it a oneByPluginOrNew to account for first-time save of settings. I refactored a bit by removing the sending of the settings to the view, which seemed unnecessary. Another goal of the refactor was a reduction in code redundancy.
Testing
Doing a search on "oneByPlugin," it appeared to me that only four plugins were affected by this: the blog, collections, and forum group plugins, and the member blog plugin. I tested the changes by starting from scratch on a new group and initializing settings for the three group plugins. They each got their own row in the jos_plugin_params table, and their settings were not overwritten on other plugin setting saves (i.e. they persisted). I also changed the settings in multiple plugins, with the changes persisting as well. Finally, I set the settings on a member's blog, which persisted. There was no other member plugin to test to make sure it didn't share the same row in the table.
Hotfixing??
Well, that might be up to you all, but any loss of data (even if it is just settings) seems to be somewhat problematic, but mostly for usability I think.
Before you submit this pull request, please make sure:
[x] Make sure there are links in the PR to the source JIRA card(s) and hubzero ticket(s)
[x] Include a brief summary of the issue in your own words
[x] Include a brief summary of the fix/changed code
[x] Include a brief summary of your testing. What did you specifically do to investigate that this change has the correct results?
[x] Indicate if the change needs to be hotfixed to any production hubs before a normal core rollout
[x] Double check someone is assigned to review the ticket
JIRA card or HubZero ticket reference
I have not submitted a ticket on this.
Brief summary of the issue
Plugin parameters are being overwritten on save. Casting of
jos_plugin_params
database table fields in the\Hubzero\Plugin\Params::oneByPlugin
method was causing the issue. Effect was to only allow for one row per object id, causing for example all group plugins to share the same row in the database, leading to lost parameter settings.Brief summary of fixed code
Changed the oneByPlugin method to NOT cast the two string fields to integer. Also made it a
oneByPluginOrNew
to account for first-time save of settings. I refactored a bit by removing the sending of the settings to the view, which seemed unnecessary. Another goal of the refactor was a reduction in code redundancy.Testing
Doing a search on "oneByPlugin," it appeared to me that only four plugins were affected by this: the blog, collections, and forum group plugins, and the member blog plugin. I tested the changes by starting from scratch on a new group and initializing settings for the three group plugins. They each got their own row in the
jos_plugin_params
table, and their settings were not overwritten on other plugin setting saves (i.e. they persisted). I also changed the settings in multiple plugins, with the changes persisting as well. Finally, I set the settings on a member's blog, which persisted. There was no other member plugin to test to make sure it didn't share the same row in the table.Hotfixing??
Well, that might be up to you all, but any loss of data (even if it is just settings) seems to be somewhat problematic, but mostly for usability I think.
Before you submit this pull request, please make sure:
Thanks!