Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/30/2018 in all areas

  1. Yes. There is a pagination limit of 999 pages. You can configure it to go beyond that (with caution). In /site/config.php/ $config->maxPageNum = 1500;// set your limit here http://processwire.com/api/ref/config/
    5 points
  2. I just edited the core file Pagefile.php and added on line 157 (pw version 3.0.89) this code : //if(!copy($filename, $destination)) throw new WireException("Unable to copy: $filename => $destination"); $fileTools = new WireFileTools(); if(!$fileTools->copy($filename, $destination)) throw new WireException("Unable to copy: $filename => $destination"); And... it works... Should I report something on Github ?
    4 points
  3. Inspired by the "max megapixels" option for the client-side image resizer, I made a simple module that adds target megapixel resizing for Pageimages. Image Megapixels A module for ProcessWire CMS/CMF. Adds methods to Pageimage objects useful for resizing to a target megapixel value. Example use You are creating a lightbox gallery of images with different aspect ratios. For the enlargements, rather than setting a fixed maximum width or height you want all the enlargements have the same size in terms of area, allowing a panoramic image to be wider than a square image, for instance. Another use case is sizing a gallery of sponsor logos. The supplied logos are different aspect ratios but you need to ensure the logos are sized so each has equal prominence on the page. The effect of resizing three different aspect ratios by the same megapixel target value can be seen in the screenshot below: Installation Install the Image Megapixels module. API // basic usage $pageimage = $pageimage->megapixels(float $megapixels); // usage with all arguments $pageimage = $pageimage->megapixels(float $megapixels, array $options = []); Example: foreach($page->images as $image) { echo "<img src='$image->megapixels(0.8)->url' alt='$image->description'>" } If needed you can supply an array of options for Pageimage::size() as a second argument. Getting dimensions If you just want to get the height and width dimensions needed to size an image to the given number of megapixels you can use the Pageimage::megapixelsDimensions() method that this module also adds. It returns an array with width and height as keys. Example of how this could be used to output a gallery of logos: foreach($page->logos as $logo) { $dimensions = $logo->megapixelsDimensions(0.01); $width = $dimensions['width']; $height = $dimensions['height']; $width2x = $width * 2; $height2x = $height * 2; echo "<img src='{$logo->size($width, $height)->url}' srcset='{$logo->size($width, $height)->url} 1x, {$logo->size($width2x, $height2x)->url} 2x' alt='Logo' width='$width' height='$height'>"; } https://github.com/Toutouwai/ImageMegapixels https://processwire.com/modules/image-megapixels/
    3 points
  4. Hi and welcome to the forum. Have you looked at kongondos Multisite Module and my recently published Kickstart module?
    3 points
  5. Hi @Tyssen What I usually do is : 1. Edit the getModuleInfo()'s module [...] 'page' => array( 'name' => 'general_settings', 'parent' => 'setup', 'title' => 'General settings', ), 'permission' => 'global-site-settings', 'permissions' => array( 'global-site-settings' => 'Access to Global Site Settings.' ), [...] 2. Uninstall / re-install the module 3. Add a new role : site-settings 4. Add to this role the permission : global-site-settings 5. Add the site-settings role to the user 6. Logoff / login the user No extra steps required.
    3 points
  6. Sorry, I know I am getting way OT with this Tracy stuff, but just wanted to let you know that the latest version adds the SQL Query column to the Selector Queries section of the Debug Mode panel. It seems to be stable enough to release, but let me know if you get any errors. Hopefully this should be a useful learning tool.
    3 points
  7. You can manually build the export however she needs. I would recommend https://github.com/PHPOffice/PhpSpreadsheet so you can write directly to Excel format. I would write an AdminActions action so you can give her a form to choose what she wants exported.
    3 points
  8. Remember that these modules were built by different developers - CroppbaleImage3 is not an upgrade to the Thumbnails module. The Thumbnails module was abandoned and @horst was kind enough to build this one and also put together a script to make the migration as easy as possible. The conversion from Thumbnails to CroppableImage is the only issue I have had with migrating any of my sites from PW 2 to 3 - I think that is pretty incredible for a major version upgrade. I am not meaning to sound dismissive, I understand it's not a simple migration, but I don't think it should be expected to be automatic in this scenario - I hope you understand.
    3 points
  9. Great for sponsor logos too so that no-one feels gipped.
    2 points
  10. @adrianromega, did you see the "Example use" section above? To expand on this... it's useful in any situation where you want to be fair to a group of images with different aspect ratios. Take the three images shown in the screenshot above. If these images had been resized using maxSize(800,800) for instance, photo 2 (the square image) would be larger than the others in total area - it would contain the most image data. Now suppose you're running a competition on your website where visitors can vote for the best photo. The three images above have been submitted by three different photographers. If you are resizing by maxSize() rather than megapixels then it's not fair on photographers 1 and 3 that their images are shown smaller than the image from photographer 2.
    2 points
  11. Why not set up the first site (or a kind of template site), run Site Profile Exporter, copy the created profile into the install package and run the regular installer with that profile for the subsequent domains?
    2 points
  12. Glad to hear. While I am introducing breaking changes, I thought it was time to tweak the output format syntax a little. I have committed a new version to the dev branch. It is now recommended to put your spaces and dashes outside the curly braces, eg: {+[phoneCountry]} {([phoneAreaCode,1,1])} {[phoneNumber,0,4]}-{[phoneNumber,4,4]} {x[phoneExtension]} Compare this to the old version: {+[phoneCountry] }{([phoneAreaCode,1,1]) }{[phoneNumber,0,4]-}{[phoneNumber,4,4]}{ x[phoneExtension]} I think the new way is cleaner, because the space, dash, etc between number components are not actually part of the component itself. Note that for the country "+" or extension "x" you still want those inside the { } component delimiters because they actually belong to that component of the number. Does that make sense and seem like a logical improvement to you?
    2 points
  13. @rick overcame that hurdle, now onto next one. Eventbrite is a great app but unfortunately : their v3 API doco is at best minimal and often misleading/confusing, the errors it reports are correct but don't accurately describe the exact problem, and what works on their browser based debug page doesn't always translate to the actual PHP API. In the above case, the order of the $_GET vars is important and when using one $param, the doco doesn't mention you also require another. In my case above, I needed both page_size and page (page_number). All good now. Still working on getting it all into a functioning PW module.
    2 points
  14. Similar issue in this thread, I think? I had a go at a solution for separately saving the original file name. This is for unzipped files though. If it is of interest, I can upload the module to a gist.
    2 points
  15. @dragan As @horst said, you can check your logs for bots. There are a small tips in the module admin for that : @Juergen what say <?php echo ini_get('allow_url_fopen'); ?> ? Sorry I don't understand what is saying the warning thing in German
    2 points
  16. One more option, but requires a pro module. Lister Pro has a delete/trash action in its set of bundled actions. I use this one a lot.
    2 points
  17. Presentation Originaly developped by Jeff Starr, Blackhole is a security plugin which trap bad bots, crawlers and spiders in a virtual black hole. Once the bots (or any virtual user!) visit the black hole page, they are blocked and denied access for your entire site. This helps to keep nonsense spammers, scrapers, scanners, and other malicious hacking tools away from your site, so you can save precious server resources and bandwith for your good visitors. How It Works You add a rule to your robots.txt that instructs bots to stay away. Good bots will obey the rule, but bad bots will ignore it and follow the link... right into the black hole trap. Once trapped, bad bots are blocked and denied access to your entire site. The main benefits of Blackhole include: Bots have one chance to obey your site’s robots.txt rules. Failure to comply results in immediate banishment. Features Disable Blackhole for logged in users Optionally redirect all logged-in users Send alert email message Customize email message Choose a custom warning message for bad bots Show a WHOIS Lookup informations Choose a custom blocked message for bad bots Choose a custom HTTP Status Code for blocked bots Choose which bots are whitelisted or not Instructions Install the module Create a new page and assign to this page the template "blackhole" Create a new template file "blackhole.php" and call the module $modules->get('Blackhole')->blackhole(); Add the rule to your robot.txt Call the module from your home.php template $modules->get('Blackhole')->blackhole(); Bye bye bad bots! Downloads https://github.com/flydev-fr/Blackhole http://modules.processwire.com/modules/blackhole/ Screen Enjoy
    1 point
  18. 1 point
  19. Well the module says it uses this https://github.com/perliedman/leaflet-control-geocoder which itself says it can also do Google. Since I did not change anything in the logic you should be able to select a different provider and then it should do exactly what you would like it to do. Just one further step ahead ...
    1 point
  20. An admin page to hold a module's config itself is not new and has been done. The bit about image upload via the module's config page, that I've not seen/heard of before. I'm wondering whether it is really worth the effort since you'd have to hook into the module class (I think), to catch the upload and save it to your admin page. Maybe it is easier to let your SEO be a process module and in there, create the interface for uploading images? The images will still be saved in your hidden admin page. You wouldn't have to hook into anything in this case. Will this module be accessible to non-superusers? In that case, you don't want them to be mucking about in ProcessWire's module pages. I'd go for a process module and save all text setting as one chunk of JSON in a text field in the hidden admin page. I use a similar approach in several of my modules, including menu builder. Just my 2p.
    1 point
  21. Ok thanks, then probably a firewall issue. Which type of webhosting you are trying the module on ?
    1 point
  22. @flydev It means "The waiting time for the connection has expired"
    1 point
  23. yeah they changed a lot of things since the module was first made; it's been updated to support the latest new folder structure, you only need to now copy the css, js, sprites and webfonts folders from the repo into the vendor folder. it should work then. not sue about the core icon preview, have not tested it, since i always use selectize.js for the that (and it does work)
    1 point
  24. Now it is working. This was a great update! The field is a simple field in a user profile template.
    1 point
  25. I do not use loginForm so I cannot really test it but after updating I had no issues at all.
    1 point
  26. One hundred and one % working now, Thanks ProcessWire Crew for the help & info! Oca2
    1 point
  27. @lpa - You could replace this module with https://github.com/rolandtoth/AdminOnSteroids . See https://github.com/rolandtoth/AdminOnSteroids/wiki/FieldAndTemplateEditLinks
    1 point
  28. I actually think it would be a great addition to have a "test" option in the Console panel - something that reported the changes that will happen - trouble is I think it would be a huge amount of work to implement.
    1 point
  29. @lpa - I have just committed another update - turns out my initial fix broke the standard form approach. The new version works with both. Because of the breaking changes, I have committed it to the dev branch (https://github.com/adrianbj/PageProtector/tree/dev) for now. I would really appreciate it if others using this module could please try this new version. The only change you should need to make is if you are using the custom Login Template option - you will need to change $loginForm to $page->loginForm I'll push this dev version to master once there's been a little time for others to test it.
    1 point
  30. I am not sure I quite understand the question Anything you run in the Console panel will do whatever it is meant to do, so if you run that bit of API code, the pages will be deleted. As for the trash - there isn't any real need to empty that though. I do myself at times because I like things clean, but there isn't any actual need to.
    1 point
  31. From a security standpoint, ProcessWire will not allow you to directly access PHP files in a number of its protected folders (including the site/templates folder) unless that file is a template file. You can read more about it here. In that thread you'll also find a number of workarounds. Only if it's outside PW directories. See option #1 in the post I linked to above. This means you won't have access to PW's API, unless you bootstrap it, which might not be worth the effort, if all you want to avoid is creating a page .. Many people often use option #3. Post to self (same page) and include your add_client.php in that page's template file (e.g., require_once('/path/to/add_client.php/')).
    1 point
  32. Almost one click - check out the Batch Child Editor module: http://modules.processwire.com/modules/batch-child-editor/ - either Edit or Replace mode. You could also code an API snippet and store it in the Tracy Console panel snippets list - just run it from the parent page (either on the frontend, or while editing the parent page in the backend - the console will get $page as the page being edited): Or you could use that code in an AdminActions (http://modules.processwire.com/modules/process-admin-actions/) action.
    1 point
  33. Did you try composer create-project processwire/processwire dev-dev --stability=dev ? Seems like the latest dev version is called "dev-dev". The download worked, but I didn't install it. Where is the PW version number usually mentioned ?
    1 point
  34. To get a "quote" how useful it maybe for a specific site, log all (search bots) user agents for a while.
    1 point
  35. @Robin S This is a GREAT explanation and is super appreciated. I totally get it... and now understand that some things don't work with in-memory selectors (modifying a PageFinder, in theory) – again I really appreciate your explanation.
    1 point
  36. The documentation could be clearer in this regard, and I'm probably oversimplifying here, but there two basic categories of selector usage in PW. 1. Methods that use the PageFinder class - common ones would be $pages->find($selector), $pages->get($selector), $page->children($selector). Also find/get selectors for $users. Those are the ones that spring to mind, although there might be a few more. These methods do a database query behind the scenes. 2. All other methods that accept a selector, for example $some_pagearray->find(), which is actually WireArray::find(). These methods do not query the database but work on items that are in memory. There are differences in the ways that these two categories of selector usage are implemented. Some things work in a PageFinder selector that don't work in an in-memory selector. The documentation for Selectors seems to be assuming the reader is interested in PageFinder selectors because there are code examples there that won't work with in-memory selectors. There isn't any definitive list of the differences (that I know of), but here are some things that I have found do not work with in-memory selectors (but do work with PageFinder selectors): 1. Datetime values as strings, e.g. "some_datetime_field>today" 2. Page statuses as strings, e.g. "status!=hidden" 3. OR groups In a perfect world selectors would work the same everywhere and you wouldn't have to think about it. There's an open request for this here.
    1 point
  37. Nice module, thanks for sharing. I wonder though how effective it really is reading the last two sections "caveat emptor" and "blackhole whitelist": https://perishablepress.com/blackhole-bad-bots/#blackhole-whitelist
    1 point
  38. This link under the download section leads to this Processwire page and not to Github because the href value is empty.
    1 point
  39. "Sounds" useful Thanks for sharing and caring!
    1 point
  40. Hi all. I'm assuming there's been some change over at MailGun over the past few days as this great module has stopped working on most sites that use it. I'm getting this error in the PW MailGun logs: cURL Error: SSL certificate problem: unable to get local issuer certificate It seems to be fairly common over the past couple of days on the MailGun-PHP github. Has anyone else had this issue?
    1 point
  41. I'm using sort of the same function, and although my setup is different (i have a custom menu generated from a branch on the tree) this might help, i use this right after the opening foreach: $menuVis = true; if($child->menu_roles->count()) { foreach($child->menu_roles as $cmr) { $menuVis = false; $cmrRole = wire('roles')->get("$cmr->name"); if (wire("user")->hasRole("$cmrRole") ) { $menuVis = true; break; } } } if($menuVis == false) continue;
    1 point
  42. Yes here $config->maxPageNum = 999; It's set in wire/config.php but you would add it to your site/config.php
    1 point
  43. You can't do this from the admin, as user management there is intended as an administrative task. But you can use the API to check and enforce role settings specific to your needs. For example, here's how you might make a "create vendor" form: if(!$user->hasRole('editor')) throw new WireException("You don't have access to add users"); if($input->post->submit_add_user) { $name = $sanitizer->pageName($input->post->user); $pass = $input->post->password; if(empty($name) || empty($pass)) { echo "<h3>Name and password are required</h3>"; } else if($users->get("$name")->id) { echo "<h3>That username is already taken</h3>"; } else { $u = $users->add($name); if(!$u->id) throw new WireException("error adding user"); $u->pass = $pass; $u->addRole('vendor'); $u->save(); echo "<h3>Added vendor: $u->name</h3>"; } } echo " <form action="./" method="post"> <h2>Create new user with vendor role</h2> <input type='text' name='user' /> <input type='password' name='pass' /> <input type='submit' name='submit_add_user' /> </form> ";
    1 point
×
×
  • Create New...