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: Cannot preview custom draft data for entries with only draft entry (no live entry)

Status Resolved
Add-on / Version Publisher
Severity Critical
EE Version

Timothy Kelty

Jul 11, 2013

Titles seem to work, and the right template is loading (using status=”{publisher:entry_status}”), but no custom data comes though.

Draft for entries that also have a live version seem to work fine.

Halp?

#1

BoldMinded (Brian)

Did you add the status variable?

status=”your-custom-status{publisher:entry_status}”

Thats needed for instances just like this.

#2

Timothy Kelty

Yep I did.

And its the right entry, the title is shown from the draft. I’ve also noticed Matrix data seems to be working too.

However, I have a text input, Wygwam, and a host of others that aren’t.

Again, if the entry has a published version, everything works fine.

#3

BoldMinded (Brian)

So the fields that are not working are ones that use native EE db table storage. The ones that are working are using their own tables?

#4

BoldMinded (Brian)

And just verifying that if you’re using 2.6 you’ve applied this patch? https://gist.github.com/litzinger/5718707

#5

Timothy Kelty

Yep, it appears to be custom fields with data exp_channel_data.

Yep, running EE 2.6.1 with both patches are applied.

I can send you another site dump if it helps.

#6

BoldMinded (Brian)

yeah, lets try another site zip.

#7

Timothy Kelty

Ok, I added it to the site url field for this ticket. I stripped down the blog/detail template for testing, so try it with a new draft in the blog channel.

FYI - I also have a hack in there currently to show the query string (?publisher_status=draft) above the iframe, as the client wanted to be able to copy for sharing.

#8

Timothy Kelty

It’s still uploading, if you’re trying to d/l, give it a couple minutes.

#9

BoldMinded (Brian)

I won’t actually be able to dig into this until Sunday evening probably. Have a busy weekend ahead of me.

#10

BoldMinded (Brian)

Can you provide some direction on how I’m supposed to setup the site? I blew away the old files I had and can’t seem to figure it out this time. This is perhaps the most unique EE setup I’ve ever seen.

#11

Timothy Kelty

Hah, yeah sorry about that.

All you should have to do is create an config/environment.yml file and make it look something like this (all you really need is the database stuff):

development:
  database_config:
    adapter: mysql
    username: root
    password: root
    host: localhost
    socket: /Applications/MAMP/tmp/mysql/mysql.sock
    database: lippincott_ee2_local
  config:
    # debug: 1
    # template_debugging: y
    # strict_urls: y
    # cp_theme: default
    # ce_cache_off: yes
    # ce_cache_async: no
  global_vars:
    filter_sort_limit: 15
#12

Timothy Kelty

Sorry I think I gave you a working copy last time, this time I just git archived it. My bad, I know it’s far from a standard setup.

#13

BoldMinded (Brian)

what about the site_url, where is that set?

#14

Timothy Kelty

Crap, I know your problem. Last time I ran composer install before I sent you the files, those are unsourced so they’re not in the repo.

I’ll send you another dump, you can use the same db.

Or if you have composer installed, just run composer install at the root.

#15

BoldMinded (Brian)

I don’t have composer install on my personal computer yet, but I need to get it, so I’ll try it tonight.

#16

Timothy Kelty

Ok, otherwise I’m uploading a new zip to dropbox.

All you should have to do with that one is replace the db credentials in config/environment.yml

Sorry to throw you into the world of our crazy undocumented bootstrap with no warning!

#17

BoldMinded (Brian)

No worries. Most of it made sense, just wasn’t sure what I was missing.

#18

BoldMinded (Brian)

Go to line 501 or so of ext.publisher.php and change it to this

// Get our Titles only, the rest will be queried by Publisher_lib so fallbacks work.
        else
        {
            if (ee()->publisher_lib->status == PUBLISHER_STATUS_DRAFT)
            {
                $results = ee()->publisher_entry->get_all($entry_ids, $results, ee()->publisher_lib->lang_id, PUBLISHER_STATUS_DRAFT);
            }
            else
            {
                $titles = ee()->publisher_entry->get_titles($entry_ids);

                foreach ($results as $k => &$entry)
                {
                    if (isset($titles[$entry['entry_id']]))
                    {
                        $entry['title'] = $titles[$entry['entry_id']];
                    }
                }
            }
        }

And go to models/publisher_entry.php line 546 and change the if to this

// If any filters were used and we don't have an Publisher entry, cut it.
                if (($status_filter OR $lang_filter) AND !isset($entries[$entry['entry_id']]))

That fixes it for me locally.

#19

BoldMinded (Brian)

Also, I noticed a crap ton of extra queries being run. In Publisher_helper_url.php line 275 or so change the beginning of the is_valid_url method to this:

public function is_valid_url($segment)
    {
        if ($segment)
        {
            // See if its a valid template group first. Easiest lookup.
            ee()->publisher_template->build_template_collection();

            if (in_array($segment, $this->cache['templates']['group'][ee()->publisher_lib->default_lang_id]))
            {
                return TRUE;
            }
        }

And go into the publisher_template model and make build_template_collection public.

#20

Timothy Kelty

Seems to work!

Also had to change the build_template_collection method from private to public to avoid this error on publish:

Fatal error: Call to private method Publisher_template::build_template_collection() from context ‘Publisher_helper_url’

#21

BoldMinded (Brian)

Sweet. I’ll get this in the next release then.

BTW, that query change removed 1700 queries from your page load :-O

#22

Timothy Kelty

Hah! Yeah, I noticed that one when I was looking at my profiler report too.

Hard to notice some of those things until they’re compounded by that many entries!

Thanks again.

#23

BoldMinded (Brian)

Np. Yeah, thats the first time I’ve seen that many queries before… I monitor that when testing b/c I know this could happen, but I’m not sure how or why this one just now appeared.

#24

BoldMinded (Brian)

Is this safe to mark Resolved?

Login to reply