Jump to content

BrendonKoz

Members
  • Posts

    432
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by BrendonKoz

  1. This might be a question for @ryan, though I'm not aware of any selector for this, but again, I'm, unfortunately, also not well-versed in a multilingual setup. It does appear, based on @bernhard's discovery, that looping through the available result set of all options can get you what you need...I think.
  2. Have you tried the template settings for file-level access control? It might not be exactly what you want (without some fiddling), but it's what currently seems the closest thing to what you're looking for.
  3. I took Ryan's old Page Edit Per User module and modified it to: Allow users to assign access on pages they have edit access on (and pages they create) Check a field on the page, and current user, and make sure there is a matching value (ex: multiselect field on both the user account and the page) Allow adding pages so long as they have access to a parent page Setup: Assign a role that has "page-edit" granted, but no templates are explicitly assigned to this access. A multiselect text tag field is assigned to both the user profile template, and any templates of pages that I want the ability for access levels to be controlled. (example values of tags: HR, PR, IT, Administration, ...etc...) When a user has a tag value assigned that matches a page's tag value, access to edit (and/or add) is granted. It's mostly working (from the page tree) (I thought it was, the add button is visible, but the same error is displayed when clicking it); I have one instance where a parent isn't displaying the add button for children, but I'll look at that shortly... What definitely is not working: the "Add New" button is (surprisingly) properly displaying templates of pages that users have access to add based on my changes, but once a user tries to use that button, it displays the following error: This makes sense since the role doesn't assign any explicit templates, but now I'm trying to override that. I suspect once I fix this that there will be another area I'll also need to hook, but... This message is part of ProcessPageAdd::___execute(). I tried to hook into `ProcessPageAdd::getAllowedTemplates` because in `execute`, it throws that error only if the template of the page to add isn't already defined in ProcessPageAdd::allowedTemplates. I might be going about this all wrong, but in the init() method of my adjusted PageEditPerUser, I have the following: wire()->addHookBefore('ProcessPageAdd::getAllowedTemplates', $this, 'hookAllowedTemplates'); ...and then the method: /** * ProcessPageAdd::getAllowedTemplates hook * */ public function hookAllowedTemplates($event) { // bd('hookAllowedTemplates'); // bd($event, 'event'); // bd($event->object, 'event->object'); // bd($event->arguments(), 'event->arguments'); $event->replace = true; $allowedTemplates = []; $allowedTemplates[input()->get->template_id] = templates()->get(input()->get->template_id); return $allowedTemplates; } One thing I struggle with, without others' examples, is what return value (and format) is expected from pre/post hooks. In this case I tried to completely replace the call to ProcessPageAdd::getAllowedTemplates because the value of $event->object->allowedTemplates in the post-hook is similar to a numerically indexed (by template ID) array of a template object (but contains a few more properties), but I still received the error as shown above. (I know I'll need to do more checks on the values assigned in the above method call depending on scenario; right now my tests all have valid parent and template IDs, so I just want to get that working first.) Any potential thoughts, either at what to look at, or where to further debug? (...or more code to share?)
  4. I unfortunately haven't had any experience working on a multilingual site, but hopefully merging the two following solutions together will get you on your way?
  5. Are you able to see the categories from the public side of the interface when you're logged in as admin? If so, it might just be a permissions issue. If not, there's unfortunately too little information to go by in your description to really identify what's going wrong. Can you elaborate a bit more? Is the visibility just a UiKit thing, or is it a PW page attribute? How are your associations (parent/children) configured? What does your categories.php content that (1)queries for the categories and then loops through to display them look like?
  6. If it's only an issue on Apple devices, then it's likely either (1)an update to Safari, or a (2)coincidence that both device's browsers got some sort of strange file corruption in their cache. Another options is that (3)it is just something kind of weird. Give it a day, turn the device(s) fully off and see what happens the next day. Sometimes hardware likes a nice rest, too. You could try hard-refreshing the pages on your Apple devices to see if that helps, or clear cookies and temporary cache (which may also delete saved passwords or logged-in accounts on websites for those devices).
  7. The fun, and not-so-fun (in this regard) thing about ProcessWire is that it gives a lot of control over how to use it to the developer(s) creating the website(s) with it. It's a CMS/F (Content Management System/Framework). The reason I state this is because doing what you did, depending on how the original developer handled things, could work. Typically though, when you create a field, you then add that field to a template (or multiple templates) you wish to use it in, and then with the page(s) that are assigned that template, you reference it from within the PHP code of the template file(s). There are ways to create globally accessible fields so that it will always be accessible to editing from the interactive administrative back-end, but with something unlikely to be changed by a standard end-user (such as a Google Analytics script), you should be able to just edit the template files directly, and hopefully the prior developer made it easy enough to identify which file contains the code for the standard HTML headers. There are some confusing jargon when you're just getting started with ProcessWire: Templates, and Pages There are "template files" and "[system] templates". ...and "pages" in ProcessWire are essentially units of storage, since nearly everything is a page within the system, essentially a custom-named object that docs refer to. So you create a "page" and usually refer to "$page" objects, but $page objects can have fields (properties that hold values) that are also $page objects. ? Here's a good place to start: https://processwire.com/docs/tutorials/hello-worlds/ If you'd prefer a video walkthrough, although it's a bit advanced, it's recent and does also go through the basics.
  8. Are there any hooks that adjust template sort? Are there any template-based settings for pages that specify the default child sort? I haven't set it myself, but the "Fields" page's sort status under "Admin > Setup" in the page tree might also be set...?
  9. If you haven't yet noticed it, @teppo has hit the 500th issue of PW Weekly! That is a ridiculously massive milestone and an amazing achievement, and after some quick maths, also tells me that he's held strong for almost 10 years now! I'm not sure what's more surprising, that he's managed to keep it going continuously for this long, or that I remember when he started it... That's a long darn time. I may not be a hugely active member of the community, but I'm darn proud to be a part of it regardless. Thank you so much for your devotion to the PW Weekly project, @teppo!!!!
  10. My favorite part of the blog post (and what I was thinking about while reading): ♥ Thanks, Ryan!
  11. The "Thanks" trophy is nice in that it provides reputation points back to members, but aside from a little ego boosting, I don't think it has any terribly high value or merit -- with perhaps the exception of visually providing a means to let other visitors know what replies are worth reading carefully? The "mark as solution" feature is not enabled, or is at least hidden. I'm not sure why the email notifications are still worded that way, but you won't be able to find that button. ?
  12. I'm not finding the "Expect-CT" text coming up in a file search for my ProcessWire sites, nor did I get any results when I searched the ProcessWire GitHub repo. Do you have any 3rd party modules that might inject its own headers? I know you said that other CMSs aren't providing this warning, but have you tried your project on another server just to see if it's definitely PW and not the local development server? (My hunch would be a 3rd party module, but hard to know.)
  13. If your function is placed in ready.php or init.php, then you might have to use wire('page') to get the current page. Have you tried simply using the reserved $page variable to see what would happen? You can always use $pages->get(1) to get the default landing/homepage (or in this case, with the wire method, wire('pages')->get(1)). If the children of the standard ProcessWire homepage are your individual site's homepages, then break that logic out a bit more: <?php foreach wire('pages')->get(1)->children as $homepage) { if (!wire('page') == $homepage) { continue; // Skip to the next iteration of the loop } else { // Place your navigation generating code here, except if you use this, change $page in your code above to $homepage } }
  14. Ohhhhh. I wouldn't have thought to try that. Thanks for explaining, and with the GIFs too! ♥
  15. I've experienced it, and if I'm remembering correctly, it seemed to be related to either (only) a CSS issue, or a JavaScript call that wasn't applying the appropriate class(es) for CSS display. I looked into it for a bit, but since it was only unexpected and not preventing proper functionality I moved on since I never fully solved it. @monollonom Can you explain what you mean in more detail? I didn't quite understand (and am curious); gorny shows two fields (where one field has three options), but you mention three conditionally visible fields...?
  16. Don't forget that you can define/allow overrides for templates based on inputfield settings in the "Overrides" tab of the field. Then the template(s) can allow the override of those particular settings of the field. Alternatively, you don't have to think only about the template settings - you can edit the rendering of the PHP template and check what the current template is, and then render the image's size differently depending on the template. You have the control! ? Image Inputfield Overrides:
  17. Speaking of Softaculous, the PW download page links to Bitnami and AMPSS, but Bitnami's apparently dropped support for PW (a broken integration connection somewhere?), and AMPSS, although likely still works since it's a desktop version of Softaculous, doesn't have a landing page for PW. Super pumped to see an across-the-board update of the Pro modules. I commend Ryan's project management abilities. Fighting off scope creep and staying on-task is a very difficult thing to do (at least for me) when solo-developing, so many compliments to you on that!
  18. Without looking at it directly, I'm pretty sure the default setting/configuration for TinyMCE is to wrap all content in paragraph tags. However it knows enough to not wrap a DIV element in a paragraph, thus it falls back to doing what you notice it does. There should be a way to either disable the automatic paragraph, and/or switch it for a DIV, if that's what you (will always?) want. IIRC both TinyMCE and CKEditor (v4) both do that.
  19. The httpUrl property/method will provide you with what you want, whether referring to a Page, PageImage, or PageFile object. The browser should the full URL when you hover in the status bar area simply because that's what it does, but you are correct in that you need to view source to verify what's being output in code. Typically you don't actually want to hardcode the full URL into the rendered code as it's a bit slower for the client (web visitor's browser) to negotiate the resource. If they're already on your domain, you just refer to the relative path of objects/pages/files on your domain; it's a tiny bit more efficient, and as you've already noticed, the browser automatically identifies/assumes the correct location anyway. If you're running a single website on multiple domains but want to redirect visitors to a specific domain, you could use redirects on the server instead of hardcoded domain-based links, but that doesn't mean you can't do what you're doing either. As for SEO benefits or detriments to this, aside from the speed hit, I'm not sure if there are any. If you plan to generate JSON-LD, Canonical URLs, XML Sitemaps, PDFs, or other potentially downloadable files from your content, that would be one area that could benefit from absolute URLs if you didn't want to do extra work, later on, to adjust the URLs on export. Ultimately though the choice is yours depending on context, needs, and desires - and ProcessWire provides you with that choice! $page->url or $page->httpUrl. To get the current website domain, you'd likely want either $input->httpHostUrl();, or $pages->get(1)->httpUrl; (or $pages->get('/')->httpUrl; they'll both retrieve the home page's absolute path; the home page in ProcessWire always has an ID of 1). Take a gander at the searchable ProcessWire API. For the above, you could find them by searching, "host" (without quotes). For identifying other paths, run a PHP print_r() on $config->urls. ? For reference if anyone else is reading this over and needs it, here's a simplified breakdown of relative vs absolute paths in URLs: https://www.conductor.com/academy/urls/faq/absolute-vs-relative/
  20. A slightly simpler method would be to only handle the logo icon part via SVG, and align the rest with standard (custom styled) HTML markup. I applaud your enthusiasm for including it all though, and will definitely also look through the links that were shared in this discussion. It's so much easier to dynamically generate bitmap images than SVG for things like this, but filesize and other attributes aren't nearly as nice. Shoot, if you had a specific template in mind (like you do for this particular example), you could even make it responsive. ?
  21. That's definitely strange. No recent modification date on index or htaccess (modrewrite) files for the site? It's strange that only lister seems to be affected. The (query string in the) full path when you login is different than the full path when you load the page tree. There might be something strange there too, but it's sometimes easier to focus on one thing than multiple. I am honestly not entirely sure what to recommend at this point, based on the provided symptoms. Have you reached out to the server maintainers to see if anything had recently been changed? EDIT: If your local version works fine, maybe download a backup of the live site and compare the files (diff), or just run it locally and see if it's reproducible on your own development server. If it is, it's probably easier to diagnose there anyway.
  22. I personally have not experienced this, but the very first question that comes to mind is whether you've checked the logs generated in site/assets/logs to determine if there's any additional insight found there. Similarly - and a bit easier - if you've checked your browser's console for any errors while performing this task in case there are errors reported there.
  23. Oh, specifically for the console. I believe I experienced this once as well. Will try to be more attentive. Hasn't happened since. I am not using any Rock modules currently, though since it's only happened once to me I would lean more toward PC performance over module in my instance. Have you tried a different browser just to see if it's primarily a Chrome (on Mac?) thing? Safari / Firefox... If you have access to a Windows or ChromeOS box, maybe try Chrome there too? Chrome has a task manager. When you notice the issue - assuming you've reduced your Chrome tabs to just the one (?), does the task manager give any additional insight? Similarly, Chrome's DevTools offers a runtime performance monitor (not the same thing as is shown in the above photo)... Just some things to look into.
  24. If calling the size() method on any page image fields, the default value for upscaling within that method is true. That means if there's code in a template to resize, unless upscaling is passed in as an option with a value of false, a 200x120 sized image could theoretically be resized to 1920x1200. (Just a possible way this could happen.)
  25. In your first post of this topic, you mention the "body" field. Unfortunately I don't see that field being represented in either of the above template files. I'm not entirely sure here why you'd use both (if you're using both) the _main.php and main.php files - it seems like your main.php file was created based on the _main.php; using them both simultaneously wouldn't make sense. Within both of the above templates, there is a referenced "content" field, but not a "body" field. Do you have a "content" field? If not, try changing the variable name in the appropriate template(s) from "content" to "body" to match the associated backend template field name(s). Does that make sense?
×
×
  • Create New...