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: Issue with Structure Redirect after Save?

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

Jacob Russell

Jan 14, 2013

I have structure set to redirect back to itself after entry save, which isn’t currently working (I go to the standard post-save screen instead).  I suspect this is a conflict with Publisher?

#1

BoldMinded (Brian)

I just tested locally and its redirecting back to Structure for me. I am using that hook, but it looks like this:

/**
     * entry_submission_redirect
     *
     * @param 
     * @return 
     */
    public function entry_submission_redirect($entry_id, $meta, $data, $cp_call, $orig_loc)
    {
        return $orig_loc;
    }

Which is basically just a placeholder. What priority do each instance of entry_submission_redirect in the extensions table have?

#2

Jacob Russell

Publisher has a 10, structure a 9. I also have the workflow functionality turned off in Publisher, if it makes any difference.

On an unrelated note - I also want to force the language segment into the browser as soon as a language is clicked, not just when a link is clicked after that. Is there a way to do that with publisher?

#3

BoldMinded (Brian)

Try removing the Publisher call to that hook, it should not be doing anything right now anyway.

Do you mean when the language switch is initiated in your site, or the first time someone visits your site without a language code?

#4

BoldMinded (Brian)

By removing the call to the hook I mean deleting that row in the DB.

#5

Jacob Russell

The former, if I’m on foo.com/about and I click ‘Spanish’, it will show me the Spanish content at foo.com/about, then if I click a nav link I’ll go to foo.com/es/contact, for example. I want /es/ to show up as soon as I click ‘Spanish’.

I’ll remove the row from the DB and report back.

#6

BoldMinded (Brian)

Hrm, it should be adding the prefix immediately. Which tag are you using to switch languages?

#7

Jacob Russell

Removing the hook worked for the redirect, thank you.

For the language switching - {exp:publisher:languages show=”1|2|3”} {long_name} {/exp:publisher:languages}

#8

Jacob Russell

That definitely ate my code, let’s try again {exp:publisher:languages show=”1|2|3”} < a href=”{switch_language_url}” id=”language-{short_name}” >{long_name}< /a > {/exp:publisher:languages}

#9

BoldMinded (Brian)

Did you download Publisher 0.97.5 by chance?

#10

Jacob Russell

0.97.2, should I update?

#11

BoldMinded (Brian)

Yeah, I made a few changes to how the URL is handled when switching languages.

#12

Jacob Russell

Well… it got worse. Now clicking a language link takes me back to the homepage, and none of the nav links maintain the language. Here’s the staging site if you’d like to see how the links are behaving:

http://zeropex.kolon.staging.lastfriday.no

#13

BoldMinded (Brian)

How is that navigation generated?

#14

Jacob Russell

structure:nav

I’m also available on skype/gchat today if you need me to do some more immediate poking around and changing for testing.

#15

BoldMinded (Brian)

I’m able to replicate locally, working on a fix.

#16

Jacob Russell

Did you ever know, that you’re my hero?

#17

BoldMinded (Brian)

Go to line 413 or so of publisher_site_pages.php and you’ll see a line that says “Removed in 0.97.4” - change it to this:

// Removed in 0.97.4
        // If this is set, then its a FE request, not a CP
        if (isset($this->EE->publisher_session->current_language_code) AND $this->EE->publisher_setting->get('url_prefix'))
        {
            $code = $this->EE->publisher_session->current_language_code .'/';
            $site_url = $this->EE->config->item('site_url');

            $site_pages[$this->EE->publisher_lib->site_id]['url'] = $this->EE->functions->remove_double_slashes($site_url . $code);
        }
#18

Jacob Russell

I leave the if($uris_only… line below it in place, correct?

#19

BoldMinded (Brian)

Yes. Just update that commented out if statement with the new one

#20

Jacob Russell

Changing languages still kicks back to the homepage, when I’d think it would stay on the page you’re on, right?

#21

Bjørn Børresen

subscribing

#22

BoldMinded (Brian)

Yeah, it should just reload the page. Would it be possible for me to have FTP access to the publisher directory so I can debug the code?

#23

BoldMinded (Brian)

I can’t replicate this locally, so I’m not sure exactly what is tripping it up.

#24

BoldMinded (Brian)

Do you have URL Translations turned on?

#25

Jacob Russell

No to the last question, regarding FTP Bjørn will have to answer that, this is his server.

#26

Bjørn Børresen

Could you email me your public ssh key Brian? I’ll have the server admin add it to the server right away.

#27

Jacob Russell

I’ve got another possible bug as well - http://zeropex.kolon.staging.lastfriday.no/no/news/press-releases

See the right link in the main nav, news, is translated. In the side nav, however, it is not.

{exp:structure:nav start_from=”/{segment_1}” show_overview=”yes” rename_overview=”title” css_class=”nav”}

I believe that’s because it’s an overview link.

Thoughts?

#28

Jacob Russell

Another question - does EE’s native search work with this?

#29

BoldMinded (Brian)

It does not work with the native search, though I know how to make it in a round about way 😊 I’ll see if I can get that in after I figure out the other issue for you.

#30

BoldMinded (Brian)

Jacob, if you remove the rename_overview does it translate? This might be an issue with Structure if that is the case.

I’ve been digging around the code and the language switcher and it appears your site is doing something that I’ve seen a couple other sites do, but I’m not sure what the cause or fix is. Basically if you go to the publisher_log table you’ll see rows where it has “favicon.ico” as the request, so in the middle of the language switch process it thinks the url is “favicon.ico” which is not a valid site page or language code, so the switching gets really confused and it actually never chagnes the language cookie. I’ve also seen this happen when .js or .css files were linked with {site_url} rather than {root_url}, but I don’t even see a favicon.ico request in your source code. Is there anything on the server forcing a request to favicon.ico?

#31

Jacob Russell

No favicon.ico that I can think of or find. I also don’t use {site_url} or {root_url} - I just use paths starting with a /. There’s not really a ton going on here other then the language switching that could be confusing things… were the other sites that had this issue using Stash to construct templates or built on HTML5 Boilerplate? About all I can think of that might be a commonality.

#32

BoldMinded (Brian)

Ok, I added a simple check to see if its requesting favicon.ico, and the switching seems to be working as expected now, but the addition is kind of a hack. I need to get to the bottom of this. For a brief moment in the switching process $this->EE->uri->segments[1] = ‘favicon.ico’ - Why its doing this, I have no clue.

#33

BoldMinded (Brian)

The plus side of this is I was able to remove about 30 lines of code that was apparently old and unnecessary 😊

#34

BoldMinded (Brian)

I don’t remember the other sites using the HTML5 Boilerplate.

#35

BoldMinded (Brian)

I’m just rambling now. It could be an Apache thing requesting favicon.ico.

#36

Jacob Russell

Can you let me know exactly what files you changed? I’ll need to commit so they don’t get overwritten.

Any thoughts on the search? I hadn’t gotten around to considering it until now, but search is going to be important. If I need to use another search module that will work better, that’s fine.

#37

BoldMinded (Brian)

Ok, just ran an experiment. I added a favicon.ico file and removed my hack and it switched languages just fine. Apache seems to really want to serve a favicon file, but if it doesn’t exist it throws a 404 and mucks up the language switching. Based on the other issues where .js files were not linked properly it seems like a 404 borks the switching.

#38

BoldMinded (Brian)

I just changed libraries/Publisher_session.php and libraries/helpers/Publisher_helper_url.php

I made the same changes locally so it’ll be in the next release.

I can work on the search later this week and maybe have it ready by the early next week. I do have a copy of Low Search with some hook additions I sent to Low but he has not responded yet. If you buy a copy of it I can send you the build I have.

#39

BoldMinded (Brian)

As for the Structure override thing, I’m pretty sure its b/c of the order of how the Structure hooks are called. The override and overview parameters don’t work b/c they are processed after the hook I use, thus they negate the changes I made in the hook. I’ve sent a recommended change to Jack a couple times but no word on if it’ll be included. If you want to add the hook this is it: http://cl.ly/text/3v3s0U3A122m

#40

BoldMinded (Brian)

Shit, that doesn’t fix the overview. It needs another new hook.

#41

Jacob Russell

I’m a really good bug & needed feature finder. 😊

Timeline for search will have to be fine, we need it so it is what it is. Low Search shouldn’t be a problem.

I think I had to use those params because of what link / name it was putting there. I can probably work around that one though if needed.

#42

BoldMinded (Brian)

I just sent Jack a request for a new hook. Adding support for it shouldn’t be a problem, but for now, I need to get some sleep.

#43

Jacob Russell

I appreciate your help with all of this, thank you

#44

Bjørn Børresen

Indeed, thanks for the effort

#45

Matthew R. Weinberg

“I do have a copy of Low Search with some hook additions I sent to Low but he has not responded yet. If you buy a copy of it I can send you the build I have.”

Brian, do you mind sending that to me? We’re trying to use publisher with Low Search and can give this a test.

#46

Jacob Russell

Brian, I have a license for Low Search, can send a license number if you’d like. Otherwise, let me know how you’d like to send the files (or you can feel free to just upload to the FTP you have access to.)

#47

BoldMinded (Brian)

Jacob, I just added support for the new structure hook, so the rename_override=”title” should work with the next release.

Login to reply