gRegor

Members
  • Content Count

    87
  • Joined

  • Last visited

  • Days Won

    2

gRegor last won the day on March 18 2016

gRegor had the most liked content!

Community Reputation

72 Excellent

About gRegor

  • Rank
    Full Member
  • Birthday 12/26/1978

Contact Methods

  • Website URL
    https://gregorlove.com

Profile Information

  • Gender
    Male
  • Location
    San Diego, CA

Recent Profile Visitors

5,766 profile views
  1. This looks awesome! I was considering a similar advanced DateTime module that would store the UTC offset in addition to the timestamp, so in the UI you could select the date, time, and timezone. I might try this out and see if I can extend it for that purpose.
  2. gRegor

    That sounds like an odd server setup. $config->path->assets should give you the full path. Glad you got it working, though.
  3. gRegor

    Nice! I'd not seen this feature.
  4. gRegor

    For redirection (PRG), you can use http://processwire.com/api/ref/session/redirect/ Since you're using POST values in your selectors, you should sanitize them first. To customize the selector based on which fields are submitted in the POST, I would do something like this: $temp = []; if ( $input->post->product_brand_name ) { $temp[] = 'product_brand_name=' . $sanitizer->selectorValue($input->post->product_brand_name); } if ( $input->post->product_type ) { $temp[] = 'product_type=' . $sanitizer->selectorValue($input->post->product_type); } // ... and so on $selector = implode(',', $temp);
  5. gRegor

    PW's `$session` stores data in `$_SESSION` but it's "namespaced" in the array. E.g. `$session->value` != `$_SESSION['value']` I'd recommend using the PW `$session` if possible instead of mixing and matching with `$_SESSION`. In PW3 you can also use `$input->requestMethod()` for request method checks. https://processwire.com/api/ref/session/ https://processwire.com/api/ref/input/
  6. gRegor

    Oops, I made a mistake in the directory update! I linked to the PW2 zip file instead of the PW3 zip file. If you tried to install this on PW3 using the "Add Module From Directory" option between yesterday's announcement and just now, please uninstall and try installing it fresh. The directory is updated now to point to the correct zip file. If you're on a PW2 site, the instructions in the release post are still correct.
  7. gRegor

    This works for me when hooked in ready.php (see below). It looks like if you're hooking within a template include, it's too late in the ProcessWire startup / page delivery process. That's what @kongondo was referring to with "too late". It's more than just the order of the includes in the template file, or whether your script exits instead of continues. Here's the code that worked for me in /site/ready.php: <?php namespace ProcessWire; function hookPath(HookEvent $event) { echo sprintf('The path is: %s', $event->return); exit; } $wire->addHookAfter('Page::path', 'hookPath'); I still think hooking like this to perform a redirect might be overkill for what you described in your last post.
  8. gRegor

    I'm trying out these hooks myself to see if I can get them working, however based on your latest post I might suggest a different approach. If you have URLs that are going to have that many query parameters and lots of variants, you might be better off writing code to process them using the `$input->get` variables and then redirect to the correct page using `$session->redirect()`. I presume if the query parameters have different values, they'll go to different destinations. Alternately, if these are a lot of legacy URLs that you want redirected to new canonical pages, putting those redirects directly in .htaccess with mod_rewrite might be better (or using a redirect URLs plugin).
  9. gRegor

    Version 2.0.0 is finally here and supports ProcessWire 3! Release post: https://gregorlove.com/2018/05/webmention-for-processwire-update/ Modules directory: https://modules.processwire.com/modules/webmention/ Update to support ProcessWire 3.x Update php-mf2 library to version 0.4.x Improve verification of source linking to target Fix delete webmention bug Fix webmention author display in admin Fix WebmentionList render() method If you're still on ProcessWire 2, you're not forgotten. :] Check the release post for more details. As usual, if you are using this plugin I would love to hear from you. Feel free to send webmentions to the release post linked above.
  10. Aha, that makes sense. For now I'll make a note the field should be entered in uppercase, then I'll use strtoupper() when building my selector. Thanks!
  11. gRegor

    I've done a simple version of this by hashing the file's modified time: $js_version = md5(filemtime($config->paths->assets . 'js/script.js')); echo sprintf('<script src="%sjs/script.js?v=%s"></script>', $config->urls->assets, $js_version);
  12. I understand from the selectors documentation: I have a repeater field `promo_codes` consisting of text field `title` and an integer field `number1`. I'm running a find: $page->promo_codes->find('title=gmtest'); The database column collation is `utf8_general_ci` so I would expect this to work, but it only works when I match the case exactly ("GMTEST"). This is on PW 3.0.42. Any ideas? Is there an exception for finds on repeater fields?
  13. gRegor

    I'm working on a PW 3.x version of the module in this branch: https://github.com/gRegorLove/ProcessWire-Webmention/tree/master-pw3. It's in beta currently; it should generally work, but if you run into any problems, let me know. Also, I realized it was not obvious that the webmention endpoint requires a template file in order for this plugin to work. Otherwise the endpoint would return 404 to any requests. I've added a sample template file here and info in the README: https://github.com/gRegorLove/ProcessWire-Webmention/blob/master/Webmention/extras/site/templates/webmention-endpoint.php I hope to release 1.1.4 soon along with an official PW3 version.
  14. I'm running into this too, with my Webmentions module on a fresh install (the FieldTypeWebmention I based a lot on this comments module). Best I can tell, the issue seems to be that when you add a field, getDatabaseSchema is called for the first time. Since there is no $field->schemaVersion set at that point, it tries to run the first ALTER TABLE query before the field's table has been created. Update: I think I've found a solution. In getDatabaseSchema I first set a boolean: $table_exists = in_array($field->getTable(), $this->database->getTables()); Then any schema upgrades can be inside an if/else conditional: if ( $table_exists ) { # update to schema version 1 if ( $current_schema_version < 1 ) { # perform schema updates } } else { $field->schemaVersion = self::SCHEMA_VERSION; $field->save(); } I'm also tracking the current schema version in the class constant SCHEMA_VERSION. Hopefully this helps other developers. Feedback is welcome!
  15. FYI: I noticed when I was updating my Webmention plugin in the directory last night that 2.8 wasn't an option under compatibility.