Jump to content

adrian

PW-Moderators
  • Posts

    11,129
  • Joined

  • Last visited

  • Days Won

    366

Everything posted by adrian

  1. I was trying to be extra cautious just in case someone could spoof DETECT mode, although I don't really think that is an issue - I will revisit this sometime soon, because it would be nice if this was always available. Use the "Logout" button - that will log you out so you are a "guest", but still keep the Tracy debug bar available and keep the User Switcher session alive. Feel free to post any suggestions for improvements as you play around with this.
  2. Hi @Ivan Gretsky - you need to manually set the output mode to "DEVELOPMENT" to make the User Switcher work. I initially set it up this way as an additional security layer, but I am thinking about revising the need to do this. Let me know if you still have any problems.
  3. @palacios000 - you need the "filename" rather than "url" of the attachment. Also if the files field allows more than one, make sure to do first() etc as well.
  4. Hey @tpr - as I mentioned here: https://github.com/ryancramerdesign/AdminThemeUikit/issues/20, the icons only PageList option doesn't work in the UiKit theme sidebar. Now maybe Ryan will add this option to the core, but if not, it would be good to get fixed in AoS. Also, the full width hover links don't work. And also wondering if you can make an icon for the template link in the PageList - this would also help with allowing the width of the sidebar to be narrower. I understand that the UiKit theme is still a moving target, so just ideas for you at the moment
  5. You might also try conditional hooks: https://processwire.com/blog/posts/new-ajax-driven-inputs-conditional-hooks-template-family-settings-and-more/#new-conditional-hooks
  6. It's probably the valid extensions and missing max files settings - take a look at the Details tab of an image field. I would set those and maybe also the formatted value setting.
  7. The page object is not available in init(). You need to use ready()
  8. Try seats.name=5 and year.name=2008 With page reference fields you are supposed to specify the subfield from the page that has been selected. I never actually realized that some work without specifying the subfield, but I just tested an can confirm what you are seeing. Not sure if this is really a bug or not, but I would definitely recommend always specifying the subfield (either name, title, or any other field from the selected page).
  9. Hey @kongondo - note the Page within each Matrix item. Each one of these contains a full reference to the current page. This comes from dumping $page->matrix_field Here is the dump of $rows and $columns from the export function. You can see that each row is a full PW page object. Is this expected?
  10. This should work: wire()->addHookBefore("ProcessLogin::executeLogout", null, "setRedirect"); function setRedirect(HookEvent $event) { $event->object->setLogoutURL(wire('pages')->get('/')->httpUrl); }
  11. In repeaters: and if you need it for PageTable, @Robin created this: http://modules.processwire.com/modules/limit-page-table/
  12. Some more thoughts on this - I wonder if maybe it's just best to turn on output formatting - that should handle getting the language for the current user. On an unrelated note, I noticed that each entry in the matrix is a full PageArray - is this necessary? I haven't looked into/thought through this, but it seems like a lot of info to have in memory when all we need is a single value with its relevant row and column page ids. Maybe the full PageArray is needed, or maybe it doesn't matter - just thought I'd ask
  13. That's an entry from the "caches" DB table so you can either empty that table, or ignore if the error didn't prevent the other tables from importing.
  14. Ok, I figured it out and have a quick fix in place. It was a multi-language issue. This is my quick fix - to get the default row and column titles, rather than returning a title object. //prepare export values foreach($rows as $row) { $rowTitle = $row->title->getLanguageValue("default"); //only export selected rows if(!in_array($row->id, $rowsChecked)) continue; foreach($columns as $column) { $columnTitle = $column->title->getLanguageValue("default"); //get each matrix value at given coordinates (WireArray) $v = $values->get("rowLabel=$rowTitle, columnLabel=$columnTitle"); $value = $v ? $v->value : '';//force blank values export $exportMatrix[$row->id][$this->_('Row Label')] = $rowTitle; $exportMatrix[$row->id][$columnTitle] = $value; } } Not sure if you want to implement just like this, or whether you think it's worth adding a more complete ML solution. PS - what about changing "Row Label" to the title of the parent page of the first column. In my case I have a page branch of Years to control this column. It would be much nicer if this read "Years" or "Year". Would that work, or are there more things to consider?
  15. Hey @kongondo - I just went to export for the first time and noticed that all I get is the first column entitled "Row Label". Is there something I am missing, or is this a bug? I need this pretty urgently (actually immediately), so I am going to take a look and see what I can figure out, but in case you happy to be online and have an idea for a solution, or something I am missing, that would be great
  16. It should work if you do this: $buildings = $pages->find("template=building-entry"); $allTowns = $buildings->explode('addressBuildingTown'); $uniqueSortedTowns = sort(array_unique($allTowns)); IIRC this notice is new to PHP 7. Google it and you will get some explanations as to what's going on. EDIT: Oops - not sure when you made your edit to show what works, but somehow I didn't see it
  17. Thanks for the explanation and for the "Grant Field Access" config option. I definitely see your logic behind treating access the other way around. I guess I was just considering the situation where you have a regular web site where you want to be able to use the PW API as well as GraphQL. In this situation I would have no problem with all fields being accessible, so great that option is available!
  18. Fantastic video @Nurguly Ashyrov - really well put together and great English - I don't know how you come across so clearly given that you haven't spoken it in 6 years! I am really excited to start using this module. The one thing I noticed which seemed a little weird to me was that by default the skyscraper-editor (or guest) user didn't have access to fields until you enabled field level access control and explicitly gave them view access (~35:10 min mark in video). By default in ProcessWire, anyone can view a field if field level access control is turned off. Only once it is turned on are any restrictions applied. Does that make sense, or did I misinterpret something? Thanks again - this is going to be so very useful!
  19. Variables declared in _init.php are available in all templates, but php scoping rules still apply when trying to access a variable inside a function. Remember, even if you tried to access $body (defined in _init.php) in a function elsewhere in _init.php, you still wouldn't be able to.
  20. Does this work? $p = $this->storagePage; $p->of(false); $p->pdfStorage_files->add($path); $p->save('pdfStorage_files'); return $p->pdfStorage_files; Not sure if your problem is the missing $p->of(false) or trying to save the $files pagefile object instead of the "pdfStorage_files" field name. PS - what @Robin S said
  21. I think it's just about PHP variable scope. When you use PHP's built in "include" it is including the contents of the file directly, but when you call a custom function to do the include (eg wireIncludeFile(), or your own custom function), then the $body variable doesn't make it through, which is why wireIncludeFile() and wireRenderFile() have the ability to pass variables in an array.
  22. Well, it's been a long time coming, and not sure if it's exactly what you had in mind, but I just added a new "Git Info" panel that displays Git branch, latest commit message, etc for your site (assuming you have it under Git version control). This is just the first version. My goal is to add color coding of the icon (like many other panels) to get your attention. I am looking for feedback on this though. I could either make it possible to configure different colors for different branches, or else I could try to match the branch name against the subdomain / extension, eg. dev.mysite.com, staging.mysite.com or mysite.dev, mysite.staging, etc and color green if they match and red as a warning if they don't. Anyone have any thoughts on the best approach? On another note, I just had to do quite a bit of work fixing the "Versions List" feature on the ProcessWire Info panel - two recent Tracy core updates broke this functionality and I just noticed. Also, it looks like Github changed the way they handle line breaks inside <details> tags, so also had to tweak that, but I think everything is working again now!
  23. What @LostKobrakai said, but if you really want to do it, you can make use of these in the module info: 'permission' => 'page-view', 'permissionMethod' => 'permissionCheck', permisssionCheck() may look something like this: public static function permissionCheck(array $data) { $user = $data['user']; $wire = $data['wire']; // if in admin/backend, then require "my-custom-permission" permission if(strpos($wire->input->url, $wire->config->urls->admin) === 0 && !$user->hasPermission('my-custom-permission')) { return false; } // else in frontend, so allow full access to call actions via the API else { return true; } }
  24. Yes, adding the namespace is the "correct" way to do things with PW 3 when starting new projects. The file compiler was built primarily as a way to facilitate easy upgrades from PW 2.x without needing to change any files, and also to support non-namespaced modules in PW 3.
  25. So what is happening there is that the file compiler is kicking in when you haven't manually declared the namespace. The file compiler turns: include($config->paths->templates . "views/{$page->template->name}"); into: include(\ProcessWire\wire('files')->compile($config->paths->templates . "views/{$page->template->name}",array('includes'=>true,'namespace'=>true,'modules'=>true,'skipIfNamespace'=>true))); The PW compile method is converting that path and adding the .php extension. You can test it yourself: Anyway, I don't think you should rely on the file compiler to do that - either add the extension, or use wireIncludeFile()
×
×
  • Create New...