Leaderboard
Popular Content
Showing content with the highest reputation on 12/20/2022 in all areas
-
2 points
-
Well... it depends. You get a credit of about $200 each month to work with some APIs. When you reach those limits you should have enough business to pay that small fee. ? Fun aside... grabbing all the review data via API and storing it as pages would make the most sense here. Check the Google My Business API. That seems to be an easy way to get all reviews. https://developers.google.com/my-business/content/review-data#list_all_reviews If I remember correctly there was yet another API that allowed getting reviews. But can't find it right now. Those WordPress plugins... I always wanted but never took the time to download and explore them. It's plain old PHP so it should be kind of easy to take them apart. I personally grab the reviews (or some of them) manually and update them once in a while. This way I (or the client) have full control on what's listed on the site. Adding a link to the real review and the full business entry on Maps. That works pretty well.2 points
-
@DV-JF https://github.com/processwire/processwire-requests/issues/2392 points
-
Found the solution ? /** * Modify submit button on doc-import pages */ $wire->addHookAfter('ProcessPageEdit::getSubmitActions', function(HookEvent $event) { $page = $this->pages->get($this->input->get('id')); if(!$page->id OR !$page->template == 'docimport') return; $event->return = []; }); $wire->addHookAfter("ProcessPageEdit::buildForm", function(HookEvent $event) { $form = $event->arguments(0); $page = $this->pages->get($this->input->get('id')); if(!$page->id OR !$page->template == 'docimport') return; $s = $form->getChildByName('submit_save'); $s->value = 'Import starten'; $s->icon = 'download'; }); ? Does anybody know how I can remove the dropdown items from the page edit submit_save button? As I didn't find a solution quickly I wanted to replace the button entirely, but this results in the following markup: $wire->addHookAfter('ProcessPageEdit::buildForm', function(HookEvent $event) { $form = $event->arguments(0); /** @var InputfieldForm $form */ $s = $form->getChildByName('submit_save'); /** @var InputfieldSubmit $s */ $form->remove($s); }); This hook results in this output: I could hide this markup via CSS but I'd prefer a clean solution ? Thx!1 point
-
Admin Restrict Branch Select is an add-on / companion module for Admin Restrict Branch. With this module enabled, you can manually select more than one branch parent per user via the branch_parent field, and users with more than one option selected will be able to switch between those while editing site content. Switching between branches is done via a select field injected at the top of the page tree. Note that users are still limited to one branch at a time: this module will not make it possible to view multiple branches at the same time. When the module is installed, it will automatically update the branch_parent field if deemed necessary, i.e. if it isn't yet configured to allow selecting multiple pages. You can make changes to the field later, if you want to restrict selectable options by template, use asmSelect instead of PageListSelectMultiple, etc. This is an early beta release, so be sure to test carefully before enabling this module in production! https://processwire.com/modules/admin-restrict-branch-select/ https://github.com/teppokoivula/AdminRestrictBranchSelect1 point
-
Hello there! I've come across a task to include the google reviews for a client website. You can see that kind of stuff nowadays on nearly every website, I personally am not a big fan of those review carousels but that doesn't matter. I am aware that there seems to be no module for ProcessWire to include those reviews into the site "out-of-the-box". So right now I only see two solutions: 1. Getting the reviews directly trough the Google Maps API PRO: You get a nicely formatted JSON Object that contains all data CONTRA: The maximum amount of reviews you recieve is limited to 5. Which is kind of a bummer. Plus: You have to register a Google Maps API Account to get an API Key which is mandatory for such requests. And this service is not free, too https://mapsplatform.google.com/pricing/ 2. Fetching the reviews over an HTTP request Thanks to @bernhard there is another solution. You take the link of a specific review and via DOM parsing (https://simplehtmldom.sourceforge.io/docs/1.9/api/file_get_html/) you fetch the review data directly form the source, save it as a page and use this as the source for your review. PRO: You only show the reviews you want in any order and as many as you need. CONTRA: A bit of work is involved, you have to add those review links manually to get the data. Other Solutions: It seems that every WordPress website includes such a review widget, and I just had to take a look to see what is different - please forgive me ? This widget here only needs the place ID to fetch all the reviews. No API Key required and the amount is not limited to 5. I wonder how this is possible? So what are your thoughts about this? Have you ever included google reviews in one way or the other on a website?1 point
-
@bernhard This looks very cool. How does it know to only register the hook once when you're working with multiple pages of the same class?1 point
-
Either I'm missing an important detail or ... // define yesterday $theDayBeforeYesterday = strtotime("-2 day"); // get our pages $reallyOldEvents = $pages->find("template=template, date<=$theDayBeforeYesterday"); foreach($reallyOldEvents as $oldEvent){ // let's do something with it // maybe we put them into an archive // and delete all of them in 2 years // rather than now. } Does this find your events prior to yesterday?1 point
-
https://processwire.dev/integrate-composer-with-processwire/ maybe this helps you1 point
-
This is working great. Thank you. Actually I had added it to the JSON before inside a migration method for MM settings. Since MM stores it's settings not as ModuleConfigData but as custom JSON, I had to come up with a method in our migration class that keeps the settings in sync between dev and live. Just in case anybody needs this, here is what I did: /** * apply settings to MediaManager */ private function applyMediaManagerSettings() { $path = $this->wire('config')->urls->admin . 'media-manager/'; $selector = "template=media-manager-settings, status<" . Page::statusTrash; if (!$this->wire('modules')->isInstalled('PagePaths')) $selector .= ", parent={$path}"; $settingsPage = $this->wire('pages')->get($selector); $settingsRaw = $settingsPage->media_manager_settings; $settings = wireDecodeJSON($settingsRaw); //allowed media types $settings['allowed_media'] = ['media' => [/* "audio", */"document","image","video"]]; // Add uploads to media library and publish them $settings['after'][0] = 1; // show filter profiles: yes $settings['show_filter_profiles'] = [1]; // Display User Media: Display all Media $settings['user_media_only'] = [1]; // Sort Media By: Created $settings['sort_media'] = [4]; // Sort Media Order: Descending $settings['sort_media_order'] = [2]; // custom columns in Media manager $imageFields = []; foreach (['products', 'clinical_applications', 'technologies', 'image_gallery'] as $field) $imageFields[] = $this->wire->fields->get($field)->id; $settings['custom_columns'] = array('image' => $imageFields); // filter profiles $settings['filters'] = [ "filter-by-tags" => ["defaultSelector" => "title%=, media_manager_image.tags~=, media_manager_document.tags~=, media_manager_video.tags~=", "title" => "Filter by Tags"], ]; // save settings $settingsPage->of(false); $settingsPage->media_manager_settings = wireEncodeJSON($settings); $settingsPage->save(); }1 point
-
Hi @gebeer, I cannot remember why I don't support it. I think it is just an oversight on my part. I will add this in the future. I used to have one in the docs but I cannot find that page now. I must have deleted it by mistake! Sorry. Better to add 'FieldtypeCheckbox' in the array in 'MediaManagerUtilities.php' around line #1814 (in the method allowedFieldTypes()). This is where I'll add it in a future release.1 point
-
OK I just tried something else… upgrading to dev branch 3.0.207 (newest dev branch), replacing master branch 3.0.200 THAT WORKED!! Now that's not to say there won't be any other issues that I'm not aware of at this point because, you know, it's the dev branch but at least that tells us something, right? Not sure what it tells me but it just seems to be a bug that has been fixed? So when is the next master version coming? Needless to say I would like to avoid using the dev branch for a live site.1 point
-
Btw, if you’re going to do $page->references()->count(), you will be better off telling references() that you just need the cound directly. In the end, these methods and properties all end up in FieldtypePage and provide some efficiency tricks like this. However, this will always query the database for every page in your array and every page field in your system, so if you want to get real gainz, you're probably best off just asking the database for your pages and the count somewhat like this: $query = wire('database')->prepare('select data, count(paged_id) from field_yourpagefield group by data'); $query->execute(); $results = $query->fetchAll(\PDO::FETCH_KEY_PAIR); $brands = wire('pages')->getById(array_keys($results), ['template' => wire('templates')->get('brand') , 'findTemplates' => false , 'getNumChildren' => false , 'joinSortfield' => false]); echo $brands->each(function ($brand) { return '<li>' . $brand->title . ' was referenced ' . $results[$brand->id] . ' times.'; }); At least that is what I was going to write reflexively before checking the core for something ready-made. That's the amazing thing about ProcessWire, that something like this just already exists and makes everything super easy.1 point
-
Ive been using signaturepad.js for this, its a js library that allows you to put an input field where users can sign (works really well on mobile), it outputs a png/jpg file that then you can upload to any image field you want (what i do for this on the front end is to upload the signature to a temp folder via ajax and then retreive the url and put it in a text field and then input that url to a $p->image->add($url); on server side, this works for a frontend implementation, i dont know if you require to do this using a processwire form1 point