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. Hi @BitPoet, thank you, this helped and fixed my problem.
  2. 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.
  3. 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)?
  4. @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.
  5. 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.
  6. 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 🙂
  7. 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.
  8. 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
  9. 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).
  10. 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">
  11. 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.
  12. 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
  13. I still don't get why I am logged out of site2 when "force login" on site1, but replacing $site1->session->forceLogin($userSite1); //with following (replacement): $site1->session->setCurrentUser($userSite1); seems to have the desired effect without logging out the user on site2.
  14. Hi all, I have a special setup right now, which uses two ProcessWire instances with two different databases (no "multi-site" setup), let's call them site1 and site2. I want to access data from site1 on site2 through the multi-instance feature. It happens that some users of site2 may have an account on site1 as well and for them I store their user id on site2. Now I want to force login those users, when I want to use a page find function. This way I can still manage access to pages on site1. If I don't login those users on site1, no results are returned for access controlled pages, unless I add the check_access flag to 0 (which I want to avoid). So far so good. However, once I force login those users on site1 the user is logged out of site2 automatically (which means the user acctually cannot use the site). Both sites are running exact same versions (v 3.0.178) and have different sessions names. // on site2 $path = '/home/modules/www/site1'; // The root URL for the PW installation $url = 'http://examplesite1.com'; // Create a new ProcessWire instance $site1 = new ProcessWire($path, $url); //get user object from site1 -> "$userSite1" //force login user.. $site1->session->forceLogin($userSite1); $myPages = $site1->pages->find("template=my_access_controlled_template"); // pages are returned that $userSite1 has access to //at this stage currently logged-in $user of site2 is logged out I hope the problem is clear. Is there anything I can do to avoid the log out (without having to use check_access flag)?
  15. Hi all, I am once again seeking for help or at least some hints. I have the following "problem": I want to allow users to enable two-factor authentication from the frontend. So they should only be presented an option to enable TOTP (display QR code/secret and code input element) - no other profile edit related stuff is needed. I looked at the "TfaTotp" module class and I am not sure if one could use it in the frontend at all (as it seems to heavily rely on the user profile form in the backend). So my main question is: Is it possible to use this class for my usecase in the frontend without changing the code / duplicating it?
  • Create New...