Jump to content

Robin S

Members
  • Posts

    5,039
  • Joined

  • Days Won

    340

Everything posted by Robin S

  1. @robinc, check out this module code in a Gist by @adrian: https://gist.github.com/adrianbj/2b3b6b40f64a816d397f
  2. Hi @joshuag - any update on this issue? Are you able to reproduce the issue at your end?
  3. Not saying it's a good idea because I have no idea how stable it would be, but if you wanted to share all the modules between the sites you could do something like this in each /site/config.php: $config->paths->siteModules = $config->paths->root . 'shared/modules/'; $config->urls->siteModules = $config->urls->root . 'shared/modules/';
  4. There is this: If you are looking at doing more specific searches with FieldtypeComments::find() be aware of this issue.
  5. 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"}}]
  6. 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.
  7. @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);
  8. 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.
  9. 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
  10. @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.
  11. 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.
  12. PW featured in the article "10+ Free Alternative Open Source CMS Tools to Explore". https://designmodo.com/free-cms/
  13. 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");
  14. @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.
  15. 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.
  16. 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.
  17. You can get the total number of pages found by a selector with a limit applied by using getTotal()
  18. 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?
  19. 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.
  20. @Sipho, the name tip only appears if $config->debug = true
  21. 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.
  22. Maybe this works...? return $page->getFormatted('title');
  23. @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
×
×
  • Create New...