Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by OpenLG

  1. It also seems to have affected pages named "1" (maybe all pages with a number for name?). Seems to be working in the latest version.
  2. Thanks for your input ryan. Imagine the following scenario: I have a page with a template that requiers the admin role (with the "Redirect to another URL" set). The page is visited while not logged in (role = guest?) User gets redirected with a 301 to a noaccess page User then logs in with the admin account (or an account that has the admin role) User visits the page again but since the previous 301 was cached in the browser it instead visits the noaccess page This was my line of thinking. Sorry for dragging this out but I just want to make sure my point comes across. My point being that if you do a redirect based on some conditional (hasRole('admin') etc.) a 302 might be more suitable since the conditional might return different results from time to time (a user might get stripped of his/her admin role privilege). As far as SEO goes I do get that 301s are a useful but this isn't about that.
  3. Yes I know of this parameter and my code always use the second parameter for 302s but I'm talking about processwire itself. My code is so far only in templates, no custom built modules. If you do a grep -R 'redirect(' ./ in the processwire root dir, you will find a lot of examples. The functionality I'm referring to is under the "ACCESS" tab in "Edit Template" with the label "What to do when user attempts to view a page and has no access?" and in code it's in one of the modules under wire/modules/Process/
  4. Hi, I have a couple of restricted templates using the "Redirect to another URL" if the user doesn't have access. I redirect to a custom login page with the {id} tag. On successful login the user then gets redirected to the page he/she was trying to access in the first place (if the user in question has access to the page). You probably get the point. I now have a user who gets the "too many redirects" browser issue. I haven't been able to reproduce this so it's too early to draw any conclusions. Anyone else having similar issues? Also pw seems to always redirect with a HTTP 301 internally, i.e. the "Redirect to another URL" functionality, and these are cacheable in the browser (http://en.wikipedia.org/wiki/HTTP_301). PHP does however by default add headers that should make the browser not use cache: the no-store, no-cache, expires etc. This would effectively make the 301 (permanent redirect) behave like a 302 (temporary redirect), however the browsers have as far as I know have not been particularly good at following the recommendations regarding cache headers. Is there a reason for always using 301, in the pw core?
  5. Hi, As the title says, my code looks like this: $aPage = $pages->get('selector'); $default = $languages->get('default'); $language1 = $languages->get('language1'); $language2 = $languages->get('language2'); $aPage->setOutputFormatting(false); $aPage->title->setTrackChanges(true); // remove this and title will be empty $aPage->title->setLanguageValue($default, 'title'); $aPage->title->setLanguageValue($language1, 'title1'); $aPage->title->setLanguageValue($language2, 'title2'); $aPage->save(); The reason I'm asking is I can't find any mention of this in the documentation and it took quite some time to figure out.
  6. Thanks ryan, That should cover what I need.
  7. Hi, If you have a module that depends on another module, is there a way to make sure that one gets loaded before the other?
  8. Hi, I'm trying to build a search function using selectors but when "sanitizing" a string, containing a comma, with Sanitizer::selectorValue it sometimes removes the comma. Here are some test runs (first row is input, second is selectorValue output) : 'test' 'test' "test' "test" ,test, ' "test '" ' '' ','test' "'test" guns n' roses, mötley crüe "guns n' roses mötley crüe" ','test "'test" "''" "" , "" test, test2 "test, test2" Also in the documentation for selectorValue it says: does this mean you can't search for all characters (comma)?
  9. Hi, Like the title says, is there a way to check what the values were before saving, to check for fields that have changed etc. Both the before and after event now seems to get the Page object after it has been updated.
  • Create New...