gebeer

Members
  • Content count

    724
  • Joined

  • Last visited

  • Days Won

    6

gebeer last won the day on January 2 2017

gebeer had the most liked content!

Community Reputation

629 Excellent

About gebeer

  • Rank
    Distinguished Member

Profile Information

  • Gender
    Male
  • Location
    Thailand/Germany

Recent Profile Visitors

7,204 profile views
  1. @patman I'd suggest making the PR to the original repo as this feature will be a good improvement to the original module.
  2. _js_geocode_address is used to hold the address that gets returned by the JS geocoding call, thats why the value is not set when rendering the field. This address is then stored to the data field in the DB on save. If you want to store the raw data in that data field, you also would need to change the schema, because it currently allows a max of 255 characters which will not be enough to store all the raw data. When you then retrieve the address in your template with $page->mylocationfieldname->address, it will return the raw data that you stored in that field. So you would need to extend the get method in LeafletMapMarker.php to return only the address and not the whole string. I think it would make more sense to extend the DB scheme and have a field raw that stores the raw data. You'd need a hidden field in the form, e.g. _js_geocode_raw that gets populated from the JS (just like the address field gets populated now) and then on save sends that value and stores it to the DB. You'd need to add that to the set method in LeafletMapMarker.php.
  3. @BrendonKoz Have you checked with some debug tool (I highly recommend Tracy Debugger Module) that $json['results'][0] has a value?
  4. @BrendonKoz The JS side of this module is using the OSM geocoder while the geocode() method in LeafletMapMarker.php is using the Google geocoder. If you wanted to save the raw data returned by Google geocoder, you would need to extend the database schema in FieldtypeLeafletMapMarker.module to add the necessary columns (e.g. streetAddress) to the table where data for this fieldtype ist stored. And extend the geocode method so it can save the raw data to the newly added columns. And add the respective keys to the construct method in LeafletMapMarker.php. Then you should be able to access your values in your template php like: $map = $modules->get('MarkupLeafletMap'); echo $map->streetAddress; and use those values to render the JSON+LD JS. You would either need to fork the original module and then add your code or write your own module that extends the original one and adds your methods.
  5. Hello, having the same problem as described by @Ivan Gretsky. Inside a namespaced module I have this method with a try catch block: public function addJson($pages, $filename) { $tmpPath = $this->files->tempDir('json'); try { $start = microtime(true); $jsondata = $this->getGeoJsonCollection($pages); $time = microtime(true) - $start; va_dump($time); // Note the intentional typo $filePath = $tmpPath . $filename; if($tmpPath && $jsondata) { //write json data into geojson.json file if(file_put_contents($filePath, $jsondata)) { $jsonPage = $this->jsonPage; $jsonPage->of(false); $file = $jsonPage->jsonfiles->getFile($filename); if($file) $jsonPage->jsonfiles->remove($file); $jsonPage->save(); $jsonPage->jsonfiles->add($filePath); $jsonPage->save(); if(!unlink($filePath)) $this->message("Error deleting temporary $filePath"); $this->message("$filename created and saved"); $this->log->save('json', "$filename created in $time seconds and saved"); return true; } else{ return false; } } } catch (\Exception $e) { $this->log->save('json', $e->getMessage()); } } I'm calling the module via command line from a worker php script that bootstraps PW. I get this ouput from my script and nothing logged to my custom json.text log file: PHP Fatal error: Call to undefined function ProcessWire\va_dump() in /var/www/uhtinew.dev/site/modules/SaveJson/SaveJson.module on line 208 Fatal error: Call to undefined function ProcessWire\va_dump() in /var/www/uhtinew.dev/site/modules/SaveJson/SaveJson.module on line 208 Error: Call to undefined function ProcessWire\va_dump() (line 208 of /var/www/uhtinew.dev/site/modules/SaveJson/SaveJson.module) This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged. So it seems that WireException is catching this before my try catch.
  6. @BitPoet Thank you very much for the heads-up. Also to @Robin S. I finally ended up with this hook function in a module context which does exactly what I need, also in ajax mode: $this->addHookAfter('Field::getInputfield', $this, "lockConfirmedItems"); public function lockConfirmedItems(HookEvent $event) { if($this->user->isSuperuser() || $this->user->hasRole('certificationadmin')) return; $thisPage = wire('page'); // // Only run our locking logic if we are editing a user in the backend if($thisPage->process != "ProcessUser") return; $repeaterPage = $event->arguments(0); $context = $event->arguments(1); if($context != "_repeater" . $repeaterPage->id) return; if(!$repeaterPage->confirmed) return; $event->return->collapsed = 7; } Setting collapsed with the Inputfield constants like in BitPoet's code didn't work for me.
  7. Hello, I would like to prevent future editing of a repeater item once a checkbox in the repeater item has been checked. Either the form inputs of the repeater item should be read only or only the field values should be rendered. Looking at the module code I can't seem to figure out where to hook for that functionality. Any ideas would be much appreciated.
  8. @Pierre-Luc is there still no way to get feedback on success/errors when sending through the Mailgun API? I would like to build a Lister(Pro) Action around your module and for that I would like to show results after sending. Something like $mail->getResult(); in WireMailSMTP. EDIT: Guess I would need to use Mailgun Events for tracking emails. Right?
  9. Thank you for your suggestions. It is not that many mails, maybe a total of 100 a day and max 10-30 per hour. So I will stay with Gmail for the time being.
  10. @flydev That info is enlightening. Thank you! So I would have to extend the WireMailSmtp module to get that functionality, right? @horst
  11. I am experiencing problems when sending through Gmail on a site that is sending out quite a lot of emails to different recipients. It used to work for about a month and now suddenly Google is blocking my app. It seems that Google regards the app as less secure. I am wondering if someone has had similar issues with Gmail? I know there is a setting in Gmail to allow less secure apps. But I would like to know why Google thinks the app is less secure. Does it have something to do with headers being sent by WireMail that Google disqualifies as insecure? Here is the data array from the WireMailSmtp object (sensitive data has been replaced by xxx): default_charset => "UTF-8" (5) localhost => "dev.xxxtors.com" (31) smtp_host => "smtp.gmail.com" (14) smtp_port => 587 smtp_ssl => "" smtp_start_tls => 1 smtp_user => "info@xxxtors.com" (32) smtp_password => "xxx" (11) smtp_password2 => "" clear_smtp_password => "" realm => "" workstation => "" authentication_mechanism => "" smtp_debug => 0 smtp_html_debug => 0 sender_name => "xxx" (24) sender_email => "info@xxxtors.com" (32) sender_reply => "" sender_errors_to => "" sender_signature => "" sender_signature_html => "" send_sender_signature => "1" extra_headers => "" valid_recipients => "" smtp_certificate => "" And here the mail object data to => array (2) "xxx@gmail.com" => "xxx@gmail.com" (26) "xxx@mailbox.org" => "xxx@mailbox.org" (28) toName => array (2) "xxx@gmail.com" => "" "xxx@mailbox.org" => "" cc => array () ccName => array () bcc => array () from => "info@xxxtors.com" (32) fromName => "xxx" (24) priority => "" dispositionNotification => "" subject => "xxx" (51) body => "This is an automatically created email. Please do not reply. xxx" (139) bodyHTML => "xxx" (183) addSignature => NULL attachments => array () header => array (1) "X-Mailer" => "ProcessWire/WireMailSmtp" (24) sendSingle => FALSE sendBulk => FALSE useSentLog => FALSE wrapText => FALSE Does anyone have an idea why Gmail thinks these mails are less secure?
  12. Hi, I had the same situation as the OP described: URL sent by email to go to a specific page after login. I solved it with 2 small hooks that I added to a module. You could also add them to your admin.php or ready.php My URL looks like .../?member=1222 where 1222 is the id of a user 1. hook adds a session variable before Login $this->addHookBefore('ProcessLogin::execute', $this, 'setRedirectId'); public function setRedirectId(HookEvent $event) { if($this->input->get('member')) { $this->session->set('goToMember', $this->sanitizer->int($this->input->get('member')); } } 2. hook has the redirect logic and removes the session variable $this->addHookAfter('Session::login', $this, 'loginRedirects'); public function loginRedirects(HookEvent $event) { if($this->user->hasRole('certificationadmin') && $this->session->get('goToMember')) { $member = $this->pages->get($this->session->get('goToMember')); if($member && $member->id) { $this->session->remove('goToMember'); $this->session->redirect($member->statusPageUrl); // statusPageUrl is a custom property for users that I added via another hook } } }
  13. The problem in my case is that this project will have more than 2000 users that will logon from all over the world. So I guess I will have to disable session fingerprinting to make sure that everyone can connect without issues.
  14. @bernhard I'll see what I can do with the $config->sessionFingerprint settings to avoid these problems. Although I don't feel comfortable messing with security features...
  15. thank you both for your feedback. Is there anything we can do to work around those security restrictions? EDIT: guess it has something to do with $config->sessionFingerprint setting. I'll play around with that.