Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/21/2020 in all areas

  1. Today one of my dearest customers "Claudine" has her 50th birthday!! ?? She works a lot with their PW-based Software and I thought it would be nice to show her a birthday popup on the next login: RockBirthday ProcessWire module to show a happy birthday message within a given period after birthday. Usage Just install the module and customize it via hooks in /site/init.php (not ready.php!) // dont show message after set maxDays $wire->addHookAfter("RockBirthday::setConfig", function($event) { $event->object->maxDays = 30; // 14 is default }); // get date of birth of user // must return a timestamp (int) $wire->addHookAfter("RockBirthday::getBirthdate", function($event) { $user = $this->user; $event->return = $user->getUnformatted('your_birthdate_field'); }); // get markup of message $wire->addHookAfter("RockBirthday::getMarkup", function($event) { $user = $this->user; $html = "<h1>Happy Birthday, {$user->name}!</h1>"; $event->return = "<script>vex.open({unsafeContent: \"$html\"});</script>"; }); https://modules.processwire.com/modules/rock-birthday/ https://github.com/BernhardBaumrock/RockBirthday
    5 points
  2. I think there are only two things you'll need to change. 1) The name of the table "field_start" 2) The "name" field/column for the field's row in the "fields" table.
    2 points
  3. I only have one kid, so in some ways that keeps things easier, although she's in the office with me on the other PC which can make things interesting at times. We are allowed out walking as long as we keep to our neighbourhood and stay a safe distance from other people. Things have been pretty relaxed up until Sunday when the oven died, which made things a bit more inconvenient as we've been doing a lot of home baking, but that is out of the question now until I can get someone to repair it, or buy a replacement, which either way looks like at least a week away. At least there's a good chance of eliminating the virus completely here within the next few weeks, which will allow life to return to some semblance of normal, but the borders will likely be closed well beyond the end of the year.
    2 points
  4. @gebeer @bernhard Here you go ? https://github.com/jmartsch/pw-lang-de/releases/tag/3.0.148
    2 points
  5. Yeah, that makes sense ? Ok, so after spending way too much time, it's not specifically a Tracy issue. If you do a Tracy log call, eg: $this->addHookAfter('Session::loginSuccess', function(HookEvent $event) { l('Session::loginSuccess'); }); then it works fine. The issue is that dumps are stored in a variable and added to as needed during the current request. But it seems like PW hasn't actually started its session at Session::loginSuccess. If you try the same bd() call at Session::init then it works as expected. $this->addHookAfter('Session::init', function(HookEvent $event) { bd('Session::init'); // works }); So, I looked into the possibility of making it possible to do bd() calls and have them carry over to the next PW session (after the login has actually started the session) and there are possibilities, but I think they all come with downsides. I think it might help the Dumps Recorder panel though in that I'll be able to make it keep data over sessions, so I might consider that. I'll mull it over for a bit. As a reminder (almost just for myself), Session::loginSuccess does work on some setups (eg my local dev environment), so there must be some differences in how sessions are handled that is impacting this.
    1 point
  6. Thx @adrian the strange thing is. If the load order of the modules was the problem, shouldn't the bd() throw an error that the function does not exist? The hook seems to be fired, because the $this->message() shows up. ?
    1 point
  7. Just had a quick look. Lines #235-240 in PagesLoaderCache.php have this: if($this->wire('languages')) { $language = $this->wire('user')->language; if(!$language->isDefault()) { $selector .= ", _lang=$language->id"; // for caching purposes only, not recognized by PageFinder } } Line #237 is where the isDefault() method is called. The error you are getting indicates that in line #236, $language returned null. null cannot have the method isDefault(), hence the error. The reason, it would seem, we are getting null is that language is not being set for the current user (or theoretically, that there is no current user? - but don't think so). Maybe try to set a language for the user via the API before you log them in. https://processwire.com/api/ref/languages/set-language/ On a side note, why are you sanitizing passwords? :-).
    1 point
  8. Hey @bernhard - I just tested here with all combinations of the following on my local dev setup (MacOS) 1) SessionHandlerDB on and off 2) Your hook in init.php and ready.php and in the Console panel injected at init and ready In all cases, the bd() shows up in one of the Tracy redirect bars. Then I tried on one of my linux servers and in all tests, the bd() call was never activated. My thought is that it must be something to do with when Tracy is loaded. Because Tracy is loaded by PW's module system, it isn't loaded until site modules get loaded. Ryan made it so that it is the first of these site modules to be loaded which means we can always reliably use it to test development of other modules, but it doesn't load before the PW core which is why it's sometimes impossible to use it to debug the core. All that said, I don't know if load order is the problem in this case, or if it's something else. I'd actually love to know if you see a difference on different servers / PW installs. And anyone else who'd like to test also - it would be good to figure out if there is something consistent with when it does and doesn't work.
    1 point
  9. @kongondo absolutely understandable. :) I have maneuvered myself into a strange setup with two sites with different systems (one that I inherited form another freelancer). One page imports stuff from the other but only in a certain frequency. My problem resulted in something changing on the source page (PW) and the reference on the other site being wrong at that point (different file name). I just managed to fix this (5 minutes ago) by changing the import on the other page (importing the images instead of linking to them). So this topic is resolved. My reflex to fix things on the PW site must be, because it is always easy to do stuff in PW and the other system is a different kind of breed. :) Thanks for trying to pitch in. :) you were right, to fiddle with this issue on the site of the source was not the right way.
    1 point
  10. Maybe I have been staring at my empty coffee mug for too long but I don't get the logic behind this :-). Could you please explain your use case some more? My thinking is that you delete things you no longer need and are sure you won't need. None of these seems to apply to your images. If you need them as some external resource, then why delete them in the first place? Secondly, depending on the number of pages and/or images involved and the frequency of the 'change image operations', you might be creating more headache for yourself in the future. You might end up with lots of orphaned image files in the sense that they are no longer being tracked by ProcessWire. You would have to dig into the file system to do maintenance. You would have to come up with a system for which images are still in use in ProcessWire and which have been decoupled but still in use as external resources. And what about images that may no longer be in use as an external resource? This sounds like a nightmare scenario to me. So whilst you could probably copy the images before they are deleted, I don't think that's the first approach to consider. Maybe if you could give us a better description of the situation including whether those external sites are ProcessWire sites. Please also explain why you want to delete the images in the first place. Hopefully we can then suggest other solutions and/or approaches, even about the external linking part :-).
    1 point
  11. How would you React if I said I love Vue? ?
    1 point
  12. Wow, the youngest is already 6. Really, time flies. For me, most things are fine or ok. The only annoying thing is that I don't have a good place to work right now. At home there is too much unrest, I don't want to visit the CoWorking place I rented since the end of last year so often. Cafes are closed, you are not allowed to sit in the park. I have no real idea about it. So I sit at home in the hustle and bustle and only get half as much done as usual, which seems to me twice as exhausting. ? (It may also be that I am simply getting older and therefore have a greater wish for quietness.) ?
    1 point
  13. Hi Horst, Time flies, the oldest on secundary school now and the youngest just had her 6th birthday. Live is sweet. How are you doing?
    1 point
  14. Hi Martijn, thanks for testing! I think, I haven't tested as simple user. To be honest, I haven't tested much at all. So, "being so active" seems to be relative, depending on POV (point of view). ? Is everything ok on your side? The children are growing, (maybe way to fast)? ?
    1 point
  15. Hi @horst, When using this module from the user profile, the InputfieldCroppableImage4.module cannot get the $pages_id, thus trowing an Exception. With the addition below you can get the $pages_id from the Process running. I did not much testing so I Don't know if it is sufficient. <?>php // added at line 129, InputfieldCroppableImage4.module /** @var integer $pages_id, Page ID for crop links, defaulting to 0 */ $pages_id = 0; /** @var [ProcessPageEdit|ProcessUser|ProcessProfile] $process, Mixed processes maybee there are more */ $process = $this->wire("process"); if (method_exists($process , "getPage")) { $editPage = $process->getPage(); if ($editPage->id) $pages_id = $editPage->id; } $pages_id = $pages_id ? $pages_id : (int) $this->input->get->id; // And I Changed the of pages_id property of the $cropUrlWithParams to the var $pages_id Thanks for being so active.
    1 point
  16. Hi @adrian today Tracy cost me 1 hour of work ? $this->addHookAfter('Session::loginSuccess', function(HookEvent $event) { bd('Session::loginSuccess'); }); No matter what hook I tried (Session::login, ProcessLogin::loginSuccess etc) tracy did not dump anything. It seemed that the hook did never fire. I even placed a bd('Session.php') in Session.php... nothing! ? I tried different Session Handlers (DB, default), tried hooking ::logout (which worked) etc etc. Then I found: $this->addHookAfter('Session::loginSuccess', function(HookEvent $event) { bd('Session::loginSuccess'); $this->message('Session::loginSuccess'); }); So the hook fires, but the BD() call get's lost somewhere! The dumps recorder is also empty (not shown in the screenshot)! Any ideas what could be going on? PS: My new balance Tracy time costs: 1h Tracy time savings: 500h+ (thx once more!! ? )
    1 point
  17. Hey @ryan just posted a fix for an error that makes the new Image Fieldtype unusable with german locale setting due to an SQL error after image upload: https://github.com/processwire/processwire-issues/issues/1155
    1 point
  18. @kixe what do you think of this scenario: CronjobDatabaseBackup writes a Identifier Comment Word into all its files, and if that identifier is missing, just ignore it in all routines.? So, stopword also sounds good, but needs manual action everytime. The other way round, if I create manual dumps and want to delegate them to CDBs cleaning routine, I can include the identifier word. This has less harm when forgot or mistake on including a word.
    1 point
  19. This should have been already implemented with the option to set a custom storage path. Unfortunately I recognized a bug while looking in this. This bug is fixed now and I made some additional changements. Please update to v1.2.3. The automated cleanup effects only the custom path and not site/assets/backups/database/ used by ProcessDatabaseBackups. Currently you cannot use ProcessDatabaseBackups to edit backups stored under a custom path. I added functionality to protect files by 'stopword'. Files having this in its names or descriptions will be protected from beeing deleted by the cronjob. Just set the 'stopword' in the module config. @bernhard @horst @Robin S I hope the fix helps and feeds your needs (?)
    1 point
  20. I can only thank @bernhard again for this module and for the support he provided, for example in finding a solution for option fields. RockFinder2 can not only be used to load masses of pages faster, it can also be used at field level. For example, I used it to load about 40 to 60 fields per repeater matrix type, which are also further nested in FieldsetPages (for design settings) in one query. This amount of fields caused 700 or more single SQL queries to be executed and up to 140 PW-Page objects to be loaded into RAM. This caused a significant loading delay. By using RockFinder2 the SQL queries could be reduced to 200 on average. About 60 page objects less are loaded in RAM, the CPU is also happy and the loading time for pages without cache was also reduced on average to 700 ms to 1 second. Good job Bernhard! ?
    1 point
  21. v0.0.5 adds the link to the used parser to the readme and a parse() method to parse a string of less (not a less file)
    1 point
  22. @Pete From this side, my wife's job is one that requires her to be on phone/video meetings most of the day, so she's got to lock herself away from us to focus on that, and the kids are mostly with me during the day. I'm good at focused attention, but not great at changing gears, so I'm still learning. My days used to be just coffee and code. Now things are much more diverse, here's a typical day: wakeup, breakfast, coffee, code, kids wakeup, resolve dispute, make breakfast, coffee, code, hear that TV is on, check in to make sure kids are doing school work, turn off TV, say “get back to school work”, try to figure out something with google classroom, worry about whether I'm doing enough to keep kids focused on school, code, get icloud request to approve download of some game on iPad, tell kids to “get back to work”, explain why several times, answer questions about school work, hear music from some game and decide to let it slide, 1 email, cycle power on router because wife says she can't connect to important video call, code, resolve kids dispute, put 1 kid in timeout, legos, clean up spill, 1 email, slack message, cook lunch, coffee, code, worry about whether kids are spending too much time on screens, phone call, reset wifi because daughter says Roblox won't connect, then work a little more, click the "snooze" button on a dozen emails so they return tomorrow, take kids outside to play while I work on house or yard, ride bikes, cook dinner, eat, netflix, cleanup dinner, go to bed, feel thankful to be healthy, sleep well. I'm definitely still adapting here, but I can't complain about the new normal because having everyone under one roof is comforting, especially at times like this. And while it's harder to get work done, it's mostly still getting done and I just feel thankful to be staying busy. Also, knowing there's nowhere to go but home, life is simpler in many ways.
    1 point
  23. And the next piece of information... Have you ever asked yourself on mondays, what should I do now with my project? Could I start with $method1 or would I like to do $method2? The right answer is, none of them! PLAN YOUR TIME AND TASKS! So far we have learned about basic conceptional work, estimation matrix and components/sub-components. The next logical step would be to use this knowledge and start to manage ourself. Lets say we have 183 Tasks as a result from all our work we have done upfront. Great. We also know how long each and every task would possible take. Better. We can now use a method called TimeBoxing. If you are familiar with Scrum you probably know about sprints. Which is nothing else than a timebox. I dont want to dig deep into the Scrum Framework. So lets take this method and use it for ourself. The typical dev timebox in my teams runs for 2 Weeks. So on mondays we plan what we want to achieve in the next 2 weeks. How can I timebox myself? Lets assume you work 40h a week, for a 2-week timebox we have 80h pure worktime. Typically you dont work 8h straight on your tasks. Maybe your phone rings, you have to answer some emails or you help a colleague. We assume a "task efficency" of 80%. So 80% of our time could be put straight into tasks. Which means 80h * 0.8eff = 64h of effective Worktime for our project in a 2-week timebox. Lets have a look at our tasks now. There are 183 Tasks in our "Backlog". Wow thats a lot. Lets start to prioritize them. What is essential for our project and so on. Once done, great. But there are still 183 Tasks?! You remember our estimation we did? Create a new Backlog for the next 2 Weeks. This could be a Excel file or what ever. Take all your prioritized tasks which fit into your 64h. Congratulations you have now planned your very first timebox. Your timebox should now include so much work to keep you busy for the next 2 Weeks. The core concept of project management is to break complex systems into smaller much more easier and understandable fragments. Therefor, see yourself as a project which has to be managed ? An example Project Backlog and Timebox Backlog down below. Left is the timebox, right is the project
    1 point
  24. Hi @saschapi! I'm not aware of a module that enables this along with lazyCron but you could try placing something like this under site/ready.php $wire->addHook('LazyCron::everyDay', function($e){ $posts = $this->pages->find('status=unpublished, template=post'); foreach($posts as $post){ if($post->schedule_publish_date <= time()){ $post->of(false); $post->status([]); $post->save(); } } }); The page template you want to publish, would have a schedule_publish_date field, where you can set a publish date and time.
    1 point
  25. Does anyone know if support for export and Import of "Select Options" fields is coming soon? Or if it is hard to do? This is currently the most time consuming thing for me needing to pull templates from one website to another. Needing to repopulate them all manually. Thanks!
    1 point
  26. @mrkhan please refer to https://support.office.com/en-us/article/POP-IMAP-and-SMTP-settings-for-Outlook-com-d088b986-291d-42b8-9564-9c414e2aa040 Specifically: SMTP server name smtp-mail.outlook.com SMTP port 587 SMTP encryption method STARTTLS
    1 point
  27. As evan mentioned above, ProcessWire lacks support of shop modules. I built 3 Shops with ProcessWire within the last year. The first one with the help of Padloper, the other two (b2b-shops) without Padloper. Take the time to write down evertything about the structure of your producst and then you can start developing your own very flexible solution for your customer. By the way, it's very easy to do complex imports (XML or JSON) and exports of products or orders (PDF - pages2pdf, XML, JSON) for other systems. So there is no need to manage the orders within ProcessWire. The import can be startet manually or via cron by night. But you can do this also... maybe not so shiny as in magento or shopware. In one solution the customer can put everything with an import into the shop and the orders run back via email into the system. The customer nearly never uses the backend.
    1 point
  28. I think that PW modules should remain in whatever namespace PW is using. In the case of 2.8, that is the root namespace. In the case of 3.0, that is \ProcessWire. Then, include a directory namespace (such as src), and use your namespaces there only. This seems most logical to me...
    1 point
  29. Even though you're using "limit=1" the find() method should still return a PageArray. So you need to use "first()" on it before getting the thumbnail field. Alternatively use get() to only get the first item, which wouldn't need the "limit=1" selector. Also sorting by id might work, but actually "modified" or "created" are more descriptive.
    1 point
×
×
  • Create New...