Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

statestreet's Achievements

Full Member

Full Member (4/6)




Community Answers

  1. I have some functionality on an intranet site that uses Lazy Cron to query an external API and then update a bunch of pages based on the API response. A problem I've noticed is that this breaks our author / editor tracking – whenever a user triggers the Lazy Cron job, the page metadata for `$page->modified` and `$page->modifiedUser` is (naturally) updated, so it now looks like that user edited the page at that moment in time, even if the content of the page was edited months ago by someone else. It seems like the ideal solution here would be to somehow exempt certain fields (the ones that get updated by this external API) from triggering a timestamp update... Any ideas on how I'd go about hooking into that?
  2. Weird. I can't think of any reason another page would be rendered (no iframes, no additional render() calls). I threw an echo into the background sync function, and indeed, it shows up at the end of the page.
  3. I have a slow background sync function that has to hit a web service a bunch of times (unfortunately there appears to be no way to consolidate the API requests) that I've bound to a Lazy Cron hook. However, it appears that I've somehow caused Lazy Cron to run before `ProcessPageView::finished()` as opposed to after. Every time the Lazy Cron is scheduled to fire, it takes 30 seconds to render the page. Any ideas what I might be doing wrong?
  4. This is just what I was looking for! I have a question, though: How might I go about changing one of the custom fields to a textarea, or even enabling CKEditor?
  5. This seems like a great feature to add after page versioning.
  6. Thanks Adrian! (And thanks for the ProtectedMode module, too.) I just used the config settings referenced in a couple of those threads: $config->pagefileSecure = true; $config->pagefileSecurePathPrefix = '-'; And made sure the "guest" permission was disabled for the templates that have image attachments. For some reason, it seems to have taken about an hour to propagate (some links were still showing up unauthenticated), but everything appears to be locked down now.
  7. We have an internal company site that we use to document specifications for software development. Currently, we use Adrian's ProtectedMode module to restrict the site to logged-in users, but one of the engineers just noted that uploaded files are (naturally, given the scope of the module) visible without authentication. While this isn't a huge risk (you have to know the URL to view an uploaded file), it is technically a security issue since we have lots of proprietary things attached to pages on the site. Any ideas on how I could lock down these files so you have to be logged in to view them?
  8. Thanks Horst, that's a great idea. Is a module the best place to do this, hooking the upload?
  9. On the site for a game development collective I'm part of, I've been trying to add the ability for our developers to attach game builds from Unity (a 3D game engine and development environment) to blog posts. Unity cranks out an HTML file with everything ready to go for static hosting, so I've simply added a file field in the blog post template that accepts the four files Unity exports, one of which is jquery.min.js. Obviously, this is highly redundant, having the content author upload another copy of jQuery with each build, but it's actually a more streamlined workflow than the alternative of building a standard Unity player template, which would then require the author to create an additional page in ProcessWire each time to attach the Unity file. So I've gone with this redundant but easy approach. However, I've run into a technical snag: Even after explicitly allowing "min.js" files for the field, the file uploader always renames the jQuery file to "jquery_min.js", which is then not found by the HTML file looking for the original name. Is there a way to disable this behavior?
  10. $pages->get("/stories/")->find("external_status!=accepted"); This selector works as expected, excluding all the story pages that have "accepted" in the external_status field, but it also excludes stories with no external_status defined (field is empty). How can I make sure those pages are included?
  11. Saving the fields instead of the page did the trick. Thanks!
  12. Craig, you make it look so easy! I think I almost have it, but I neglected to mention my checkbox is in a repeater. This seems to work (the echoes spit out what I expect) but the save doesn't seem to take: <?php $entries = wire('pages')->find("template=story"); foreach ($entries as $entry) { $entry->of(false); echo "<br>Checking checkbox on {$entry->title}...<br>"; foreach ($entry->tests as $test) { if ($test->old_check == 1) { $test->new_check = 1; echo "Converted {$test->scenario}<br>"; } } $entry->save(); }
  13. I have a checkbox field that I need to split into two checkboxes. Currently, the single checkbox determines whether a badge appears next to an entry on the front end, but now that badge should only appear if both checkboxes are checked. So when I add the second checkbox, I'll need all the old pages that were created when there was only one checkbox to now have both checkboxes checked so that the badge appears based on the new template logic. Any suggestions that would be more efficient than manually going through and editing all the old pages by hand?
  14. Thanks Adrian! I decided to just tack ProcessWire's page ID on the end if the story ID is a duplicate: public function changeName($event) { $page = $event->arguments[0]; if ($page->template=='story' && $page->story_id!="") { if (count($this->pages->find("story_id=" . $page->story_id))) { // uh-oh, we found another page with this story ID $page->name = $page->story_id . "-" . $page->id; } else { $page->name = $page->story_id; } } }
  • Create New...