Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


fruid last won the day on August 25 2022

fruid had the most liked content!

Recent Profile Visitors

2,320 profile views

fruid's Achievements

Hero Member

Hero Member (6/6)



  1. Though this is very helpful, I am still not sure how this works. I can do stuff like this: i.e. access the custom public methods of the user object from outside the class. I have also of course no problem accessing private classes within the here discussed user extension class. However, how does the code change when I define and use a public method from inside and from outside the class. Do I need to pass it the $event?
  2. Hello dear processwirers, I hope you are doing well. I'm a bit stuck implementing this module. Since the "Edit Profile"-form renders when the GET-params are "profile=1" But that form also submits to the same page with the same GET-params "profile=1" I don't see how I can redirect the page upon form submission without ruling out the case that the user is just on the edit profile page. That also means that when the form was submitted and I refresh the page, the browser asks me if I want to resubmit. In more technical terms: how can I edit the form action URL? Thanks for help!
  3. I meant only return /de/ or /en/, is there no native method to do that?
  4. what's the best way to return the user's current language specific URL segment? I mean for example /en/ or /de/ depending on the user's active language?
  5. I want to create a web app where users can login/register via Google I've seen a handful of modules that promise similar things including Oauth2Login, SocialLogin and GoogleClientAPI What I need is the user to be able to login/register via their Google-account and upon that to be logged-in both in their PW-CMS account as well as in their respective Gmail-account in the browser and me to have access to specific data via Google API. My guess is I would need to combine two modules? Maybe GoogleClientAPI with LoginRegister? Or GoogleClientAPI with LoginRegisterPro? Or can GoogleClientAPI do both? Thanks for suggestions!
  6. I'm trying to create a hook that would populate my SEO-Markup fields automatically with some field values of the page upon saving. For some reason I cannot access the MediaManager image field's ->media property and its properties, it returns null. I do see this in the tracy console though… //ready.php $wire->addHookBefore('Pages::saveReady', function($event) use($sanitizer) { $page = $event->arguments[0]; if (!$page->id) return; if ($page->isChanged('seo_title') || $page->isChanged('seo_image') || $page->isChanged('seo_description')) return; // SEO image :D if ($page->seo_image == '') { $filled = false; bd($page->mema_images); // see screenshot bd($page->mema_images->count); // 3 if ($page->mema_images->count > 0) { $imageURL = $page->mema_images->first->media->url; bd($imageURL); // null :( $filled = true; } if ($filled == true) { $imageURL = strval($imageURL); $page->seo_image = $imageURL; $page->message('SEO image was filled because it was empty :D'); $filled = false; } } // SEO description :D - this works fine if ($page->seo_description == '') { $filled = false; $description = ''; if ($page->preview != '') { $filled = true; $description = $page->preview; } if ($filled == true) { $description = SEOcleanUp($description, $sanitizer); $page->seo_description = $description; $page->message('SEO description was filled because it was empty :D'); $filled = false; } } $event->arguments(0, $page); });
  7. The module still needs quite some improvement. One issue that needs attendance is the following. I build a selector and select a page array from the database. $selector = $this->createSelector($this->q, $category); bd($selector); $unfilteredMatches = $this->pages("$selector, start=0, limit=99999"); As discussed in this thread it's (so far) impossible to select pages based on language specific field values. So the query looks through the field values in all languages for the search term. Since this is not what I want, instead I want the query to only match the fields values of the current user language, I do another loop and within that loop, with the method buildSnippets() I create the snippets for the markup. If this returns null (this is now language specific) I sort out the page entirely. $strippedFieldValue = strip_tags($fieldValue); // Find the position of the search term in the field value $position = stripos($strippedFieldValue, $searchTerm); // If the search term is not found, return an empty string if ($position === false) { return false; } So basically I'm selecting once via selector and then narrow it down with a loop. That works for a one-term search query or an exact phrase, but it makes sense that It won't and doesn't work when the search operand is on the fancier side as listed here: https://processwire.com/docs/selectors/operators/#contains What would you suggest? Is my approach so far sensible? Should I hard-code a different loop condition for each of the fancy search operands? I want to give the module-user (not enduser but admin user) the option to adjust the search operand in the module's settings. Thanks for help!
  8. OK I found the culprit. I was initiating the module on a custom page class just to make use of one method., not a good idea.. Now that I found a work-around it works fine and I can uninstall with no issues.
  9. I actually found this in the modules.txt log file: 2023-12-21 11:36:09 admin https://mysite.ddev.site/admin/module/edit?name=SimpleSearch&collapse_info=1 Uninstalled module 'SimpleSearch' 2023-12-21 11:36:10 admin https://mysite.ddev.site/favicon.ico Installed module 'SimpleSearch' Super strange! I removed the favicon.ico links in the head tag, removed the favicon icons, cleared cache, refreshed modules, cleared compiled files, issue remains Will try this now: EDIT: I just tried this and Tracy doesn't bd-log anything from inside the install() method nor the uninstall() method, I mean not even this gets logged: bd('install'); So strange!
  10. OK then I think the right question to ask would be: why am I seeing this?
  11. I don't know if this is related but I'm seeing a lot modules under the "Missing" tab which are actually not missing. I did of course refresh and check for new modules and also clear compiled files. The modules do appear under "Missing" and under the regular modules tab as if they were just fine. At least one of them, "System Notifications" is even a core-module and I think TineMCE as well, see screenshot.
  12. not sure what parent means in this context…
  13. I tried refresh and clear compiled files, doesn't help. Now thinking maybe this problem is related? I posted here yesterday… https://processwire.com/talk/topic/21128-solved-invalid-module-name/?do=findComment&comment=237939 But AFAIK I followed the naming convention alright, that's why I'm kinda stuck.
  14. yes I'm in debug and have tracy. When I uninstall, I can confirm that what ever I log from inside the __uninstall() method doesn't get logged. That is strange. Also, in the module I defined some hooks that get triggered when saving a template. Might that be the culprit? It still makes no sense to me since when I'm uninstalling the module, I'm not on and am not editing a template. public function ready() { $this->addHookAfter("ProcessTemplate::buildEditForm", $this, 'addSimpleSearchCategoryField'); $this->addHookBefore("ProcessTemplate::executeSave", $this, 'saveSimpleSearchCategoryFieldValue'); }
  • Create New...