-
Posts
4,956 -
Joined
-
Last visited
-
Days Won
100
Everything posted by LostKobrakai
-
Giving access to change created user to non superusers
LostKobrakai replied to quickjeff's topic in General Support
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. -
Giving access to change created user to non superusers
LostKobrakai replied to quickjeff's topic in General Support
Does it really need to be the created field and not simply an page field, where one can select the author? -
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 }
-
Change $config->httpHost for local development?
LostKobrakai replied to steveooo's topic in Module/Plugin Development
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. -
Change $config->httpHost for local development?
LostKobrakai replied to steveooo's topic in Module/Plugin Development
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. -
Now that's a nice one I almost did write a analysis about the magazine for one of my courses as university.
-
UX nightmare: nested modals in theme (default & Reno)
LostKobrakai replied to steveooo's topic in Themes and Profiles
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. -
Truncate content of fields in admin columns
LostKobrakai replied to bluemultimedia's topic in General Support
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. -
Truncate content of fields in admin columns
LostKobrakai replied to bluemultimedia's topic in General Support
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. -
Truncate content of fields in admin columns
LostKobrakai replied to bluemultimedia's topic in General Support
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. -
Change $config->httpHost for local development?
LostKobrakai replied to steveooo's topic in Module/Plugin Development
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. -
Language switching.. it's possible?
LostKobrakai replied to solido's topic in Multi-Language Support
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. -
Language switching.. it's possible?
LostKobrakai replied to solido's topic in Multi-Language Support
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. -
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.
-
The config path variables do update with moving the installation.
-
suppressing update of modified timestamp did not work
LostKobrakai replied to horst's topic in General Support
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. -
suppressing update of modified timestamp did not work
LostKobrakai replied to horst's topic in General Support
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? -
suppressing update of modified timestamp did not work
LostKobrakai replied to horst's topic in General Support
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()'; -
Pagetree: moving pages in very long branches
LostKobrakai replied to horst's topic in General Support
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. -
RT @processwire: Today we're proud to announce that ProcessWire 2.7 is officially released! https://t.co/UaTYoMIBF0
-
Not sure if it's a problem, but I'd not use those dynamic variable names, but rather just $lang, $langDefault.