Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/08/2020 in all areas

  1. Last Saturday we started getting hit with heavy traffic at the processwire.com support forums, and it soon became a full blown DDOS frenzy. This post describes all the fun, how we got it back under control, and what we learned along the way— https://processwire.com/blog/posts/driving-around-a-ddos-attack/
    10 points
  2. Update: Blog 2.4.5 Changelog Added new option (see example use below) to MarkupBlog::getArchives() that allows to specify if archive months should be sorted descending (Dec - Jan). Default is ascending (Jan - Dec), thanks to question by @montero4 Fixed bug in template blog-archives.php that caused illegal offset warnings. Module has been updated in the modules directory. Example usage of new getArchives() option getArchives() now accepts a third parameter as an $options array. If you want archive months to be sorted and rendered in descending order (December - January), you will need to pass this as an option in the $options array and set the value 'descending' to they key 'archives_month_sort_order'. Since this is the third parameter for the method, you will need to pass options for the first and second parameters as well. If you want the default ascending order of months, you don't have to change anything in your code. Just call getArchives() as usual without any parameters. Otherwise, read on for descending order of months. <?php $blog = $modules->get("MarkupBlog"); // options: if we want to sort archive months in descending order $archiveOptions = array('archives_month_sort_order'=>'descending'); // get archives: order months descending $archives = $blog->getArchives(0, 1, $archiveOptions); // if you want to render the archives $content = $blog->renderArchives($archives);// order months descending Please test and let me know. Thanks.
    4 points
  3. Ah that's where the hickups came from. Maybe drastic, but we block all website traffic from China and email senders from Russia. Seems to handle 90% of rogue request. Beside that a few .htaccess lines to stop bad bots, scrapers, or scanners in our server area. Updated regularly after skimming through error logs. # bad bots RewriteCond %{HTTP_USER_AGENT} ^.*(Ahrefs|MJ12bot|Seznam|Baiduspider|Yandex|SemrushBot|DotBot|spbot|adscanner).*$ [NC] RewriteCond %{HTTP_USER_AGENT} ^.*(python|masscan|Researchscan|twotweak|site\.ru|X11|yacybot|netcraft).*$ [NC] RewriteCond %{HTTP_USER_AGENT} ^.*(BLEXBot|SemanticScholarBot|Nimbostratus|Mb2345Browser|UCBrowser|MQQBrowser).*$ [NC] RewriteCond %{HTTP_USER_AGENT} ^.*(LieBaoFast|yacybot|seocompany|Vagabondo|zoominfobot).*$ [NC] RewriteRule ^.*$ - [F,L] I see the same usual suspects in your blog post ?
    4 points
  4. Thanks! Anyone interesting in taking this project over? Given tools like this are part and parcel of a good developer experience these days I feel it is important to keep this project active to attract new devs. I would happily contrib to setting up new docs. Just been mucking around with vuepress, makes docs a cinch.
    2 points
  5. Was actually going to suggest that perhaps the modal window could have both options, but this would be much better ?
    2 points
  6. I guess a Page Autocomplete combined with that nice VEX-modal-PageListSelect that Robin shows in his screencast would be a great addition in general for PW ?
    2 points
  7. 2 points
  8. No problem, ? I know the uninstaller needs some work to be perfect. Uninstalling a shop system and such a huge plugin is nothing trivial. Page<->field<->template dependencies needs to be resolved and you need to be very careful to prevent unintended deletion of your whole products catalogue and templates. I'm just thinking about a "fire-and-forget" uninstaller which can only be called via URL param...
    1 point
  9. This is fixed: in the latest dev version wire/config.php points to the HTTPS URL of the modules directory, and the modules directory also again accepts HTTP connections (which should guarantee backwards compatibility).
    1 point
  10. Hi @montero4, Welcome to the forums and ProcessWire. This seemed like a nice feature to add so I have gone ahead and added it as an option to getArchives(). I'll release over the weekend. PS: I have moved your thread to the blog support forum.
    1 point
  11. UPDATE 2020-02-08 SnipWire 0.8.2 (beta) released! Its now possible to change the cart and catalogue currency by GET, POST or SESSION param via form submit or by adding an URL param or setting a session variable!
    1 point
  12. 1 point
  13. Inputfield Selector Select ID Uses the Page List Select inputfield for user-friendly input of page IDs into Inputfield Selector. Overview This module adds a feature to Inputfield Selector, which is most commonly seen in Lister (Find) and Lister Pro. When adding a filter row for "Parent", "Has parent/ancestor" or "ID" the user is expected to enter a page ID to match against. But this is not as user-friendly as it could be because the user may be able to identify the desired page by its title or location in the tree but not know its ID. This is particularly the case for site editors who may not even understand the concept of a page ID. So this module adds a thunderbolt icon to relevant rows in Inputfield Selector. When the icon is clicked a Page List Select inputfield opens in a modal window, allowing the user to visually select a page from the tree. When the modal is closed with "OK" the ID of the selected page is inserted into the filter row. Tip After a page selection has been made in the modal window the "OK" button will automatically receive focus so if you prefer you can close the modal by hitting the Enter key rather than mousing to the OK button. Installation Install the Inputfield Selector Select ID module. https://github.com/Toutouwai/InputfieldSelectorSelectID https://modules.processwire.com/modules/inputfield-selector-select-id/
    1 point
  14. Depends a lot on the use case: if you already know the title of the page you're going to pick (and only have a single item named like that), autocomplete is nice. Otherwise it can be pretty useless (as a selection mechanism): in some cases I've actually had to open a separate tab to browse to the page in the page tree just to find a name I can then type in an autocomplete field ?
    1 point
  15. The $page->links() method takes two optional arguments: NAME TYPE(S) DESCRIPTION selector (optional) string, bool Optional selector to filter by or boolean true for “include=all”. (default='') field (optional) string, Field Optionally limit results to specified field. (default=all applicable Textarea fields) You are passing only one argument, so this is interpreted as the first argument. Passing "$field='blog_body'" doesn't make this become the second argument - your code is saying "pass the string 'blog_body' as the first argument and also assign the string 'blog_body' to a variable named $field". If you want to specify the second argument (field) but not the first (selector) you need to pass a value for the first argument, and in this case you would pass the default value which is an empty string. So you would do this: $items = $page->links('', 'blog_body'); It would be reasonable to think that you could pass a sort as part of the selector argument, but actually this doesn't work because behind the scenes this method is ultimately just getting some page IDs and then loading data from the database using those IDs without any ORDER_BY clause. So you'll need to sort the links after you get them: $items = $page->links('', 'blog_body'); $items->sort('-blog_date');
    1 point
  16. Downloading Media From Media Manager Library I was recently asked whether it was possible to download media already uploaded to Media Manager. Currently, there is no automated way to do this. However, using the ProcessWire API, one can achieve this. Below is a starter code showing how one can download image media from Media Manager. I'll consider adding this feature to Media Manager. Please note that I have deliberately left Tracy debugging statements in the code. You will want to wrap this around a check if user is Superuser. // get limited number of media manager images $mmPages = $pages->find('template=media-manager-image, limit=10'); $tempName = 'media_manager_downloads';// temporary name for folder to place images in // 1. MAKE DIRECTORY // @note: could have used $files->tempDir('hello-world'); but not working for some reason // create a new directory in ProcessWire's cache dir $copyTo = $config->paths->cache . $tempName; if($files->mkdir($copyTo)) { // directory created: /site/assets/cache/media_manager_downloads/ // 2. COPY IMAGES // get and copy image assets foreach($mmPages as $p) { $images = $p->media_manager_image; foreach($images as $image) { //bd($image->filename,'image path')// to debug image path $copyFrom = $image->filename; $bool = $files->copy($copyFrom, $copyTo); //bd($bool,'copied?');// just to test if files were copied } } // 3. ZIP IMAGES // if files were copied, zip them if(!empty($files->find($copyTo))){ // create zip of all files in directory $copyTo to file $zip $zip = $config->paths->cache . "media-manager-image-files.zip"; $result = $files->zip($zip, $copyTo); echo "<h3>These files were added to the ZIP:</h3>"; foreach($result['files'] as $file) { echo "<li>" . $sanitizer->entities($file) . "</li>"; } if(count($result['errors'])) { echo "<h3>There were errors:</h3>"; foreach($result['errors'] as $error) { echo "<li>" . $sanitizer->entities($error) . "</li>"; } } // 4. SEND FILES TO BROWSER FOR DOWNLOADING // if files were added to zip file, send them if(!empty($result['files'])){ bd($zip,'files were added'); $files->send($zip); } } else { bd('NO FILES FOUND!'); } } Hope this helps.
    1 point
  17. I don't know your setup for the frontend templates and what you changed in the samples, but if you use the plain "Regular" site profile from PW installation it should work like in the screenshots. I decided to use the "Regular" profile for the samples because it has easy understandable templates and the most modern output strategy. Also with its replaceable markup regions, it was very easy to implement a shop interface without changing too much. SnipWire is built with the ProcessWire philosophy: To be as flexible as possible and to absolutely let the site developer decide what will be outputted in the front-end.
    1 point
  18. I'm not sure what the missing piece of the puzzle is. But I managed to put together a similar setup in a few minutes, and it all works as expected. Perhaps you can compare your setup with mine and you'll find out what you're missing. Here's what I did: Create a role "member" Create a login page with template "login". In that tpl I basically have if($user->isLoggedin() && !$input->get('profile') && !$input->get('logout')) { $goto = $pages->get(23115)->url; // the restricted page $session->redirect($goto); } else { echo $modules->get('LoginRegister')->execute(); } I'm too tired atm to write the rest all down, but here are screenshots. I'm not sure if a separate role than login-register is really required, but it's likely that login-register is going to be used by more than one user-type, and I guess it's good practice to handle permission stuff as granular as possible, to avoid headaches down the road.
    1 point
  19. Hi @adrian, I didn't know that module existed, it's not in the directory, is it? Because I looked if something like this already existed and didn't find anything. Might've saved me some trouble ? That said, I had a quick look, here's what I found in comparing both modules: ClearCacheAdmin exposes more options through the setup page, so there are available to everyone, whereas ProcessCacheControl has it's options in the module configuration, so they are only available to the developer. ClearCacheAdmin has multiple links (and multiple options) on the process page, giving the user more fine control, whereas ProcessCacheControl goes for a simpler interface and bundles all those actions into one (configurable) action with a single button. ProcessCacheControl can delete $cache entries without an expiry date, which ClearCacheAdmin doesn't as far as I can tell. ProcessCacheControl also lets you configure caches to be deleted by namespace, whereas ClearCacheAdmin offers each cache entry to be deleted individually (I think this has mostly to do with the module being a bit older, I believe $cache didn't have all those options back then). The largest difference is my concept of "cache actions", which ClearCacheAdmin doesn't have. I'm not sure how useful that will actually be yet. I think if I can expand on the actions available by default, it will be pretty handy. With ProcessCacheControl, you can add custom cache actions / profiles through the API, that may be useful depending on the use case. Adding to that, ProcessCacheControl has permission checks on a per-action basis. ProcessCacheControl can be modified and executed through the API. In particular, you can modify the default action and execute any action programmatically.
    1 point
  20. PageListSelect in a VEX modal - very nice ? Looks great!
    1 point
  21. Hi everyone, wireshell currently conflicts with newer versions of symfony/console – to workaround this, you cam use cgr to install wireshell. $ composer global require consolidation/cgr Make sure to add the correct bin directory to your PATH: PATH="$(composer config -g home)/vendor/bin:$PATH" Then add wireshell: $ cgr wireshell/wireshell Reload the console, voila – wireshell again.
    1 point
×
×
  • Create New...