Jump to content

androbey

Members
  • Posts

    77
  • Joined

  • Last visited

Recent Profile Visitors

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

androbey's Achievements

Full Member

Full Member (4/6)

34

Reputation

  1. Very nice, thank you! This helps me a lot. Just as a side note: As I have multiple options fields on the same page I'd have to add an additional name selector to the input selector ($('input[name="roles[]"][value=1]') of course escaped).
  2. Hi all, I have a rather special problem (at least for me) and did not find a proper way to solve it. On the system user template I have multiple "Options/Checkboxes" fields (multiple selectable values), where each field could have up to 30 options. Now, it would be a lot of work to click many checkboxes, especially when there are a lot of users. What I would like to have is a button (or multiple buttons) next to the field to set default values (e.g. button "Option 1" would select certain fields and button "Option 2" would select even more fields). Default value sets and selectable options are static. Is there any (good) way to accomplish this? Unfortunately there's is no real dependency which default set should be used (if any), so no after save hook or similiar is suitable. It's totally up to the editor which default set should be used on a per user basis. Hope this makes sense.
  3. Hi @benbyf Maybe this module does help you too:
  4. Hi @adrian, first of all, thank you for your support and the Slack enhancement. I think it's a good fit, but noticed that mail support has "disappeared" (so if logging to Slack is enabled, no more mail is sent - the Slack logger replaces the mail dispatch entirely). It's probably nothing anybody else would use, nor that there's any real need for it (besides my imaginations): So here's my suggestion or better my ideas to even further improve your must-have module. I think it would be great, if you could add a new hookable function, let's say /** * Empty hookable function. * Use hook before TracyDebugger:addCustomLogger to add your own logger */ protected function ___addCustomLogger() { //empty on purpose } and call this method right after you currently call the Slack logger. Then you would be able to add your custom logger module (for example) which takes care entirely of logging. Advantages of this approach: Very custom error handlers would be possible (maybe some internal monitoring tools), you could decide when to use which service (e.g. mail on exceptions, Slack message on anything else) and so on (or even use many services to spam you all at once). I tried this approach with a quick and dirty module, which one would have to keep in mind that autoload priority has to be higher than TracyDebuggers' AND to not have TracyDebugger as a module requirement itself. Unfortunately I am still no expert, but it would be nice to hear your feedback on this.
  5. Hi @adrian, thanks for your fast response. Super nice to hear it's on your list. I agree, a throttle (or an option to throttle) would still be important. But for dedicated and muted "monitoring" channels maybe not that much contrary to mail inbox.
  6. Hi, I don't know if this is the right place to ask this, but I hope so. Tracy Debugger is of course excellent and a must have for each site. Right now I am using the "email notification" feature, but with Tracy's "email-sent"-flag I'd have to manually check the log file, if some error ocurred in the meantime. I was wondering if there is any possibility to add an additional logger besides the log file, which has no "throttle", e.g. something like a Slack logger (https://tracy.nette.org/en/recipes#toc-custom-logger) (without the need to adjust the module myself). Hope this makes sense. Thanks in advance!
  7. I can give you a simple example how to use the options array. In this example you would get all log entries for your log file that have been stored today. $entries = $log->getEntries("simplecontactform-log", ["dateFrom" => "2022-06-14 00:00", "dateTo" => "2022-06-14 23:59:59"]); foreach($entries as $entry){ //get log entry text, you can also get date, user and url $text = $entry["text"]; }
  8. @Flashmaster82 Have a look at the documentation for the getEntries() method here: https://processwire.com/api/ref/wire-log/get-entries/ You have the ability to specify an options array, where you can limit the returned entries (e.g. getting only log entries from a certain date onwards).
  9. You are calling information about all logs. What you need instead is described here: https://processwire.com/api/ref/wire-log/get-entries/ or https://processwire.com/api/ref/wire-log/get-lines/ In your case e.g.: <?php $myLogs = $logs->getLines("simplecontactform-log"); //do stuff with single lines (inside $myLogs array)..
  10. Hi @BitPoet, thank you, this helped and fixed my problem.
  11. Hi @BitPoet, thanks for your help. Calling $modules->get('myfieldtype') does the trick (although it's a little cumbersome to add it everywhere before I'm using this fieldtype via the API). However, I don't understand your second suggestion. Event and EventArray are classes which extend WireData/WireArray, how could they be autoloaded? Setting autoload to true in both FieldtypeEvents and InputfieldEvents (just to make sure) has no positive effect.
  12. Hi all, I created a custom Fieldtype / Inputfield combo (similiar to https://processwire.com/modules/fieldtype-events/) and also want to add content to this fieldtype via API. Now, with lazy loading enabled I get the error that class is not found. //will throw an error here.. Class ProcessWire\Event not found. $event = new Event(); With lazy loading disabled via config.php everything works well. Is there any way to "register" or make ProcessWire aware to actually load this class or any other workaround (besides disabling lazy loading)?
  13. @Ralf You're right, my bad. It seems "isChanged()" method does not work on User template. But you still have two options. 1) Tweek the code from above and check if the field you want to monitor is in changes array. (e.g. in_array('roles', $changes)). 2) Use a slightly different approach with User::changed hook. You have to modify to fit your needs, but here's a very basic example. wire()->addHookAfter('User::changed', function (HookEvent $event) { $user = $event->object; $changedField = $event->arguments(0); //which field you want to monitor $fieldToCheck = "roles"; if ($fieldToCheck == $changedField) { //send mail.. or do more checks.. } $return = $event->return; $event->return = $return; }); Edit: the second approach is ONLY sensible if you want to check for a single changed field! Otherwise you would get a mail for each changed field. If you want to check for changes of more than one field use the first approach.
  14. Hi Ralf, e.g. you could check if the field you are looking for (e.g. roles) has changed: https://processwire.com/api/ref/page/is-changed/ .. and then only send an email if the field has changed.
  15. Hey @Sebi, thanks for looking into the issue. You are absolutley right, when specifying it as a GET parameter it works without issues. This is anyhow the better way. Thank you again ?
×
×
  • Create New...