-
Posts
4,932 -
Joined
-
Days Won
321
Everything posted by Robin S
-
Hooks, compare page before and after save
Robin S replied to heldercervantes's topic in General Support
Also see this post: -
Looks normal, so must something particular about the GitHub URL or the way that it is accessed that causes it to be blocked. It may be something that only your host can advise you on. You could try and set up a basic case to serve as a demonstration for them. ProcessWireUpgradeCheck.module basically does what I showed in a post above. If you take a look into WireHttp.php here and here you should be able to extract some of that code to create a basic test case in a PHP file that demonstrates the problem. For reference, here is what you should see when executing the code I posted above: [{"name":"dev","commit":{"sha":"651e8bd20c1f7bf13c08a2098f862adf82700a28","url":"https://api.github.com/repos/processwire/processwire/commits/651e8bd20c1f7bf13c08a2098f862adf82700a28"}},{"name":"master","commit":{"sha":"57b297fd1d828961b20ef29782012f75957d6886","url":"https://api.github.com/repos/processwire/processwire/commits/57b297fd1d828961b20ef29782012f75957d6886"}}]
-
I think your result means that the problem isn't with GitHub - the request is not being sent successfully. Perhaps a firewall or some other security restriction on your server is blocking it. Are you able to use fopen() on any remote files? If you put this in your template... $handle = fopen('https://www.google.com/', 'r'); bd($handle, 'handle'); ...Tracy should show a stream resource in the dump.
-
@DaveP, the GitHub API can respond with a 403 in a number of different situations, as described here: https://developer.github.com/v3/ But there should be some explanation in the "message" value of the returned JSON. You could put this in a template and see what you get back: $http = new WireHttp(); $http->setHeader('User-Agent', 'ProcessWireUpgrade'); $json = $http->get('https://api.github.com/repos/processwire/processwire/branches'); print_r($json);
-
I don't think there is any bug to report here - a $pages->find() selector must ultimately become an SQL query and the selector sort options become an ORDER BY clause. You cannot do something in an SQL query like "sort by some column but if that column is empty for a row then use some other column instead". But I guess you could make a request in processwire-requests in case Ryan can come up with some wizardry to allow OR sorting.
-
Page Reference field not updating with 'Show if...'
Robin S replied to Tom H's topic in General Support
Not sure why it half-works with role names, but the Roles field is a Page field and the correct way to match a Page field in an inputfield dependency is by ID. https://processwire.com/api/selectors/inputfield-dependencies/#example-page- 9 replies
-
- 3
-
- page reference
- show if
-
(and 1 more)
Tagged with:
-
@webaff, just to spell out what @bernhard is suggesting... For each language-alternate field you have, you can add a datetime or text field to the template to store the modified date. Here is an example hook for a single language: $pages->addHookAfter('saveReady', function(HookEvent $event) { $page = $event->arguments(0); if($page->template->name !== 'basic-page') return; // match whatever template you need // Output formatting is off in saveReady so File fields are WireArrays regardless of field settings if(count($page->file_german)) { // Use the modified timestamp of the German file field if a file exists $page->modified_german = $page->file_german->first->modified; } elseif(count($page->file)) { // Otherwise use the default file field if a file exists $page->modified_german = $page->file->first->modified; } }); Then you sort by "modified_german" in your selector.
-
How to use language-alternate fields inside selectors?
Robin S replied to webaff's topic in API & Templates
This error is likely caused by a page in your $matches PageArray having an empty file field. If there is no file then you cannot get the modified timestamp, hence the error. The issue is not related to language alternate fields and would also occur in your default file field if one was empty. -
PW featured in the article "10+ Free Alternative Open Source CMS Tools to Explore". https://designmodo.com/free-cms/
-
FieldTypeFile file names/description in search query
Robin S replied to MilenKo's topic in General Support
You can use the %=, ^= or $= operators to match the basename in a Files or Images field. $matches = $pages->find("file_upload%=$q"); You can use any of the operators on the description subfield. $matches = $pages->find("file_upload.description~=$q"); -
is it possible to link directly to the content or delete tab?
Robin S replied to bernhard's topic in General Support
@bernhard, try replacing this part of panel.js with... if(typeof panelURL != 'undefined' && panelURL.length) { var hash = ''; if(panelURL.indexOf('#') > -1) { var url_parts = panelURL.split('#'); panelURL = url_parts[0]; hash = '#' + url_parts[1]; } panelURL += (panelURL.indexOf('?') > -1 ? '&' : '?') + 'modal=panel&pw_panel='; if($toggler !== null && $toggler.hasClass('pw-panel-links')) { panelURL += '2'; // don't update target of links in panel } else { panelURL += '1'; // update target of links in panel } panelURL += hash; } Let me know if it works for you and if so I'll suggest it on the PW GitHub. -
is it possible to link directly to the content or delete tab?
Robin S replied to bernhard's topic in General Support
A link like /page/edit/?id=123#ProcessPageEditDelete works as expected when used as a "normal" link, so I think this issue is about the limitations of pw-panel rather than the link itself. -
Page Reference field not updating with 'Show if...'
Robin S replied to Tom H's topic in General Support
The value of each Roles checkbox is the ID of the role, so you must use ID(s) in your "show if" condition. Then the field with the show-if dependency will save as expected.- 9 replies
-
- 1
-
- page reference
- show if
-
(and 1 more)
Tagged with:
-
You can get the total number of pages found by a selector with a limit applied by using getTotal()
-
How do I use the API to test for session timeout?
Robin S replied to dweeda's topic in Getting Started
I think using $user->isLoggedin() should work fine. if(!$user->isLoggedin()) { $session->redirect('/some-url/'); } In what way is it not working like you expect? -
Welcome @sanstraces You need to save the page after you set the name. public function hookAfterAdded($event) { $page = $event->arguments[0]; $page->name = $page->name .'-'. $page->id; $page->save(); $this->message('added '.$page->name); } Normally the $page->setAndSave() method is useful in these situations, but there seems to be a bug when saving the page name.
-
Get template's allowed templates for children from API
Robin S replied to Sipho's topic in API & Templates
@Sipho, the name tip only appears if $config->debug = true -
Checking if Pages are already created, if not; create page
Robin S replied to louisstephens's topic in API & Templates
I think $pages->count() supports the same selectors as $pages->find(), plus you can supply an options array with "findAll", so should be no problem counting hidden or unpublished pages. -
unable to set $page->of(true) inside __invoke($page)
Robin S replied to bernhard's topic in Getting Started
Maybe this works...? return $page->getFormatted('title'); -
@ocr_b, you get the JSON parse error because the response from the server is some error message rather than the JSON object that is expected. If you search the forum (using Google) you'll find a number of topics that could be useful in tracking down the problem. Here are a couple: Based on comments in the forum some things to look at are: post_max_size, upload_max_filesize, max_execution_time, max_input_time, memory_limit mod_security (disable it) upload_tmp_dir
-
@Margie, it's likely that the error you're seeing is due to interference by the mod_security Apache module. Ask your host to disable mod_security and it should resolve your issue.
-
I would say that anyone already using the module on older websites is probably happy enough with the existing functionality and should stick with v0.0.2. PW will show a warning for anyone trying to upgrade that does not meet the minimum version dependency. Not sure if the Upgrades module will actually refuse to upgrade in such a situation (I don't have an easy way to check) but you could include an additional warning advising to revert to v0.0.2: /** * Upgrade */ public function ___upgrade($fromVersion, $toVersion) { // Upgrade from < v0.0.3 if($fromVersion < 3) { if($this->config->version < '3.0.61') { throw new WireException("The minimum required ProcessWire version is 3.0.61. Please revert to Selectize Image Tags v0.0.2"); } } }
-
The demo site uses Lister Pro (it's debatable whether pro modules should be used in the demo site but that's another discussion) but you can achieve something similar by using a bookmark for the basic core Lister. Visit the "Find" lister and set up the filters and columns how you like to show the skyscrapers or whatever your pages are about. Then save that configuration as a bookmark on the Bookmarks tab. The bookmark appears as a child menu item of the Find section, but as @tpr suggests you can include a link to the bookmark in the main Pages menu using the NavItems feature in AdminOnSteroids.
-
Hi @Macrura, I made a pull request for SelectizeImageTags with fixes for AJAX-loaded fields, repeaters, and for new image uploads. For AJAX-loaded fields and repeaters it was necessary to hook the relatively new renderReadyHook() instead of render(). So as a result the minimum required PW version is 3.0.61. If that is a concern there is a completely different approach possible that could support older versions but it has its own shortcomings. Happy to discuss if you like. I forgot to include the change mentioned above: Maybe you could make that change too. And when you get a chance could you look at applying similar changes to InputfieldSelectize so that will support AJAX-loading/repeaters also? Thanks.