Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Saving Draft, Draft content does not appear in edit window

Status Resolved
Add-on / Version Publisher Lite 2.8.3
Severity
EE Version 4.3.1

David Clough

Jul 29, 2018

Description:
Using the most recent version of your plugin I am experiencing severe issues with the draft system

Detailed steps to reproduce the issue:
1. Open an existing entry (draft-only or an open entry)
2. With save as set to Draft I edit the entry title
3. I save and re-open the entry in CP
4. The page indicates I am viewing the latest draft, but I am seeing the original, un-edited title

The table exp_publisher_titles seems to have been updated so I am confused as to why it is being ignore. Any insight to resolve this issue would be gladly received.

#1

BoldMinded (Brian)

I’m not able to replicate this. Try re-creating the issue in a clean EE environment with the default Publisher settings. If it doens’t happen in the clean environment, then compare the Publisher settings between the two and see what the differences are that may be causing this. We also want to rule out any other 3rd party add-ons conflicting.

#2

David Clough

Issue was with how the ignored field/fieldtypes were stored in the publisher_settings table. I want no fields or field types as ignored so this is expected to be an empty array. Somehow in the table this has been stored as [“”] which resolves as a single array with an empty value.

No matter how I amend the setting in the CMS I cannot shake this initial empty entry.

Unfortunately this creates a false positive and the system believes the title field is ignored and so always shows the non-draft version.

I have worked around this by adding a few extra lines to the settings service to remove any empty stings like this from json setting types.

#3

BoldMinded (Brian)

Did you upgrade from an old version? I feel like the [“”] values were an issue at one point but I thought I had taken care of that. The easier fix is to change the value in the settings table to just []. Do that for any value that contains [“”].

Editing the code, especially without sharing the edits, voids support, so please don’t do that.

#4

David Clough

Here are the extent of my changes. We are working to tight delivery schedules so forgive me if I take urgent temporary steps to reach closer to stability:

foreach ($settingsQuery->result() as $row) {
            // json_decode on non-json strings returns null.
            if ($row->type == 'json') {
                $dbSettings[$row->site_id][$row->key] = (array) json_decode($row->val);
+                $dbSettings[$row->site_id][$row->key] = array_filter($dbSettings[$row->site_id][$row->key], function($item){
+                  return $item !== "";
+               });
            } else {
                $dbSettings[$row->site_id][$row->key] = $row->val;
            }

            $settingTypes[$row->key] = $row->type;
        }

I am happy to contribute pull requests to a private repository in the future.

#5

BoldMinded (Brian)

Thanks. I’ll take a look at adding your suggestion. I’m not sure how it became to hold a blank value to begin with, but your fix seems to account for it just in-case.

Login to reply