Leaderboard
Popular Content
Showing content with the highest reputation on 01/24/2018 in all areas
-
Seems I needed this at the same time as other ProcessWire devs. Timely! This module is simply a ProcessWire module wrapper for the PayWhirl API and being the initial release, may have a few unforeseen hiccoughs. Please be gentle with me when reporting any problems. As with all API's make certain your ducks are all lined up with the vendor first, in this case PayWhirl -https://app.paywhirl.com/ Download the module from GitHub at https://github.com/clipmagic/PayWhirlAPI Download the module from ProcessWire modules at http://modules.processwire.com/modules/pay-whirl-api/5 points
-
I don't think so. But I believe that you don't have the exactly same setup as @SamC, in which something, somewhere (a module, a prepend file, site/ready.php, whatever), already retrieves the children once before the code we see is executed. It's the only thing that makes sense. If you repeat code 2 in your test script, you'll get an output starting with 1|1|..., I'm pretty sure of that, so you can see the how, just not the where.3 points
-
@bernhard , have you looked at the query plan for both SQL statements using a profiling tool or SQL Management tool? I had a quick look at your SQL and the type of select query you're doing (lots of fields from lots of tables), an inner join is (almost) always going to be faster than subqueries . There are instances where subqueries can be quicker than a join. If the subset of data returned by a Subquery is much smaller than if the table was used in a join query, (1000 rows vs a million row table for example) than this is where Subqueries can really shine. I'm guessing your tables are not? If you can also use EXISTS, NOT EXISTS statements with a subquery, it's probably a good candidate as well because of the aforementioned reasons. Normally, I'm a big advocate of readability of code but I draw the line on SQL because very often this is the place for bottlenecks for entire applications & workflows and it's the one place where a poorly optimised query can really cause issues down the line in too many ways. More readable code which is less optimised might only cost you a ms or a few seconds. Poorly optimised queries can cost you hours and even days depending on the dataset. Proper indenting, good (SQL) coding standards and concise & detailed commenting can go a long way to improve readability of those yucky joins2 points
-
Okay, sorry, didn't know - then its probably the update module that does format the files this way. Never the less, I still think having the date in the filename would be the best default in the majority of cases, since if you want to restore a backup, you‘d probably want to know the date anyway. But no problem for me, I figured it out, its just that I tought maybe that would help some to get started faster. Still great Module without this change.2 points
-
@prestoav, @noelboss I also wanted a PayWhirl API for ProcessWire so just went ahead a built one. It's basic - simply a PW wrapper for the PayWhirl API but should be OK. Biggest gotcha I discovered was that at present, you need a paid PayWhirl account - not the freebie one. You could ask PayWhirl to grant access to your free account for development purposes... Will let you know their answer to my request for same.2 points
-
The thing is, that isn't the code from the OP. To experience the issue I believe you need to have a minimum of three usages of the same PageFinder operation (in this case, getting the children of the root page). In SamC's original code there were two usages where the children of root are retrieved (showing different alternatives for doing the same thing) and then a third usage of the children of root within the foreach that generates the dropdown menu. An explanation of what I believe is going on (to the extent that I understand it):2 points
-
We have it in use for years now on a very large site 400'000+ pages, no obvious issues so far.2 points
-
The title field is a multi language field, not a language alternate field. The id of the HTML input element is of the format Inputfield_[field name]__[language id] (Example: Inputfield_title__1013). You can see the language id in the address bar when you edit a language. In the showIf condition, enter that HTML id without the Inputfield_ prefix, e.g. title__1013!=''2 points
-
Since I was stuck to my flat today I took up a wish and rolled a Process module / CKEditor plugin combo that adds @-autocomplete like the mentions here in the forum to CKEditor fields. It's configurable, but only in module settings for now, the positioning of the select list is quite off and there's still some visual work to be done, so it is in early alpha state. Nonetheless, if you want to take a look, here it is: https://github.com/BitPoet/ProcessMention After installation, you may want to look into the "Additional selector" entry in the module's settings. You will most likely want to limit results to certain templates there. Edit: Updated to version 0.0.30 with fixed positioning of the dropdown. Edit2: Settings are configurable in field context now. If pwmentions is enabled, the according settings are shown on the "Input" tab.1 point
-
Hi @Chris, you PM'ed me with the question if I once had written a module that creates one page per uploaded image. No, I never had. But those questions are better asked directly to our friendly and helpful community. I remember too that there was something, but was it somas images manager? or does anyone else has written something among that line? If there isn't anything else around here, you may strip out the upload and page creation process from somas module.1 point
-
1 point
-
Yes, its called MySQL Query Cache To disable it for a connection : SET SESSION query_cache_type = OFF; More details there : https://www.dbrnd.com/2015/08/mysql-query-cache/ https://www.dbrnd.com/2015/08/mysql-query-cache-configuration/1 point
-
Offtopic: if you happen to use adminonsteroids module you can enable a simiar tweak: https://github.com/rolandtoth/AdminOnSteroids/wiki/Misc1 point
-
Most likely CKEditor eating up your iframe code if you've not configured (Input Tab) it to allow such code. If that's the case:1 point
-
@noelboss ProcessDatabaseBackups (by Ryan) uses the same default format as CronjobDatabaseBackup (e.g. dbname-1.sql) whereas the core class WireDatabaseBackup uses the default format: dbname_YYYY-MM-DD_HH-ii-ss.sql I don' t know where this format is in use. Since CronjobDatabaseBackup is built very close to ProcessDatabaseBackups I will stay compliant and don't want to change the current default format for the filename. Anyway you have always the option to modify the format for your needs in module settings, even in the format you prefer.1 point
-
Yes, it uses # as default name resulting in dbname-1.sql, dbname-2.sql etc – so one can not easily tell how old the date is... Since PW itself already uses a name with date appended when backing up to the same folder on upgrades, why not use the same? The format PW uses: dbname-Version-YYYY-MM-DD_HH-ii-ss.sql processwire-3.0.86-2018-01-09_13-36-54.sql1 point
-
As far as I can tell, translation for paywhirl is very limited (to one language) – a dealbreaker for us…1 point
-
Hi, you can hook into createdUser : wire()->addHookBefore('LoginRegister::createdUser', function($event) { $u = $event->arguments[0]; $u->roles->add(wire('roles')->get("custom-role")); $u->save(); });1 point
-
It's not that I think the PW admin isn't easy, but there are lots of scenarios where users don't need to edit site content in any big way and seeing the PW admin would confuse them more than anything. Like where your users just have an account so they can access a private "members" area, or view "premium" content, etc.1 point
-
Haven't seen that before. Any browser adddons that may mess with the backend js? Any errors in the js console when the issue happens?1 point
-
Just tried this morning on a completely fresh install, no prepended files, no extra modules etc. Created a basic structure just with basic page and included "_main-menu.php" which shows the issue of running $pages->children twice: <?php namespace ProcessWire; $root = $pages->get("/"); $topLevelsFirst = $root->children(); $topLevels = $root->children(); $topLevels->prepend($root); ?> <ul> <?php foreach($topLevels as $topLevel):?> <li> <a href="<?= $topLevel->url ?>"><?= $topLevel->title; ?></a> <ul> <?php foreach($topLevel->children as $topLevelChild): ?> <li><a href="<?= $topLevelChild->url ?>"><?= $topLevelChild->title ?></a></li> <?php endforeach; ?> </ul> </li> <?php endforeach; ?> </ul> ..which outputs: ...and <?php namespace ProcessWire; $root = $pages->get("/"); $topLevels = $root->children(); $topLevelsSecond = $root->children(); $topLevels->prepend($root); ?> <ul> <?php foreach($topLevels as $topLevel):?> <li> <a href="<?= $topLevel->url ?>"><?= $topLevel->title; ?></a> <ul> <?php foreach($topLevel->children as $topLevelChild): ?> <li><a href="<?= $topLevelChild->url ?>"><?= $topLevelChild->title ?></a></li> <?php endforeach; ?> </ul> </li> <?php endforeach; ?> </ul> ..which outputs: So I must have $pages->children called earlier on the page somewhere (probably in the main menu above my test one) which would cause the double home link. I think @BitPoet was right earlier about the pointer. This would also be why @kongondo and myself were getting different output.1 point
-
This option isn't present for a Select (Options) element. I'm going to rethink the setup - probably make each Photographer a page, and then use a page reference in the Uploaded Photo template.1 point
-
I like to use Lister (or Lister Pro) for this purpose. Rather than being limited to a single, static organisation of pages Lister allows you to view pages by any number of filters: date, author, field value, etc. Lister Pro has a number of useful features, including that you can create dedicated listers for particular preset filters, and include some default empty filters within the lister. But you can still achieve a lot with the core Lister using the Bookmarks feature.1 point
-
1 point
-
I think @Peter Knight might be talking about logging out a front-end user, in which case you might not want to expose the admin login URL to those users. I usually create a dedicated template and page /logout/ for the purpose.1 point
-
@benbyf Thanks for the feedback. @BitPoet I'll do that. Thanks, guys.1 point
-
1 point
-
Instruction for Ukrainian-speaking users: Завантажити архів (ZIP або CSV) В адмінці перейти: Setup - Languages - Add New Заповнити поля: Title -- Українська, Name -- uk Натиснути кнопку "Save" Натиснути кнопку "Choose File", щоб обрати завантажений архів, зачекати доки усі змінні завантажаться і натиснути "Save" У правому верхньому куті обрати Admin - Profile і перемкнути мову на "Українська". Рекомендовано вийти і зайти в адмінку1 point
-
1 point
-
Hi noelboss. Thanks for the Snipcart recomendation. This looks very good. I'm investigating...1 point
-
Alternatively... echo "<div id='options'>" . $page->getUnformatted('options')->title . "</div>"; // the <span></span> render correctly as HTML (unescaped) https://processwire.com/api/ref/page/get-unformatted/1 point
-
Not yet - I haven't come across any issues that the file compiler (or some small minor conditional) doesn't take care of. Not sure I am ready to ditch 2.x support just yet, but I'll definitely keep in mind your argument re this module. Maybe I should just ask here - anyone using this module on 2.x? Would anyone mind if it was made 3.x only?1 point
-
@godmok and @szabesz - well that took way too much time It's very rough, but please test the new version on the dev branch: https://github.com/adrianbj/FieldtypePhone/tree/dev This new version has lots of breaking changes, so please don't update an existing site. You'll need to uninstall and reinstall to get the new format for the default formats to show. You could I guess copy/paste them in from the module code to that field if you have data already that you can't lose. Format options now have a proper name associated with them, so if you change the pattern for a format, it should update the output everywhere. Also, you can now see exactly how each format will look based on the pattern, rather than you having to enter that in a comment at the end. When defining formats, follow this format. The category headings are optional. The key things is: name | pattern Now you can also call these formats separately from the API regardless of what the selected output format is. You can call like this: $page->phone->australiaWithCountryAreaCodeNoLeadingZero1 point
-
1 point
-
https://github.com/mr-fan/AutoImagePages1 point
-
MBR international is Sudanese mining company. The company aims to maximize shareholder value by through exploration and Production of precious metal and industrial mineral, MBR international mining subsidiary was established in 2015, engaged in Industrial Minerals and Metals mining and related activities including explorations, extraction and processing. **************1 point
-
Sorry no experience in this sector - I've had a look at https://www.mollie.com/ but never had the possibility to try it out but they seem to offer easy recurring payments.1 point
-
1 point
-
@LAPS: I just tested it with a stock 3.0.62 (basic profile) in different browsers and the module works there, so it's likely some leftover / failed cleanup from an older install. Can you uninstall the module in the backend and make sure that you don't have any pages named "mention" in the page tree under Admin? If yes, just delete it manually. Also, please check that you don't have an older module version lying around in the InputfieldCKEditor directory. Then, best download the very latest version (0.0.70) from the github repo and install that. Don't forget to copy plugins.js into the correct path, and best clear your browser cache. After installing the module, you should see a page titled "Mention Autocomplete" in the page tree under Admin.1 point
-
Hello, I am struggeling with the following. It concerns adding new content in the backend of the site. I have a template region with two fields. Country and provence wich is a child of country. Country is an amselect on the region template. I can select one or more countries. Now I would like to see only the children of selected countries (is present) in the selectbox provence. I looked at the possibilities of the query, but could not quite figure it out. Any tips?1 point
-
@ridgedale, sorry, I should have tested that hook better. It seems that PHP's strpos() function will not work with an integer (page ID) as a parameter. So the page ID needs to be cast to a string. I'll add the revised code below and edit my earlier replies. To fix your posts, first remove the hook in /site/ready.php. Next you will need to execute some API code. Not sure how experienced you are with that, so a couple of ways you can do it... 1. If you have Tracy Debugger installed you can use the Console panel. 2. Assuming your site is a dev site and you are the only person with access to it, you can put the code in a template file (e.g. home) and then load a page using that template on the front-end. Code is: $items = $pages->find("template=blog-post, include=all"); foreach($items as $item) { $item->of(false); $item->name = $item->id . '-' . $sanitizer->pageName($item->title, true); $item->save(); } When you have executed that and checked that your blog post names are okay you can remove the API code above from your template file (if you executed it that way) and add the revised hook back to /site/ready.php: $pages->addHookAfter('saveReady', function (HookEvent $event) { $page = $event->arguments(0); if($page->template != 'blog-post') return; // Only for the blog-post template if(!$page->id) return; // Skip pages that are brand new and aren't yet populated with data // If the page name doesn't start with the page id if(strpos($page->name, (string) $page->id) !== 0) { // Prepend the page id to the page name $page->name = $page->id . '-' . $page->name; } });1 point
-
Thank you BitPoet, that looks like a great starting point. I'll try this and report back... This recent experimental module by Robin S - add imgs via urls - could also be part of a solution.1 point
-
$config->urls->httpRoot https://processwire.com/blog/posts/processwire-2.6.18-updates-pagination-and-seo/#new-http-prefix-available-for-all-config-gt-urls-properties1 point
-
This happens when the user PHP runs as isn't the owner of the cache files. The file compiler tries to update the cache files with the modification time of their originals, and while writing to that file can succeed through group permissions, updating the modification time fails unless issued by the owner. Clearing the cache removes the cache files and recreates them with the PHP user as the owner, so the problem is gone.1 point
-
Hey guys, this upgrade now appears on PW 3.0 (devns) branch. If you are using the ~= operator in a search, like "title~=disability act" it now asks MySQL for the ft_min_word_len (per @LostKobrakai's suggestion above). If any word length falls under that threshold, it delegates that word to a separate REGEXP command in MySQL that matches whole words. This is actually an improvement over the code I mentioned earlier because the previous code that converts it to use a "%=" for short words could match things like "disability fact" or "react to this disability" etc. Whereas the new core addition will only match whole words in the same way that the MySQL index would, meaning the field would only match if it contained the exact words "disability" AND "act" somewhere in the field, and not some word that happens to contain the partial word "act". To take it further, it also now uses this technique to match stopwords that MySQL doesn't full-text index. Previously it would just exclude them from the search since the presence of a stop word would prevent a search from matching. Now you can perform searches that include those stop words and match them.1 point
-
@ryan How about using this http://stackoverflow.com/questions/5716362/how-can-i-get-the-value-of-mysqls-ft-min-word-len-configuration-variable-usin to retrieve the value on install and maybe a setting somewhere, where it can be readjusted ($config maybe)? It's hard to imagine this value to change often.1 point
-
Tom, there's a setting in MySQL called ft_min_word_len and the default is 4. That means that if you have any word in your query that is less than 4 characters, MySQL won't be able to match it unless that setting has been adjusted (and you've forced it to rebuild the indexes on your db/table). That's why you aren't able to match "Disability Act", because "Act" likely falls under your ft_min_word_len. You should be able to get the result you are looking for by using %= instead. But since you want to match "disability" and "act" anywhere in your search, you'd need to do this: template=document, title%=disability, title%=act The following code should use %= for words less than 4 characters and ~= for the rest. $search = $input->get->text("search"); if($search) { $selector = ''; $parts = explode(' ', $search); foreach($parts as $key => $part) { if(strlen($part) > 3) continue; // use MySQL LIKE for words under 4 characters in length $selector .= ", title%=" . $sanitizer->selectorValue($part); unset($parts[$key]); } if(count($parts)) { // use MySQL fulltext index for words 4 characters and higher $selector .= ", title~=" . $sanitizer->selectorValue(implode(' ', $parts)); } $results = $pages->find("template=document" . $selector); } else { $error = "Please enter a search term in the search box above."; $results = null; } Come to think of it, it might be nice if PW just did this for you automatically when it detected the condition... but we don't know what the ft_min_word_len setting is.1 point
-
That's a good point. I remember that I changed something like that a long time ago. I found my snippet sql errors - check (mysql 5.6.15): sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" remove STRICT_TRANS_TABLES1 point
-
Have a look if your mysql configuration has strict_trans_tables or strict_all_tables set. This prevents zero dates (since 5.7.4) from working. See http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sql-mode-changes for details.1 point