Jump to content

LostKobrakai

PW-Moderators
  • Posts

    4,956
  • Joined

  • Last visited

  • Days Won

    100

Everything posted by LostKobrakai

  1. Then maybe something like this to show such a user selection and instead of saving it to a custom field overwrite the created user: https://processwire.com/talk/topic/11069-sorting-images-in-backend/?p=103687 Alterntively you could also use a real field and use a hook to Pages::saveReady to update the created field.
  2. Does it really need to be the created field and not simply an page field, where one can select the author?
  3. Requiring the "to be first loaded" module on the "to be later loaded" module should be sufficient.
  4. First of all your hooked function is the wrong one. Field::save is called when a fieldsettings should be saved, but not when fielddata should be saved. You should rather use Page::saved, which is called right after a page is saved. $this->addHookAfter('Pages::saved', $this, 'afterSaved'); /** * DocBlock from wire/core/Pages.php * @param Page $page The page that was saved * @param array $changes Array of field names that changed * @param array $values Array of values that changed, if values were being recorded, see Wire::getChanges(true) for details. */ public function afterSaved($event) { $page = $event->arguments(0); $changes = $event->arguments(1); $values = $event->arguments(2); // Check for your conditions and send email }
  5. It's sparsely used throughout the core mostly when https redirection is needed or if links will be used outside the browser context (e.g. emails). And of course everywhere you used httpUrl. Where you can't be so sure it actually not the core, but any third party modules. You shouldn't really be able to damage things by changing it, as the variable shouldn't be saved anywhere and rebuild on each request.
  6. I've to support Bernhard in his opinion. Why go through the hassle of changing the internal domain name representation, where you don't know the consequences, when setting up the correct hostname for your vagrant machine's ip is so easy and quick.
  7. Now that's a nice one I almost did write a analysis about the magazine for one of my courses as university.
  8. You could ask Ryan to make InputfieldPageTable::getItemEditURL hookable. Then you could simply remove the "modal=1". Currently you could hook after InputfieldPageTable::renderTable and use string replacement to get rid of "&modal=1" on the whole table.
  9. In your hook you can just return without doing anything if your criteria weren't met. No need to retrieve the field value again. You can certainly post this on Github, as it's at least unexpected that the hook isn't called.
  10. It's strange that this would result in different markup, as the rows should be build by the same code. I've no idea why this would happen. But I'd suggest to limit the functionality down by template or something like this, as this hook will currently hit all listers/pagetables that show textareas. Of course only if that's not your intention.
  11. PageTables do use the markupValue function of fields to determine their content. The function can easily be hooked to manipulate or change the returned markup. E.g. in ready.php $wire->addHookAfter('Fieldtype::markupValue', function($event) { $page = $event->arguments(0); $field = $event->arguments(1); // change the markup if needed $event->return = $customMarkup }); Another option could be adding a runtime property to the pages, which holds the right values and use this one in the pagetable.
  12. You can have a separate config-dev.php besides config.php, which will be loaded if present. Just overwrite the httpHosts array there and not upload it to your live server. Edit: Actually the config-dev.php will replace the config.php, so it needs to be a full copy with some changes. Edit2: And I misunderstood it again like last evening. My suggestion won't of course change your saved domain names in the database. The problem is, that you cannot simply make that work with changing the httpHosts array, as that's not how the multisite module does work. httpHosts is only a whitelist to check against, but the domain does get parsed from various request data. So accessing pw via multi-site.local will either result in an domain multi-site.local or the first domain of httpHosts, if multi-site.local isn't part of the whitelist. So you either need to change the domain names you set up, or you need to include this replacement in the multisite module itself.
  13. While your idea is great I'd suggest another systematic. It would be better to restrict images by it's area and not by edge sizes, e.g. 400x600, as well as 600x400, results in an area of 240k px and it would also allow for images sized 490x490 meaning it's not dependent on any format.
  14. Nope just create a new language and without language packs it just stays "untranslated", which is english in the case of the backend admin. In your custom code untranslated would mean the language you used directly in the code.
  15. It's true that this might be annoying, but it's named "Default" and not English for a reason. There's also this topic about changing the default language: https://processwire.com/talk/topic/11451-change-default-language-revisited/ And there's also the risky option to just go an rename all the columns of multi language fields.
  16. Just redirect before the mentioned .htaccess rule. But I'd also suggest looking into ProcessRedirects or Jumplinks, which are GUI modules, where you can set up redirects.
  17. The config path variables do update with moving the installation.
  18. Ryan did move the whole page actions handling to a separate file, therefore the old translations won't work anymore.
  19. Did you update the language pack? Providing, that there's already a 2.7 one out yet.
  20. Now that's interesting. The data array seems to be correct even after the if statement, so something in the lines below must be the culprit. Maybe some db query caching or such? That's maybe a bit to deep even for my knowledge of the core.
  21. Did you try checking if the quiet setting is correctly delivered to the savePageQuery() func and if the other values are still correct there just before the if statement?
  22. If your using the quiet mode it's not ignoring the modified field, but just again setting it with the old values, so modified and modified_user need to be set to not be updated (see more here): $data['modified_users_id'] = (int) ($page->modified_users_id ? $page->modified_users_id : $userID); … if($page->modified > 0) $data['modified'] = date('Y-m-d H:i:s', $page->modified); else if($isNew) $sql = 'modified=NOW()';
  23. I was about to say, that you could add the page field via the hook as well, but I think it's actually quite nice to just look if the page field is part of a page and enhance it automatically. So one doesn't have to touch the hooks code after setting the fields name once.
  24. RT @processwire: Today we're proud to announce that ProcessWire 2.7 is officially released! https://t.co/UaTYoMIBF0

  25. Not sure if it's a problem, but I'd not use those dynamic variable names, but rather just $lang, $langDefault.
×
×
  • Create New...