Jump to content


  • Posts

  • 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)



  1. 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"]; }
  2. @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).
  3. 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)..
  4. Hi @BitPoet, thank you, this helped and fixed my problem.
  5. 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.
  6. 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)?
  7. @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.
  8. 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.
  9. 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 🙂
  10. Hi @Sebi, thank you for your response. That was the first thing I checked. For the API request I am using vanilla JS (fetch) and I'm using the encodeURIComponent() function. Also in network tab in dev tools I can see the request is transmitted as it should be according to RFC 3986. I would digg deeper, but I don't know where the status code gets injected for a (in fact) successful request.
  11. I am using AppAPI module for a project and it's amazing. Thanks @Sebi! However I encountered a (for me) very strange behaviour. I defined an endpoint for a search functionality (for use via ajax). //... //defined route in Router.php 'search' => [ ['GET', '{q}', Search::class, 'getSearchResults', ["auth" => true]], ], I call the endpoint via ajax (content type application/json). The "q" parameter is free text and uri encoded. Now, when "q" is a single word no problem occurs. However if "q" has a space like "my query" the response has a HTTP status code 404, although returning the correct results. So the route itself is working fine. I am not sure what causes this. Has anybody some clues? used versions: AppAPI 1.1.7, ProcessWire 3.0.184, Php 7.4
  12. Hi @Marcel, you can find the "AppAPI" config page with following schema: {{YOUR_DOMAIN_COM}}/{{ADMIN_PATH}}/{{SETUP_PATH}}/appapi/ For a "default" ProcessWire installation on "example.com" this would be: https://example.com/processwire/setup/appapi/ There you need to manage your applications. Then, in your Router.php file you need to define routes (=endpoints).
  13. Ok you try to bind the value to an element with id "map2", but you don't have an element with that id. Your input element probably needs that id: <input type="hidden" name="map2" id="map2">
  14. Hi @webhoes, it can be that I am overlooking something, but as far as I can see you don't have a "name" attribute called "update" in your button element. So your if statement never evaluates to true.
  15. Maybe that's what you are looking for: https://processwire.com/blog/posts/pw-3.0.137/#on-demand-mirroring-of-remote-web-server-files-to-your-dev-environment
  • Create New...