Jump to content

psy

Members
  • Posts

    620
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by psy

  1. For pages with a particular template, I would like them to display/redirect to a different page from the normal http404 page when status is unpublished. Can't figure out what to hook and where. Un-working code is: <?php // in my auto-loaded custom module public function init() { // this hook doesn't catch... returns the normal http404 page for unpublished template=profile pages $this->addHookBefore('Page("template=profile")::loaded', $this, "unpublishedProfile"); } public function unpublishedProfile (HookEvent $event) { $page = $event->arguments(0); if ($page->isUnpublished()) $this->wire('session')->redirect($this->wire('pages')->get(1312)->url); } Also tried to hook After page loaded with same result, ie default Page Not Found shown. Help & suggestions to fix much appreciated. Cheers psy
  2. @rick Rather than use the problematic PW front-end image uploads, I went for uppy and with @Robin S' amazing help, got it working. Tus/Uppy has a nice drag-n-drop user interface, overcomes file size limits, allows for resumable uploads + more. In Robin's example, he saves the images to a new page. In my case, I prepended the page id and an underscore to the filename in the Uppy js code. Then, in the uppy server page code, identify the required page by exploding the filename on the underscore. Maybe time to get a new horse?
  3. Great addition to FB, thanks @BitPoet Small problem when using FB40a with PW3.0.145 to remember form entries in a cookie. On revisiting the form displays the number of rows I've added but they're empty of data.
  4. Lots of PW goodness in this one too: https://processwire-recipes.com/
  5. psy

    SeoMaestro

    Thanks again @teppo. I tried a few things with my limited knowledge of Apache including changing root dir privileges to 777 (scary I know!) for testing purposes to see if the error message was correct. Didn't change anything so switched the root dir privileges back to PW preferred settings. Obviously something is amiss and fairly certain it's not that SeoMaestro cannot create the file. I even saved a dummy sitemap.xml file (updated module prefs to same file name) in the root dir and still no luck. I've used this module before with success on other sites with earlier PW versions. Problem reared its head with PW1.0.142+. Wondering if maybe latest .htaccess or other is affecting things? @Wanze?
  6. psy

    SeoMaestro

    Hi @teppo, yes had field named 'seo' of FieldtypeSeoMaestro assigned to a number of templates and publicly viewable pages
  7. psy

    SeoMaestro

    Problem didn't go away for me. It still exists and no solution found. Turned off sitemap.xml generation to lose the error message. Still hoping for a fix
  8. Thanks @dragan will give it a try. Another idea I had was to use FormBuilder for the login form - again hackish. Really wish PW had a solid Login/Register module...
  9. psy

    Personal Website

    Nice ? home page nav was a bit confusing for me, eg when clicking on 'About', it scrolled to your About section but the menu disappeared. There was no obvious way to get back to the top of the page. When I scrolled up, the menu had disappeared. Using iMAC with wide screen. Going into phone mode in Chrome dev tools made it a bit easier... Otherwise, well done you!
  10. I want to have both a login form and a registration form on the same page. After much tweaking in CSS & Hooks, I managed to get @ryan's LoginRegister module to display as required. All goes well until it doesn't, ie if there is an error in the form submission. Each form has the wrapper ID hardcoded to "LoginRegister". Problem is when both forms are on the same page, both forms get the error messages and the Login form turns into a Register form. See attached before-and-after images and my code is in the 'spoiler'. Help to fix much appreciated
  11. psy

    SeoMaestro

    Thanks @teppo realised I'd posted in the wrong forum and didn't know how to change it
  12. psy

    SeoMaestro

    1. I'm getting the following error on a number of sites running PW3.0.142+ Failed to generate the XML sitemap Even though the API should have write access to the site root (unless something has changed in .htaccess?). I know others have raised this issue but I cannot figure it out. 2. The module default values do not parse PW vars while per page SeoMaestro fields do, eg in the field default Meta section: literally displays {title} in the browser tab. However if on a page seo override I uncheck the Inherit default value checkbox and enter: on page output, it correctly parses headline (1st priority) or page title (2nd priority) text in the browser tab. Help to fix both issues much appreciated.
  13. All good. Did you know about: $page->images->first and $page->images->last I often use $pages->images->last when client uploads images and wants the last one to display. To get really specific, you can call the image within a Pageimages array by calling the image by its index. Pageimages derives from WireArray which allows you to call an item by its index https://processwire.com/api/ref/wire-array/eq/
  14. @Kiwi Chris not sure I got all that but I had a scenario where what users could see depended on their roles, ie different data sets. I achieved this with RockFinder (now is RockFinder2). Maybe @bernhard can help?
  15. @franciccio-ITALIANO welcome to the forum and ProcessWire. ProcessWire is not a 'cookie-cutter-fill-in-the-blanks' website builder. Quite the opposite. Any and every field, whether generated by the profile you chose in install, or afterwards can do or be whatever you want. It's a mind shift... That's the beauty of ProcessWire. YOU are in control
  16. Untested but may something like: <?php $tags = $page->tags->implode(','); ?> <meta name='keywords' content=<?=$tags>' ?>
  17. @Chris B there are a couple of ways. 1. The most secure... use a hook to add the value to the FB after submit (or whatever hook works for you best). See https://processwire.com/store/form-builder/hooks/ 2. In your template, use the options array to populate the page id into a hidden field that's rendered but not displayed, eg: $forms->embed ('my-form', array('postulate_job' => $page->id));
  18. @cjx2240 yep. LoginRegister & ProcessForgotPassword modules could do with some serious re-work. Especially awkward when the user registers in a browser that's not their default or on a different device
  19. You may want to revise this line. 'get' will return only the first match. To return a page array, you need $pages as well. Try: <?php $children = $pages->find('template=onecolumn|twocolumn, sort=sort');
  20. @wbmnfktr thanks for the tips ? Version so old, cache had only one folder LOL Tested in a staging environment. Upgrade of PW core - almost 150 versions from 2.3.0 to 3.0.141 - worked first time. Gotta love it! Couple of modules needed upgrading and most went smoothly. Solved issues with ProcessCustomAdminPages. Couldn't upgrade so recreated the admin pages and assigned the necessary templates Now resolving a few hiccoughs with custom template code and confident I'll get through
  21. @bernhard would definitely do that if I had the option. The AWOL developer did a fabulous job and the code is beautifully written. I need to do the upgrade first to prove myself to the client. The rebuilt site will use the old data and redesigned to take advantage of the power of today's PW - hopefully mainly template work with a few new modules. Client has used WP in the past and couldn't believe the PW2.3.0 site still worked and hadn't needed one security update in all that time
  22. This 2.3.0 site once upgraded will need a redo of design & functionality too. That's Stage 2. Need to get Stage 1 done first
  23. Noticed a couple of posts in the forums today regarding upgrading from 2.x to 3.x just when I won a new client who has a PW 2.3.0 site that needs upgrading. Yes, you read that right 2.3.0, 5+yo and still going strong without a single security update. Confident it can be done and welcome any tips/tricks/hints/tutorials to avoid pitfalls
  24. Had this same issue today, ie get the customised label for a page/template field and tried all the above. They all returned the original field label and couldn't find any reference to the 'true' option when getting 'fields' or 'field' in the API Docs. Maybe PW has moved on or more likely, I missed something. Anyway, what did work for me was: $page->getField("body")->label; https://processwire.com/api/ref/page/get-field/
  25. @a-ok try adding $p->of(false); before adding the image. You've included output formatting off above when creating the page, but then the page is saved which automatically turns it on again.
×
×
  • Create New...