Jump to content

update AG

Members
  • Posts

    39
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by update AG

  1. It should work right away. You should see the tracked pages here: Menu "Setup" > "Most Viewed".
  2. Hi @wbmnfktr thanks for your feedback! Here's briefly how it works with the default values of 1 day, 2 days and 3 days: Think of the 1st timerange as plan A - it fetches the 10 most viewed pages in the last 24 hours. If for whatever reason there haven't been 10 pages viewed in the past 24 hours, we then move to plan B, which is the 2nd timerange. Here, we look into the past 48 hours for page views. The 3rd timerange is plan C, in case we still need more articles to complete our list of "10 most viewed pages". So really, the 2nd and 3rd timeranges are like our safety nets to always make sure that we have a full list of 10 pages, regardless of viewer traffic. But given your site is quite crowded, it's likely that the list will be filled up within the first 24 hours, so you may not ever even need the 2nd and 3rd timeranges. Regarding the waiting time post-installation: it all depends on your timeranges. If you've set them as 1 day, 2 days, and 3 days, then ideally you'd wait for 3 days. But in practice, if your site has a good traffic volume, you may start seeing your top articles much sooner! If you adjust your first timerange to be 7 days and 8/9 days as a fallback (10080, 11520 and 12960 minutes) you'd ideally wait for 7-9 days. Does that make sense? I've tidied up the way we log events to prevent any confusion. Just to clarify: - 404 page-views don't contribute to the count and so, to avoid clutter, they've been removed from the logs, even while debugging. - another reason for removing 404 from the logs: every missing image, file, etc triggers a 404 - which can and surely will eventually be a lot. - the tracking of our module isn't affected by what PageHitCounter does, because it's triggering a 404 event that we ignore either way. I've also updated the logs to include the reason each time a page-view gets passed over. This means not only will you know which views have been tracked, but also which ones weren't tracked and exactly why. Thanks for that - I've also updated the check for crawler. I'm using the same method as PageHitCounter - this seems like a reliable approach. I have updated the GitHub Repository with the most recent changes. You can check the releases section there to see them. Alternatively, you should be able to update the module directly from the module configuration in your ProcessWire installation by clicking the link 'check for updates' right next to the module-version. Hope that helped! Cheers
  3. Hi everyone, We have a new module for you: the UpdMostViewed module. It's an addition to your ProcessWire site that enables you to track page views and deliver a list of your most visited pages within a given time range. This data is particularly useful for creating frontend features like a "Most Read Articles of the Week" widget. Installation You can choose to: Head into your ProcessWire backend, go to Modules > New and search for the Module UpdMostViewed. Get the module directly from the latest releases on our GitHub repository. If you're using Composer for your project, you can add the module by running the command composer require update-switzerland/updmostviewed in your project root directory. Once downloaded, you can install the module via the ProcessWire admin. Configuration The UpdMostViewed module provides you with a variety of configuration options. You can exclude certain branches, specific pages, certain IPs, restrict counting to specific templates, define which user roles to count, ignore views from search engine crawlers, and more. Moreover, you can also customize the time ranges for the "most viewed" data. Links For more detailed information on usage, updates, or to download the module, please visit our GitHub repository and check out the module in the Module Directory.
  4. Hey @FireWire Whatever you did, it's working now: Downloaded your branch, deinstalled the module first and than installed your new version. All is working fine. Configuration of the settings now all work without getting an error anymore. Great help. Thanks a lot.
  5. You can access it directly and get a JSON response, when the path is correct: {"error":"FLUENCY_METHOD_NOT_ALLOWED","message":"Fluency API Error: Method Not Allowed"} But I didn't get anything so I looked closer to the path and saw that I had a wrong path. I had /processwire/fluency-1/api/translation/ as api-path, which was probably due that I deleted the module and reinstalled it so maybe it created this new path. I changed it now and it works. Second: Still when I try to edit the settings page in the Module I get the 503. See the attached network response. I still think it is somehow a security issue, when trying to save to the database due to all this serialized data in the POST-request. DB is by the way MySQL 8.0.
  6. I managed to get the Fluency Module installed and the settings set correctly. I installed in on another server a copied the settings directly from the database. So, that is that. But the Module is still not working. It looks like the translation-api page cannot be accessed. I get an "Unrecognized path" error (see screenshot), when I access the page /processwire/fluency/api/translation/ directly. Since the whole thing is working on another server it must have to do with some server restrictions but I can't figure out what it could be. Any ideas?
  7. Does anyone has a problem with installing Fluency (1.0.7) in Processwire 3.0.229 under PHP 8.2? I can install it but when it comes to selecting the preffered engine I get a 503 error. I suspect a mod_security issue since the module wants to save a serialized string (see below) to the database, when selecting the engine. Anyone run accross this problem and knows a workaround? Maybe @FireWire can help?
  8. The following code allows us to define multiple fallbacks for multilanguage fields. But somehow it doesn't work for fields with the Fieldtype "FieldtypeTable". $wire->addHookAfter('LanguagesPageFieldValue::getStringValue', function(HookEvent $event) { $mlObj = $event->object; // LanguagesPageFieldValue object $currPage = wire('page'); $french = wire('languages')->get(1033); $german = wire('languages')->get(1130); $italian = wire('languages')->get(1131); $russian = wire('languages')->get(1132); if($currPage->template->name == "job" || $currPage->template->name == "news" || $currPage->template->name == "doctor") { // Take the first non-empty value in order of precedence: foreach(array(wire('user')->language, $french, $german, $italian, $russian, wire('languages')->getDefault()) as $lang) { $newLangValue = $mlObj->getLanguageValue($lang); if($newLangValue != "") break; } $event->return = $newLangValue; } }); Inside the table field I am using this multilanguage field. What can I do to make it also work for multilanguage fields defined inside table fields? PW Version: 3.0.229 PHP Version: 8.0 ProFields Table Version: 0.2.2 KR Orkun
  9. I am trying to hook into text inputfields to add additional markup to it. But it only adds the markup for the default language tab. How can I achieve, that it also adds to the other language tabs? public function init() { if ($this->initSettings()) { $this->addHookAfter("InputfieldText::render", $this, "markAllowedFields"); } parent::init(); } public function markAllowedFields($event) { // Get the object the event occurred on, if needed $InputfieldText = $event->object; $allowedFieldTypes = [ 'FieldtypePageTitle', 'FieldtypePageTitleLanguage', 'FieldtypeText', 'FieldtypeTextarea', 'FieldtypeTextLanguage', 'FieldtypeTextareaLanguage', ]; $currentPage = $this->wire('pages')->get($this->wire('input')->get->id); $allowedFields = []; if($currentPage && $currentPage->id) { foreach($currentPage->template->fields as $field) { if($field->type->name && in_array($field->type->name, $allowedFieldTypes)) { $allowedFields[] = $field->name; } } } $return = $event->return; if(in_array($InputfieldText->name, $allowedFields)) { $return .= '<div class="gpt-wire-helper-container"><a href="#" class="gpt-wire-helper-link" >Do Something</a></div>'; } $event->return = $return; } KR Orkun
  10. Hi @kongondo We are in the process of upgrading a website which is using MM version v.0.1.2. After upgrading somehow the "All" section doesn't return any media anymore. I figured it out, that it was because of the following part in the selector media_manager_audio|media_manager_document|media_manager_image|media_manager_video!='' which is using the OR-Operator in the MM Fields. I have changed the code in MediaManagerUtilities.php to use OR-Groups for the MM Fields instead and now it works again. Do you perhaps have an Idea what could cause the OR-Operator to fail for the mm fields here? Since it looks like it is working for the templates? KR Orkun
  11. Thank you for your interest and input. The question about JS errors was particularly helpful: apparently a script from the old ListerPro version got stuck in my browser - clearing the browser cache helped. Embarrassing beginner's mistake 🙂 Markus
  12. Just upgraded PW to V3.0.226 with all modules included ListerPro (V1.1.5). Now under «Access > Users» the user list is no longer displayed, instead a (double?) ListerPro configuration page. Editing and creating users works. Only the list does not. In other PW installations WITHOUT ListerPro I have not found this problem (only an unsightly, too narrow user table.). Has anyone also experienced this problem? And maybe even solved it? TIA for all suggestions, Markus
  13. Looks like the core module for resizing animated gifs doesn't work for PHP 8. On the Production we have PW: 3.0.194 dev and PHP: 7.3.33-10+ubuntu18.04.1+deb.sury.org+1 and it is working there. Is it normal, that a resized animated gif gets bigger? The original was 1mb, the resized one 2mb. And the resized gif also had some 'artefacts/shadows' in it, and it also doesn't changed when adjusting quality from 90 to 100. array(5) { ["filename"]=> string(88) "/home/www-data/xxxxxxxxx.net/site/assets/files/205849/xxxxxxx.gif" ["extension"]=> string(3) "gif" ["imageType"]=> int(1) ["info"]=> array(18) { ["width"]=> int(1200) ["height"]=> int(627) ["imageType"]=> int(1) ["mime"]=> string(9) "image/gif" ["orientation"]=> int(0) ["rotate"]=> int(0) ["flip"]=> int(0) ["channels"]=> int(3) ["bits"]=> int(8) ["gifversion"]=> string(6) "GIF89a" ["animated"]=> bool(true) ["delay"]=> int(4) ["trans"]=> bool(true) ["transcolor"]=> int(2) ["bgcolor"]=> int(2) ["numcolors"]=> int(256) ["interlace"]=> bool(false) ["appmarker"]=> array(0) { } } ["iptcRaw"]=> NULL } array(2) { [0]=> string(27) "ImageSizerEngineAnimatedGif" [1]=> string(18) "ImageSizerEngineGD" } string(14) "gif-trans-anim" On the Dev Enviroment we have PW: 3.0.194 and PHP: 8.0.28 and there it isn't working/resizing. array(5) { ["filename"]=> string(92) "/home/www-data/xxx.xxxxxx.net/site/assets/files/178453/xxxxxxx.gif" ["extension"]=> string(3) "gif" ["imageType"]=> int(1) ["info"]=> array(18) { ["width"]=> int(1200) ["height"]=> int(627) ["imageType"]=> int(1) ["mime"]=> string(9) "image/gif" ["orientation"]=> int(0) ["rotate"]=> int(0) ["flip"]=> int(0) ["channels"]=> int(3) ["bits"]=> int(8) ["gifversion"]=> string(6) "GIF89a" ["animated"]=> bool(true) ["delay"]=> int(4) ["trans"]=> bool(true) ["transcolor"]=> int(2) ["bgcolor"]=> int(2) ["numcolors"]=> int(256) ["interlace"]=> bool(false) ["appmarker"]=> array(0) { } } ["iptcRaw"]=> NULL } array(2) { [0]=> string(27) "ImageSizerEngineAnimatedGif" [1]=> string(18) "ImageSizerEngineGD" } string(14) "gif-trans-anim"
  14. Two issues to your useful module «EmailObfuscation»: 1. In PHP >= 8.1 a deprecated message is thrown for lines 247/248: is_nan() cannot handle NULL values 2. If a mailto link contains an "apostrophe" (’) in an RTE field (e.g. in <a href="mailto:events@saq.ch">d’annulations écrites</a>), the EMO javascript produces a strange character (see screenshots). Regards, Markus
  15. Hi @joshua Somehow the Scripts aren't loaded (the banner doesn't appear) when we access a url created with URL-Hooks https://processwire.com/blog/posts/pw-3.0.173/#introducing-url-path-hooks? Can you help? KR Orkun
  16. I honestly don't know how to really describe this. When I change a filter in «what pages to show», instead of loading the settings for that field, it seems lister pro is loading the entire filter-section again. See attached screenshots for a better explanation (I changed the field «template» to «created» for this). I deleted caches and temp-files - nothing helped. There aren't any error messages, either. Any ideas?
  17. Until now, I have set $parent_id in page selection fields (InputfieldPage) that have different root directories depending on the page being edited, with the following hook: $wire->addHookAfter('InputfieldPage::findPagesCode', function($event) { if(substr_count($event->object->name, 'select_focus_page') > 0) { $page = $event->arguments('page'); $return = $event->return; $parent_id = wire('input')->id; $event->return = wire('pages')->get($parent_id); } }); Now I see in inputfieldPage.module that the function 'findPagesCode' is deprecated. We are supposed to use the 'getSelectablePages' function instead. However: I haven't figured out how to use 'getSelectablePages' to set the $parent_id with a hook. Has anyone had more success with this? Translated with www.DeepL.com/Translator (free version)
  18. Hi all I'm trying to get a copy of an installation to run on my local machine. Copied the DB and all files from the server. Besides being painfully slow (which might just be my machine), I can't login to the backend. I get the infamous «This request was aborted because it appears to be forged»-Error. Tried EVERYTHING I was able to find in the forum (file/folder permissions in site/assets, deleting said folders, cleared the session-table in the DB and so on…) - I can't get it to work. PW 3.0.165 Heeeeeeelp ? [Edit] I also tried disabling the CSRF-Protection in the config, which gets rid of the error, but the login still doesn't work. I just get back to the login page without an error.
  19. Hi Guys We have a multi-site Installation with multiple different domains. How can we achieve, that when a user logs in from https://www.example.com that he is then also logged in on https://www.example2.com, https://www.example3.com and so on... Has someone ever done something like that?
  20. Hi Guys I have an Formbuilder Form which I am rendering on the frontend and also processing myself (I have checked the option "Submit to another URL (bypassing Form Builder processing)". I am also injecting a InputfieldFile Field "manually" with the form api to the fieldset object. The code looks like this: <?php namespace ProcessWire; $form = $forms->load("schaden-melden"); $inputfieldsform = $form->processor()->getInputfieldsForm(); $fieldsetSachverhalt = $inputfieldsform->find("name=sachverhalt"); $tempDir = wire()->files->tempDir('userUploads')->get(); $field = $modules->get("InputfieldFile"); $field->label = "Dateien hochladen"; $field->notes = "Maximal 10 Dateien, maximal 20 MB"; $field->required = 1; $field->attr("name+id", 'dateien'); $field->noCollapseItem = 1; $field->destinationPath = $tempDir; $field->extensions = "jpg jpeg gif png tif pdf"; $field->maxFiles = 10; $field->maxFilesize = 20*1024*1024; // 20mb foreach($fieldsetSachverhalt as $f) { $f->append($field); } $formFormBuilder = $forms->render($form); if($form->processor()->isSubmitted()){ $values = $form->processor()->getValues(); if($values['s_email'] == ""){ $p = new Page(); $p->template = 'damage-report-data'; $p->parent = $pages->get(1159); $p->name = session_id()."_".date("d-m-Y-H-i-s"); $p->sessionid = session_id(); $p->pd_anrede = $sanitizer->text($values['anrede']); $p->pd_vorname = $sanitizer->text($values['vorname']); $p->pd_nachname = $sanitizer->text($values['nachname']); $p->pd_strasse = $sanitizer->text($values['strasse']); $p->pd_hausnummer = $sanitizer->text($values['hausnummer']); $p->pd_plz = $sanitizer->int($values['plz']); $p->pd_ort = $sanitizer->text($values['ort']); $p->pd_telefon = $sanitizer->text($values['telefon']); $p->pd_policenummer = $sanitizer->text($values['policen_nr']); $p->pd_email = $sanitizer->email($values['e_mail']); $p->pd_eintrittsdatum = $sanitizer->text($values['eintrittsdatum_beginn_der_streitigkeit']); $p->pd_sachverhalt = $sanitizer->textarea($values['schadenmeldung_sachverhalt']); $p->pd_gegenpartei_adresse = $sanitizer->textarea($values['informationen_name_adresse_tel_etc']); $p->pd_reachable = $sanitizer->textarea($values['am_besten_erreichbar']); $p->contract_accepted = 1; $p->save(); $files = explode("|",$values['dateien']); foreach($files as $file){ if($file && file_exists($tempDir . $file)){ $currentSessionData->pd_files->add($tempDir . $file); } } $p->save(); session_regenerate_id(); $session->redirect($page->child("template=basic-page")->url); }else{ $out .= "Thank you, your form has been submitted."; $log->save("spams", json_encode(print_r($values, true))); } } else { $section = new \Sections($page); $section->injectForm($formFormBuilder); $out .= $section->renderSections(); } The Form itself is working and the files are also added to the pages I am creating. But the file field is not really user friendly at the moment. For example: 1. There is no option to delete the files when you have selected them from the disk: 2. When I select multiple files at once it only shows the first filename: 3. Lets say I send the form now and there are still errors in some other fields. The File Field is the rendered like in the processwire backend and the images are also lost (the files are linking to the page where the form/code itself is residing): 4. The valid extension property of the InputfieldFile is only working server side (means when form is send the files with the wrong filetype are just removed, but on the client side you can still upload for exmaple .doc files etc... When uploading file with false type nothing happens: When sending it removes the file: How can I adjust the File Field, that I can make the stuff above working just to my needs? I already needed to duplicate the InputfieldFile Module to the site folder because of some js error I was getting. I needed to make a change inside the InputfieldFile.js: I also must say that I don't know if the change above is also affecting the processwire backend in some way... I hope you can help me here out. PS: I know that the Formbuilder has it's own File Fieldtype but that File Fieldtype only works when the processing of the form is handled by the Formbuilder.
×
×
  • Create New...