Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/06/2018 in all areas

  1. It was a server issue and not a ProcessWire one - the reason behind the message "This request was aborted because it appears to be forged" on this case was because the PHP session path was not writable. The website is back online with backend working like a charm ?
    9 points
  2. Adds a soundex.field=something search option (so no custom operator) for database queries (so in your case, you'd use a selector like "soundex.firstname=$firstname, soundex.lastname=$lastname): <?php // Add to site/ready.php wire()->addHookAfter("PageFinder::getQueryUnknownField", function(HookEvent $event) { static $n = 0; $fieldName = $event->arguments(0); $data = $event->arguments(1); // We only handle our soundex queries if($fieldName != "soundex") return; if(empty($data["subfield"])) { throw new PageFinderSyntaxException("soundex selector expects the name of the field to search as subfield, e.g. 'soundex.title=something'"); } $selectors = $data["selectors"]; $selector = $data["selector"]; $query = $data["query"]; if(! $selector instanceof SelectorEqual) { throw new PageFinderSyntaxException("Invalid operator. Only '=' is allowed in soundex selectors"); } $subfield = "data"; $fieldName = $data["subfields"]; if(strpos($fieldName, '.') > 0) list($fieldName, $subfield) = explode('.', $fieldName); else $fieldName = $data["subfield"]; $field = wire('fields')->get($fieldName); if(!$field) { return; // does not resolve to a known field } // Initialize some needed variables $database = wire('database'); $table = $database->escapeTable($field->getTable()); $subfield = $database->escapeCol(wire('sanitizer')->fieldName($subfield)); $n++; $tableAlias = "_subquery_{$n}_$table"; $join = "$table AS $tableAlias ON $tableAlias.pages_id=pages.id"; $where = "$tableAlias.$subfield SOUNDS LIKE " . $database->quote($selector->value); $query = $data["query"]; $query->join($join); $query->where($where); $selectors->remove($selector); $event->return = true; });
    8 points
  3. In this post we look at a new core version on the master branch, and a new version of ProCache that includes a browser-cache busting feature called Buster: https://processwire.com/blog/posts/pw-3.0.98-procache-buster/
    7 points
  4. The reason, after the upgrade of Plesk and PHP, by default the PHP setting session.save_path point to /var/lib/php/session and not /var/tmp where before he got r/w permissions (I don't know if Plesk was already installed or not before the upgrade). The final problem was not MySQL.
    6 points
  5. Welcome @MikeM! Probably not telling you something you don't already know: the project may be simple conceptually, but it won't be a simple development task. You'll need to work with an experienced developer in order to get a good result with this project. PW is an excellent platform to use for just about any web project, and considering where you are posting this you'll probably find lots of people here who will tell you the same thing. But to be honest, there are many platforms that could be used successfully for this project - in reality the success is more likely to come down to the experience and skill of the developer you hire than the platform used. So seeing as you won't be building the site yourself, your task is really to evaluate developers rather than evaluate ProcessWire. That sounds unusual to me - I haven't heard of people developing one site just to serve as an example for another site they want developed. More typical I think is to use a wireframing tool to show the flow of interactions. This helps you clarify to yourself how the website will work and also helps communicate your intentions to the developer. The wireframe could also demonstrate the design if you wanted that, using a tool such as Invision. Here are some links to a few popular wireframing apps if you want to look at that approach instead: https://www.invisionapp.com/ https://www.mockflow.com/ https://wireframe.cc/
    5 points
  6. If you check this tutorial https://support.plesk.com/hc/en-us/articles/213367429-How-to-upgrade-MySQL-from-5-1-to-5-5-on-Linux, you can see a note that says "The PHP package can also be updated during this procedure". I did not pay attention to this because I had installed the latest version of PHP, but it seems that anyway the package and its configuration were changed during the upgrade. maybe.. and during the user login at admin too.. because like in my example, it can happen after the installation... At least we need a topic, or a recipe at https://processwire-recipes.com/ or wherever the option we have, to guide beginners like me. Explaining all the test that must be done after "This request was aborted because it appears to be forged" because after my investigation I found several causes for this, and almost 127 forum entries about it. https://www.google.com/search?q=site:processwire.com+"This+request+was+aborted+because+it+appears+to+be+forged" Now, at this moment I can breathe! I want to say a BIG THANK YOU to @flydev who won my admiration and has been a wonderful human being
    3 points
  7. It's a quick&dirty modification of a selector extension I whipped up out of curiosity a while ago. I'll take a look at it over the weekend.
    3 points
  8. +1 And in the cases of migrating a site to its new home, one should always install a clean ProcessWire instance in advance in order to test that the server environment is OK to begin with.
    3 points
  9. I think it could be checked on the installation process, checking if these path are writable or not and thus sending a warning that potential session issue could arise. I can't tell you, I think nothing, but I never tried to install this CMS ?
    3 points
  10. Hi and welcome to the forum! Your approach is good and flexible, so that's a good start! To output the alerts on all pages in the front end, you have some options. I'll show 2 of them: 1 - Do the logic in the layout file that's shared by all pages In a default PW project, all pages can share a main layout file, usually _main.php. And on this file, you can output your Alerts pages' content, like so: //_main.php file <body> <?php $alerts = $pages->find('template=alerts'); // considering your template is called "alerts" foreach ($alerts as $a): ?> <div class="alert"> <h1><?= $a->title ?></h1> <h1><?= $a->body ?></h1> </div> <?php endforeach; ?> ... rest of file 2 - Using the render function to output the content of you ALERT template in all, so the logic (the foreach etc.) is done in that file, not in _main.php
    3 points
  11. I think you could open an issue at GitHub explaining your example and providing the link to the 127 entries related to that error message. Maybe Ryan has an idea how he can add some checks that show more helpful informations and make it easier to track down the issue.
    2 points
  12. Found the reason. getQueryUnknownField is far younger than I expected. It was added in preparation for the field.owner.subfield syntax in 3.0.87 which was officially introduced in 3.0.95.
    2 points
  13. Assuming $rate is the final string you will output later, you need to set $rate="" before loop and use $rate .= "<sp...." in the loops. the '.=' is the key.
    2 points
  14. Hi @MikeM and welcome to the forum, your question was well structured and it seems that you put some time into writing your request. And you see that you got multiple helpful answers within a very short time period. That's how it usually works here - so if you decide to start learning pw you'll always find a helping hand here If you choose pw you should definitely take a look at my new module: You can build any form you want very easily. It's the only tool that I know that has frontend and backend validation in one go (making it super easy and fast to setup and highly maintainable) and it also has conditional fields, what you described as a must-have: https://doc.nette.org/en/2.4/form-validation There's also the pro module formbuilder, but I have only bought and never used it so I can't tell you anything about it. PS: If you need any assistance or new features for RockForms I would be happy to implement those features for you.
    2 points
  15. Hi, In the Google Search Bar, you can, for example, enter the following request: site:processwire.com/talk/ snipcart paypal And this, in order to have only the responses that are not in the ProcessWire Forums: -site:processwire.com/talk/ processwire snipcart paypal The first answer being this: https://docs.snipcart.com/getting-started/guides-and-tutorials Where there is a ProcessWire-related link which points to this: https://snipcart.com/blog/processwire-ecommerce-tutorial Have a nice weekend! NB: try this with Google -> site:snipcart.com paypal
    2 points
  16. ProcessWire will make you want to be, and then in a fairly short space of time become a developer. I've been using ProcessWire for a year now, and whilst I still haven't published any modules like the very talented people on this forum, I've more than tripled my clients, can take an idea to a working prototype stage in less than a week and honestly enjoy every minute I spend interacting with PW. My previous background was purely as a web designer, bespoke designs but using various modules and essentially piecing sites together as many do. I also started with a personal project to get my head around PW, it was essentially a membership based database where users could add 'titles' to their collection and share them with others, produce stats etc. I never finished it because I moved onto client work but it functions perfectly and was a great, pressure-free basis for learning PW. I did a bit of maintenance this evening on an old clients WordPress site, and it's just a bloated, illogical mess and just being logged in feels like a security risk. The other option you may want to consider is Laravel, which I started learning after picking up ProcessWire, but with having the CMS out of the box (plus a ton of other time saving benefits) means there's no real reason to use Laravel over PW.
    2 points
  17. hi and welcome, did you see the docs here: https://processwire.com/docs/tutorials/how-to-structure-your-template-files/ ? There's also a lot to read, if you like Old but still good i think. Also, as sergio already mentioned, have a look at the "default" site profile (choose it during installation and see what is different to your setup). You can adopt your setup to use it like the default profile easily (the keywords are append/prependTemplatefile): https://processwire.com/docs/tutorials/how-to-structure-your-template-files/page4
    2 points
  18. Module for hiding pages for non-superusers. Download HidePages Requirements ProcessWire 3.x Changelog 1.0.1 (31 March 2018) Module renamed to prevent confusion 1.0.0 (30 March 2018) Initial release
    1 point
  19. I'm a hands-on non-developer, new to ProcessWire and checking it out for future use on a particular project. The project is a forms-based collaboration web site, conceptually very simple, like a dating site or a freelance job site, where users create accounts and enter info via forms, browse content pulled from forms data, and so forth. Forms flexibility is the central requirement. Currently, I'm using WordPress, Gravity Forms (a premium plugin), and a minimal responsive theme, to rough things out. Part of the way in, I haven't hit major problems in representing the skeleton of the idea, like, you read this, fill this out, then go to this page, etc. Notably, with Gravity, I can easily add conditional logic, so, depending on the input to a field, subsequent fields will appear (different paths for different users is important). Beyond that, I'm trying not to have to customize anything, instead using other plugins to do basic things like adding custom sidebars depending on page - it's quick and easy, so far. I'm using WordPress+plugins to sketch things out, without having to think about the underlying coding. The next step plan is to use the WP version as an example (along with the written specs), and have a custom site developed - our own custom database and front-end - for efficiency, ease of future extension, and security. ProcessWire seems potentially like a great choice as the platform for the custom site, based on its apparent extreme flexibility (I'm still trying to get a handle on that). Right now, I'm wondering whether it makes sense for me to substitute PW for WP at this roughing out stage. I'm grasping the idea of PW being super flexible and atomic, but from what I've been reading, and from doing my-first-page stuff in a PW installation, there also seems to be a fairly steep learning curve for a non-dev like me. QUESTIONS: Is it worth learning to use PW to where I can do with it what I am doing now with WP, in order to get an idea of whether PW is suitable for the custom site - I'm up for substituting PW scripting for WP plugins, but don't want to get lost in the weeds? Is there a better way for me to evaluate PW? Will learning to use PW at a beginner level be an advantage later on if we have a PW developer build the production site? Any general thoughts would be...appreciated!
    1 point
  20. This is just an idea I've been playing with a while: adding support for SOUNDS LIKE operator. I'm not sure how much sense it makes in the larger context, but I'm posting it here nevertheless in case it results in something useful As a bit of a background, in MySQL SOUNDS LIKE is just a shortcut for comparing two strings passed to SOUNDEX() and as Wikipedia kindly explains, "soundex is a phonetic algorithm for indexing names by sound, as pronounced in English". In other words, SOUNDEX() converts a string to an "index" of sorts, and comparing index values of two separate strings answers the question of "do these two sound alike (in English)". SOUNDS LIKE works best with English words, and literally words, since comparing entire sentences is often much less sensible (there's no native "wildcard soundex operator" in MySQL) -- names of people, products, countries, cities, etc. are a good example where one might benefit from SOUNDS LIKE. Cases I've really wished this would've been possible have included especially name and city searches, where people tend to mistype things a lot. Yesterday I decided that this would be a cool experiment, so I applied following hack to the DatabaseQuerySelectFulltext.php and Selector.php, making "€=" the SOUNDS LIKE operator. This is wrong at many levels, but works as a simple proof of concept: diff --git a/wire/core/DatabaseQuerySelectFulltext.php b/wire/core/DatabaseQuerySelectFulltext.php index 9c6064f..421f38a 100644 --- a/wire/core/DatabaseQuerySelectFulltext.php +++ b/wire/core/DatabaseQuerySelectFulltext.php @@ -83,6 +83,12 @@ class DatabaseQuerySelectFulltext extends Wire { $query->where("$tableField LIKE '%$v%'"); // SLOW, but assumed break; + case '€=': + $v = $database->escapeStr($value); + $v = $this->escapeLIKE($v); + $query->where("$tableField SOUNDS LIKE '$v'"); // SLOW, but assumed + break; + case '^=': case '%^=': // match at start using only LIKE (no index) $v = $database->escapeStr($value); diff --git a/wire/core/Selector.php b/wire/core/Selector.php index 31748f9..fccfe8a 100644 --- a/wire/core/Selector.php +++ b/wire/core/Selector.php @@ -204,6 +204,7 @@ abstract class Selector extends WireData { Selectors::addType(SelectorLessThanEqual::getOperator(), 'SelectorLessThanEqual'); Selectors::addType(SelectorContains::getOperator(), 'SelectorContains'); Selectors::addType(SelectorContainsLike::getOperator(), 'SelectorContainsLike'); + Selectors::addType(SelectorSoundsLike::getOperator(), 'SelectorSoundex'); Selectors::addType(SelectorContainsWords::getOperator(), 'SelectorContainsWords'); Selectors::addType(SelectorStarts::getOperator(), 'SelectorStarts'); Selectors::addType(SelectorStartsLike::getOperator(), 'SelectorStartsLike'); @@ -284,6 +285,10 @@ class SelectorContainsLike extends SelectorContains { public static function getOperator() { return '%='; } } +class SelectorSoundsLike extends SelectorContains { + public static function getOperator() { return '€='; } +} + /** * Selector that matches one string value that happens to have all of it's words present in another string value (regardless of individual word location) * Just for fun I've been testing this new operator with a script like this (and using one of the most mistyped names I've seen on this forum as a test subject), to see if it works at all: <?php require 'index.php'; foreach (wire('pages')->find('title€=antti') as $k => $p) { echo $k . ". " . $p->url . "\n"; } // results look something like this: // 0. /anttti/ // 1. /antti/ // 2. /anti/ // 3. /antii/ So, what do you folks think -- is there anything in this that might be worth taking further? Can you think of a better approach to this, such as a custom fieldtype with SOUNDS LIKE support, or something? Anything else?
    1 point
  21. Looking at this all again now. I am working with manually created events (so there aren't any complications with API import) and I am still confused. This is what I set up: $recurme->renderEvent($page, array('dateFormat' => 'M d, Y @ g:i a')); results in: Error: Trying to get property of non-object on line: 682 of MarkupRecurme.module If I do: you can see that the "time" is off by an hour - probably a timezone issue, but how can I manually output something like: March 13th - March 30th, 2018 10:00 am - 2:00 pm This sort of output I am sure is quite common. The problem is that end_date: 1522562399 is 2018-03-31 11:59 but the event only goes until the 30th. So how do I get the 30th - do I have to parse UNTIL from rrule, or can do take end_date and subtract one day - what is the reliable way to get the actual end date? Sorry if I am being stupid - I can't believe I am the only person to come across these issues, but I don't think I am missing anything - I think the module just needs more properties with things like actual start date, start time, end date and end time so we can easily output custom formats. Let me know if you want to spend a little time on a live chat/call about this. Thanks!
    1 point
  22. Thanks @Macrura - knowing the version number helped me track it down. It only happens in Production mode. I have a fix in place. I am working on some other updates at the moment, so I'll release this fix with those a little later today. Thanks again!
    1 point
  23. >What version of Tracy are you running? 4.9.31 >When you say "but not any source" do you mean that lime 89 is blank? That's what I am seeing on the latest version. the error doesn't show any source file (template or module), just the error i posted. these are coming in through email; i'm not d() or bd(), at least as far as i know there none of those actively in any template or module files
    1 point
  24. Sparkpost is doing a webinar about how gdpr affects email worldwide. Maybe someone is interested... GDPR Affects Email Worldwide April 26, 2018 1 PM EDT/10 AM PDT register here For the Europeans: In Vienna it starts at 7 PM
    1 point
  25. "media" can (as any) or must be set by the options array you give the render() method. $options = array( "media" => $page->image->httpUrl() ); echo $modules->MarkupSociaShareButtons->render($options);
    1 point
  26. In that case, it's probably useful to show a PW warning notice for Superusers that some pages are hidden even for them. You might get tired of seeing the warning though :-)...but that can be set to show once per login session I suppose.
    1 point
  27. If I understand correctly, in your $selector, use body^=$q instead of body~=$q. (Note caret instead of tilde.) See https://processwire.com/api/selectors/#operators
    1 point
  28. I doubt it's a common scenario, but I have never seen a PW fieldtype work this way - normally you just call $page->fieldname so it's weird to get used to parsing an entire page to $recurme.
    1 point
  29. Hi Adrian - quick question, i'm getting this warning every day, just wondering if it could be something in my code, or what i should look for, as it is referencing TD.php, but not any source, maybe a misconfiguration of the module.. PHP Warning: in_array() expects parameter 2 to be array, null given in ...site/assets/cache/FileCompiler/site/modules/TracyDebugger/includes/TD.php:89
    1 point
  30. No, hidden is just hidden for find operations, but the page can still be accessed directly. You need to set it to "unpublished" (then a request leads to a 404 error not found). Then you need to add "include=all" to your $pages->find() selector otherwise it will not find your alerts.
    1 point
  31. that looks totally fine to me just make sure that the alert pages itself are not accessible from the frontend. maybe I'm wrong, but I guess you have some "bootstrap_alert" pages with a related bootstrap_alert.php file in the templates folder? then those pages will be accessible as /whatsoever/youralertpage1 from the frontend and that might not be what you want?
    1 point
  32. Thank you both for your reactions! I like the way to render() a page, so that's what I do now. Thanks a lot! PS: this is my code now (I know there will be better ways, but I like it this way): <!-- Alert(s) --> <?php $alerts = $pages->find('template=bootstrap_alert'); foreach ($alerts as $alert) { echo $alert->render(); } ?>
    1 point
  33. @Sergio A late Bingo! After a few hours of sleep I picked up your hint once more, although I still don’t understand what's going on with the hyphens. So I simply deleted the _strings.php of the translater and re-imported it. The number of hyphens appeared reduced and everything works now as expected. Another big thank you – the day is suddenly showing a much sunnier face as this little evil is defeated.
    1 point
  34. The "customized Google Search for Processwire" only brings results from the processwire.com website. -site:processwire.com/talk/ or -site:processwire.com/blog/ or -site:processwire.com, for example, excludes a section or all of the processwire.com website.
    1 point
  35. Or use the customized Google Search for Processwire https://cse.google.com/cse/publicurl?cx=014789015761400632609:fxrf0rj4wr4
    1 point
  36. Great that you found the issue. Would be curious what WordPress would have done on that server ? Do you think it would make sense to improve processwire so that it showed an appropriate error message in such cases? Would that be even possible? If yes maybe someone can make a PR? ☺
    1 point
  37. mel47'suggestion should work. Remember to put setlocale() in your config. A fresh PW installation should remind you of this. http://php.net/manual/en/function.setlocale.php You might be interested in making the <HTML> tags on your website obey the locale as well. https://www.w3.org/International/questions/qa-html-language-declarations
    1 point
  38. Why not... make a Template for months with a title (Januari-December) and index (1-12) field. Then make 12 pages with this template representing each month. make a Field (month) of the Page type. Configure it to accept only 1 choice of the template we made for the month. Voila, a translatable month picker! make a Field (year) which can be an Integer with a minimum and maximum value of your choice. This way you are 100% sure that the input of your client is clean without having to mess with a regex. The downside is that it requires two fields instead of one, and some data management. I find that permissable as you explicitly don't want to store a full datetime. You could configure the template that contains these Fields to display them next to another at 50% width to show the user their intent to be used together. Consider making these fields required.
    1 point
  39. Hi Kevin! Welcome to the forums. Add the "currentLinkMarkup" to your array, like this: $results = $baustelle->children("limit=2"); $pagination = $results->renderPager(array( 'nextItemLabel' => "Next", 'previousItemLabel' => "Prev", 'listMarkup' => "<ul class='pagination mg-b-0'>{out}</ul>", 'itemMarkup' => "<li class='page-item {class}'>{out}</li>", 'linkMarkup' => "<a class='page-link' href='{url}'>{out}</a>", 'currentLinkMarkup' => "{out}", 'currentItemClass' => "active" )); echo $pagination;
    1 point
  40. @ICF Church Hi, I've released new version which should fix your problem, I know it is a little bit late but if you are still interested, you may try it. I didn't face the error before but now, there are some misterious ways to me how PW detect module updates and sometimes detect the updated module as a new module so the `upgrade` method is not executed and the namespaces are not fixed which leads to the error mentioned by you. So I've moved the 'namespaces fix' code to the init method so it will check if the namespaces are fixed each time the module is initialized. It may happed that you will see the 'Fieldtype 'FieldtypePDF' does not exist' when updating the module, just hit the refresh button again and you are fine.
    1 point
  41. I disagree. I have had no problems at all for some years and on several websites. Also I followed the forum quite intensively and I've never come across any serious problems with that. But maybe I'm misunderstanding what you mean by "black hole". If you are not able to solve this problem on your own, I'm sure there are many experienced developers you can pay for professional support. There is the jobs board in the forum and you could even ask ryan per email to assist. There is also the possibility to contact your hosting provider for backups. Then you can start from the last working version. Finally: It seems to me that the problem you are having is totally NOT related to processwire. The same could have happened with wordpress: When you break the setup of your server, the CMS has no chance to run properly. Another advice would be to start from your last working backup, protocol every step you take and share your information here. Sometimes when you write things down the solution pops up and asking that question isn't even necessary anymore. Good luck, bugfixing sucks - independent from any cms
    1 point
  42. I opened a feature request topic about this in the ProCache sub-forum (not sure if you have access to that). Will be interesting to see if Ryan will consider adding such a feature.
    1 point
  43. The answer to the original question seems to be: // use this $config->httpHosts = array(); // instead of this $config->httpHosts = array(''); I guess the 2nd line creates an array with an empty item, not an empty array. But I still have a problem with empty httpHosts config on https sites. They just do not want to work without $config->httpHosts set explicitly.
    1 point
  44. Try $pages->find("template=visit-detail, limit=10, sort=sort");
    1 point
×
×
  • Create New...