Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Posts posted by benbyf

  1. 3 minutes ago, David Lumm said:

    Hey all!

    I was wondering, is there any concept of "middleware" or hooks that I could attach to so I could run something on every request?

    At the moment I've got a couple of things I've added into every route function, but I can anticipate that list getting longer. Rather than copy and paste the same lines into each and potentially miss something, it would be great if I could run it before the route specific code runs. Is that possible @Sebi?

    Hi HI David, in PW any function in a module that has ___ at the start, like ___handleApiRequest() in the AppAPI module you can use as a hook in your own code. See https://processwire.com/docs/modules/hooks/

    • Like 2

  2. Hi @Sebi I added the log to app-api (will create a PR somepoint soon), I wondered if you wanted a log message on each request and maybe a setting in the modules settings to turn on or off, or maybe something more granular?

    My use case is going to require lots of log messages in the api files but having a generic log message on each request I though might be nice. Also wondered if it was worth making a second log for failed (exception) based log messages? so successful requests get logged to one and exceptions to the other..... any thoughts would be cool

    • Thanks 1

  3. Thanks both @Sebi and @thomasaull I appreciate your time.

    Will look into the log bug as thats paramount to us using the module so would be great to clear up.

    The non-apikey endpoints is more of a nice to have really as you can set up informational endpoints that act like website frontends but without the visual code obviously.

    In terms of users, applications and version, they seem loosely connected. There seems little reason to fill out the apikey version  when creating a new apikey if it doesnt actually relate to anything. But maybe i just havent seen how it does or could relate. Also the users are too loosely associated with the applications (slight tangent), but it would be nice to leverage the user and roles system byt associating a user/s with either key or applications, and then auth them against them on route. e.g. [..., [route_options_role_required = "delete-pages, update-pages, create uses" ]] as the folowing api might enable these things and you wanna be pretty damn sure that user is allowed to do it 🙂

  4. Thanks! @thomasaull

    1. I mean on the settings page the is a link to a log, which when clicked takes you to the logs overview page with an error saying the log you were trying to access doesnt exist.
    2. disabling auth doesnt create an open endpoint as you still need an apikey to access anything without an error
    3. sounds good but how do you implement this as there is nothing in the docs?
    4. ?
    5. cool beans, but my comment still stands 🙂

  5. Sorry for all the questions ... Its not clear to me currently how version numbers or api keys or users are related and can be used to auth against a certain route... is that something we have to build into the api call to test the signed in user and their restrictions? be cool if this was tired into the auth stage/routes as you have all the parts there available but not tied together for some reason...?

  6. I guess in that case its solving the big content VS config divided present in all CMS's. But yes, i am cyrptic it seems. I guess my point was if I dont need the auto upgrading and downgrading that the module provides then I could not use it and simply write some template and field php code that you can cool as a "migration" as your module is a wrapper for quickly doing those tasks (exlcuding the uping and downing).

    In an ideal world the changes would be recorded in situ (no need to write them) and migrations would be exported to file to added to version control that can be ingested by any other PW install running the module. (I'm just all about writing less)

  7. Am I right in saying that this module is less about migrations and more about automation? As using methods to do work using handy functions in a linear way sounds like automation to me, where as migration is something I want to do when I have a bunch of stuff that has happened to the environment that needs replication for some reason (i.e exporting and importing fomr staging to live).

    I only mention it as ideally you would work on your PW install (in the admin or in code) and at certain points take a migration of the changes... and therefore not need to hand write the migrations at all, as they're actaully artifacts of changes to the db?

    Bit meta, but I like using the admin, and would rather migrations were something that happened, not that needed writing. (this is coming from some experience with a migrations module in Drupal 6... yes i know! That did just as explained)

    • Like 1

  8. Thanks @B3ta -  I feel like yours comments are somewhat off topic from this module specifically, so keen to get your feedback there if you have any. 
    however, I do concur you thoughts on premium market place and there is actually a couple, one of which I started building myself then got busy and never got finished. It would be easier if we could all just use one central place, and easier for new PW users.

  9. @B3ta possibly. what where you thinking?

    I’m mostly interested in input to help me, as it’s a bit rough Around the edges at the minute and wondered if anyone had feedback or PRs.
    I’ve recently done a lot more on it on a clients version which I’m looking to roll in soon, but am looking for enthusiasm for it so it’s not wasted work.

  10. On 6/20/2020 at 11:21 PM, cb2004 said:

    Would be nice if this was supported in the core as well in the settings tab. I setup my redirects in there now and use the 404 logger module as that seems to cater for my current needs when rebuilding a site

    yeah, core redirects would make sense, something that I can imagine seems common enough and can link in with the tracking of page url changes and redirecting.

    not sure I understand how you're doing it, can you explain?

  11. Hello, and welcome to what I though was either my client being silly and changing things, or some evil doer. Turns out its reproducible and therefore something in Proceswire (I checked my templates and modules but couldnt find anything that would be doing this...). So what is it doing? Check out the video for evidence.

    A repeater field is interacting with a page template and another repeater field somehow to swap the fields in the template and repeater over...

    I have a template called team, and a repeater field called team_repeater with label Team. Some how and for some reason, when I change my fields on repeater called main_menu_links my team template gets those fields and when I try and revert the team template fields to the fields it should have, they get given to the repeater main_menu_links. Also this to say HELP!!!!!

    video: https://www.dropbox.com/s/exkdhc6n7x0xpsa/strange-repeater-PW-mega-bug.mov?dl=0

    • Confused 1

  12. 10 hours ago, Rob(AU) said:

    Hi Ben, I've been using another Payments module. Am I understanding correctly that yours does not depend on the PaymentModule?

    If not I can uninstall the unused modules ...



    It does, but doesnt really need to. it uses the PaymentModule for inhereitance of structure. As my module doesn't totally adhere to the render structure it might be worth striping out the dependancy at some point.

  13. 1 hour ago, elabx said:

    Piece of cake with ProcessWire I say 😄!

    Registration with LoginRegister Pro, feedback/rating with comments module and probably I'd think of an admin dashboard or someway to present comments/rating in a nicer way than just going to the video page and look at the fields. 

    If you didnt want to build an admin module you could add functionality to your templates depending on the user role. e.g. Superuser can see who has watched each video on the video's page, and you could provide a page which only exists for the admin that displays a list of videos and users who have watched them etc etc

    • Like 2
  • Create New...