Leaderboard
Popular Content
Showing content with the highest reputation on 04/09/2020 in all areas
-
Moving slowly back from concepts to coding and started with some easy tasks like reading. There were a few interesting articles - unfortunately only a few web and dev related ones - but I don't want to miss the opportunity to share them with you. I will add/update this thread as I walk through each and every article. Please, feel free to add your current findings! CSS Findings From The New Facebook Design https://ishadeed.com/article/new-facebook-css/ Styling Scrollbars with CSS: The Modern Way to Style Scrollbars https://alligator.io/css/css-scrollbars/4 points
-
In case anyone else hates it when websites do that, set these to false in Firefox about:config: layout.css.scrollbar-color.enabled layout.css.scrollbar-width.enabled And perhaps this one to true: widget.disable-dark-scrollbar2 points
-
@David Karich asked me how one can get values of an options field instead of an ID. It's unfortunately not implemented yet, but it can be quite easily be done manually (and that has the benefit of being extremely flexible and not limiting). I added an example to the readme! Example of how to get values of an options field instead of their IDs: $f = new RockFinder2(); $f->find('template=basic-page, include=all'); $f->addColumns(['title', 'options']); $f->query->select("opt.value AS `options.value`"); $f->query->leftjoin("fieldtype_options AS opt ON opt.option_id = _field_options.data"); db($f->getData()->data); Dumping the query object will be really helpful on such tasks! You can also replace the field's value instead of adding it to the result: $f = new RockFinder2(); $f->find('template=basic-page, include=all'); $f->addColumns(['title', 'options']); $select = $f->query->select; unset($select[2]); $f->query->set('select', $select); $f->query->select("opt.value AS `options`"); $f->query->leftjoin("fieldtype_options AS opt ON opt.option_id = _field_options.data"); db($f->query); db($f->getData()->data);2 points
-
Hi everyone, Here's a new module that I have been meaning to build for a long time. http://modules.processwire.com/modules/process-admin-actions/ https://github.com/adrianbj/ProcessAdminActions What does it do? Do you have a bunch of admin snippets laying around, or do you recreate from them from scratch every time you need them, or do you try to find where you saw them in the forums, or on the ProcessWire Recipes site? Admin Actions lets you quickly create actions in the admin that you can use over and over and even make available to your site editors (permissions for each action are assigned to roles separately so you have full control over who has access to which actions). Included Actions It comes bundled with several actions and I will be adding more over time (and hopefully I'll get some PRs from you guys too). You can browse and sort and if you have @tpr's Admin on Steroid's datatables filter feature, you can even filter based on the content of all columns. The headliner action included with the module is: PageTable To RepeaterMatrix which fully converts an existing (and populated) PageTable field to either a Repeater or RepeaterMatrix field. This is a huge timesaver if you have an existing site that makes heavy use of PageTable fields and you would like to give the clients the improved interface of RepeaterMatrix. Copy Content To Other Field This action copies the content from one field to another field on all pages that use the selected template. Copy Field Content To Other Page Copies the content from a field on one page to the same field on another page. Copy Repeater Items To Other Page Add the items from a Repeater field on one page to the same field on another page. Copy Table Field Rows To Other Page Add the rows from a Table field on one page to the same field on another page. Create Users Batcher Allows you to batch create users. This module requires the Email New User module and it should be configured to generate a password automatically. Delete Unused Fields Deletes fields that are not used by any templates. Delete Unused Templates Deletes templates that are not used by any pages. Email Batcher Lets you email multiple addresses at once. Field Set Or Search And Replace Set field values, or search and replace text in field values from a filtered selection of pages and fields. FTP Files to Page Add files/images from a folder to a selected page. Page Active Languages Batcher Lets you enable or disable active status of multiple languages on multiple pages at once. Page Manipulator Uses an InputfieldSelector to query pages and then allows batch actions on the matched pages. Page Table To Repeater Matrix Fully converts an existing (and populated) PageTable field to either a Repeater or RepeaterMatrix field. Template Fields Batcher Lets you add or remove multiple fields from multiple templates at once. Template Roles Batcher Lets you add or remove access permissions, for multiple roles and multiple templates at once. User Roles Permissions Batcher Lets you add or remove permissions for multiple roles, or roles for multiple users at once. Creating a New Action If you create a new action that you think others would find useful, please add it to the actions subfolder of this module and submit a PR. If you think it is only useful for you, place it in /site/templates/AdminActions/ so that it doesn't get lost on module updates. A new action file can be as simple as this: <?php namespace ProcessWire; class UnpublishAboutPage extends ProcessAdminActions { protected function executeAction() { $p = $this->pages->get('/about/'); $p->addStatus(Page::statusUnpublished); $p->save(); return true; } } Each action: class must extend "ProcessAdminActions" and the filename must match the class name and end in ".action.php" like: UnpublishAboutPage.action.php the action method must be: executeAction() As you can see there are only a few lines needed to wrap the actual API call, so it's really worth the small extra effort to make an action. Obviously that example action is not very useful. Here is another more useful one that is included with the module. It includes $description, $notes, and $author variables which are used in the module table selector interface. It also makes use of the defineOptions() method which builds the input fields used to gather the required options before running the action. <?php namespace ProcessWire; class DeleteUnusedFields extends ProcessAdminActions { protected $description = 'Deletes fields that are not used by any templates.'; protected $notes = 'Shows a list of unused fields with checkboxes to select those to delete.'; protected $author = 'Adrian Jones'; protected $authorLinks = array( 'pwforum' => '985-adrian', 'pwdirectory' => 'adrian-jones', 'github' => 'adrianbj', ); protected function defineOptions() { $fieldOptions = array(); foreach($this->fields as $field) { if ($field->flags & Field::flagSystem || $field->flags & Field::flagPermanent) continue; if(count($field->getFieldgroups()) === 0) $fieldOptions[$field->id] = $field->label ? $field->label . ' (' . $field->name . ')' : $field->name; } return array( array( 'name' => 'fields', 'label' => 'Fields', 'description' => 'Select the fields you want to delete', 'notes' => 'Note that all fields listed are not used by any templates and should therefore be safe to delete', 'type' => 'checkboxes', 'options' => $fieldOptions, 'required' => true ) ); } protected function executeAction($options) { $count = 0; foreach($options['fields'] as $field) { $f = $this->fields->get($field); $this->fields->delete($f); $count++; } $this->successMessage = $count . ' field' . _n('', 's', $count) . ' ' . _n('was', 'were', $count) . ' successfully deleted'; return true; } } This defineOptions() method builds input fields that look like this: Finally we use $options array in the executeAction() method to get the values entered into those options fields to run the API script to remove the checked fields. There is one additional method that I didn't outline called: checkRequirements() - you can see it in action in the PageTableToRepeaterMatrix action. You can use this to prevent the action from running if certain requirements are not met. At the end of the executeAction() method you can populate $this->successMessage, or $this->failureMessage which will be returned after the action has finished. Populating options via URL parameters You can also populate the option parameters via URL parameters. You should split multiple values with a “|” character. You can either just pre-populate options: http://mysite.dev/processwire/setup/admin-actions/options?action=TemplateFieldsBatcher&templates=29|56&fields=219&addOrRemove=add or you can execute immediately: http://mysite.dev/processwire/setup/admin-actions/execute?action=TemplateFieldsBatcher&templates=29|56&fields=219&addOrRemove=add Note the “options” vs “execute” as the last path before the parameters. Automatic Backup / Restore Before any action is executed, a full database backup is automatically made. You have a few options to run a restore if needed: Follow the Restore link that is presented after an action completes Use the "Restore" submenu: Setup > Admin Actions > Restore Move the restoredb.php file from the /site/assets/cache/AdminActions/ folder to the root of your site and load in the browser Manually restore using the AdminActionsBackup.sql file in the /site/assets/cache/AdminActions/ folder I think all these features make it very easy to create custom admin data manipulation methods that can be shared with others and executed using a simple interface without needing to build a full Process Module custom interface from scratch. I also hope it will reduce the barriers for new ProcessWire users to create custom admin functionality. Please let me know what you think, especially if you have ideas for improving the interface, or the way actions are defined.1 point
-
--- Module Directory: https://modules.processwire.com/modules/privacy-wire/ Github: https://github.com/blaueQuelle/privacywire/ Packagist:https://packagist.org/packages/blauequelle/privacywire Module Class Name: PrivacyWire Changelog: https://github.com/blaueQuelle/privacywire/blob/master/Changelog.md --- This module is (yet another) way for implementing a cookie management solution. Of course there are several other possibilities: - https://processwire.com/talk/topic/22920-klaro-cookie-consent-manager/ - https://github.com/webmanufaktur/CookieManagementBanner - https://github.com/johannesdachsel/cookiemonster - https://www.oiljs.org/ - ... and so on ... In this module you can configure which kind of cookie categories you want to manage: You can also enable the support for respecting the Do-Not-Track (DNT) header to don't annoy users, who already decided for all their browsing experience. Currently there are four possible cookie groups: - Necessary (always enabled) - Functional - Statistics - Marketing - External Media All groups can be renamed, so feel free to use other cookie group names. I just haven't found a way to implement a "repeater like" field as configurable module field ... When you want to load specific scripts ( like Google Analytics, Google Maps, ...) only after the user's content to this specific category of cookies, just use the following script syntax: <script type="text/plain" data-type="text/javascript" data-category="statistics" data-src="/path/to/your/statistic/script.js"></script> <script type="text/plain" data-type="text/javascript" data-category="marketing" data-src="/path/to/your/mareketing/script.js"></script> <script type="text/plain" data-type="text/javascript" data-category="external_media" data-src="/path/to/your/external-media/script.js"></script> <script type="text/plain" data-type="text/javascript" data-category="marketing">console.log("Inline scripts are also working!");</script> The data-attributes (data-type and data-category) are required to get recognized by PrivacyWire. the data-attributes are giving hints, how the script shall be loaded, if the data-category is within the cookie consents of the user. These scripts are loaded asynchronously after the user made the decision. If you want to give the users the possibility to change their consent, you can use the following Textformatter: [[privacywire-choose-cookies]] It's planned to add also other Textformatters to opt-out of specific cookie groups or delete the whole consent cookie. You can also add a custom link to output the banner again with a link / button with following class: <a href="#" class="privacywire-show-options">Show Cookie Options</a> <button class="privacywire-show-options">Show Cookie Options</button> I would love to hear your feedback ? CHANGELOG You can find the always up-to-date changelog file here.1 point
-
Is my 100th post I wanted to do something special. I edited a video, hope you like it Just for fun Edited: Now with subtitles1 point
-
We're finally launching a redesign of our website! Doesn't feel like it to us, but our previous design was already from 2013 ? https://ed-works.com/ We like to keep things simple, so the only third-party modules that we installed were Tracy debugger, Admin on steroids and Admin Theme Boss, which we tweaked a little bit to our taste. All in all, there's not much going on inside PW. Our main concern was to serve the frontend with responsive images with a close quality to the originals, and for this, it's important that PW allows us to use ImageMagick for resizing them. We also love to use PW's image tags to add classes to the images. In this case, we use them to display the images with three different sizes. We also had to change the templates to serve the projects to the homepage via Ajax. We hope you guys like our new baby ? Edit: I forgot to refer that we also changed our logo and tweaked our name to ED works.1 point
-
1 point
-
um - yes, those pages not counted in were hidden. So ... quick test ... 2.0.7 fixed the problem for me! @adrian your awesomeness is shining brightly! ? Thank you very much indeed.1 point
-
@HerTha - I did make some changed in 2.0.6 in regards to counting the number of protected pages, but forgot to properly handle unpublished / hidden pages. It should be fixed in the new version just committed.1 point
-
I just did an update from 2.05 to 2.06. When finished, I checked module config, which told me I currently have no protected pages at all. Truth is, however, there is actually 1 protected page. Also, this page (protection) still worked after the update. I checked on another site where I have multiple protected resources. On this site - after updating - module config showed me all protected pages, however the numeric count in the headline was given wrongly. Could there be a regression in determining the count of protected pages? I use PW >/= 3.0.123 on both sites.1 point
-
I don't see why you can't in Processwire, you have can your Business Logic as you would in any PHP Application, but only using Processwire API to handle the information you collect from the front-end, into it's Admin, or you can build your business logic in a Module and save to your Database. so It is possible very much. The Backend will extremely work in your favour as it has good API to easily have a backend view to see your transactions. Others will reply with their view, but it depends on your processwire knowledge and PHP skills. Sephiroth1 point
-
Good day, @Martijn Geerts! This module does not state PW3 support. Do you see any potential problems? If not, maybe update the description?1 point
-
1 point
-
@a-ok - this stuff has always frustrated me - it seems like it's only possible to add classed to an InputfieldWrapper when it's added to a form (which I do in the AdminActions module). I can't get the same code to work for this module. How about I add this: $inputfields = new InputfieldWrapper(); $margin = $this->wire('modules')->get("InputfieldMarkup"); $margin->value = '<div class="uk-margin-small-top"></div>'; $inputfields->add($margin); as a hack to get some space between the Add Row button and the Import/Export CSV section?1 point
-
Hi @LAPS, OK - I'll take a look at this tomorrow and implement a method for this. Cheers, Chris1 point
-
@LAPS Because it's plaintext, and ProcessWire needs to be able to parse log lines back into structured information (user, url, timestamp, message) for $log->getEntries() to work. Take a look at the source of lineToEntry: This method splits a log line on tabs and returns an associative array. Now if the "message" part of the line could include an arbitrary amount of tabs, the method couldn't really do that, because you wouldn't know how many parts the explode method would yield for that line. You could make the argument that it only needs to parse the first few array elements and join the rest with tabs again, but since the log may or may not contain the URL and the user, you don't know exactly how many array entries are bits of meta data, and which belong to the message. I'm not saying it's perfect design by the way (though I do think it's an elegant solution despite this edge-case), just trying to explain why I think it was build this way ? In this case I'd go with the approach I mentioned above, using a different delimiter and optionally changing it back to a tab in your output.1 point
-
Ok this works for me now: require_once wire('config')->paths->RestApi . "Router.php"; $this->addHookBefore('ProcessPageView::execute', function(HookEvent $event) { $url = wire('sanitizer')->url(wire('input')->url); // support / in endpoint url: $endpoint = str_replace("/", "\/", wire('modules')->RestApi->endpoint); $regex = '/^\/'.$endpoint.'\/?.*/m'; preg_match($regex, $url, $matches); $hasAccess = array( '178.192.77.1' ); if($matches) { if(!in_array($_SERVER['REMOTE_ADDR'], $hasAccess)){ wire('log')->save("sso-debug", "Access denied for ".$_SERVER['REMOTE_ADDR']); http_response_code(403); exit; } $event->replace = true; } }, [ 'priority' => 99 ]); I have added the priority option and set it to 99 so that it gets executed before your hook in RestApi Module. KR Orkun1 point
-
v0.0.2 Just added some setup instructions and checks on install/uninstall thx to a report of @thausmann1 point
-
Sorry, forgot to mention that @David Karich added support for options fields and slide ranges, so there is no need for manually doing joins like shown before ? How to create custom column types It is really easy to create custom column types that can retrieve any data from the PW database. See this commit for two simple examples: https://github.com/BernhardBaumrock/RockFinder2/commit/54476a24c78ae4d3b6d00f8adfb2c8cd9d764b9d If the fieldtype is of broader interest please consider making a PR. If you are the only one needing it add the type via hook. Adding a custom column type is as simple as this: $f->addColumns(['FieldOptionsValue:your_options_fieldname']);1 point
-
This sounds great, even though I don't use trello ? A short screencast would be great to get a quick impression ?1 point
-
That's right, currently the W3C does not validate. @gebeer also mentioned this with the possible solution to use "text/plain" instead of "optin". I'm planning to implement this solution, but as an optional addition to keep backwards compatibility for the users who already use the "optin" variant.1 point
-
Thank you for this module. It works great. I ran my webpage through W3C validation and it gave me these errors. Any suggestions on how to fix it? (Procache strips the quotes, but it's in the code). Thank you. Error: Bad value optin for attribute type on element script: Subtype missing. From line 1, column 30; to line 1, column 174 l lang=en><script type=optin data-type=text/javascript data-category=statistics async data-src="https://www.googletagmanager.com/gtag/js?id=Ufkjdkfj"></scri Error: Element script must not have attribute async unless attribute src is also specified or unless attribute type is specified with value module. From line 1, column 30; to line 1, column 174 l lang=en><script type=optin data-type=text/javascript data-category=statistics async data-src="https://www.googletagmanager.com/gtag/js?id=dfdfdfdf"></scri1 point
-
https://affinity.serif.com/en-gb/supporting-the-creative-community/ + A new 90-day free trial of the Mac and Windows versions of the whole Affinity suite + A 50% discount for those who would rather buy and keep the apps on Mac, Windows PC and iPad + A pledge to engage more than 100 freelance creatives for work, spending the equivalent of our annual commissioning budget in the next three months (more details of this will be announced soon).1 point
-
1 point
-
Hey Margie. Hope you can convince them to use PW. Sorry for the long contribution, but I hope I'm giving you a good argument. I've had a similar discussion a while back when I was "selling" PW to one of the main shopping centre chains here in Portugal (dolcevitatejo.pt is one of these sites, made in PW). They wanted an OS CMS and were leaning towards Wordpress, and I managed to convince them. My main argument was security. Check out this article: https://www.notanotherdotcom.com/blog/a-better-cms-part-1-security/ PW is inherently closed, with no plugins that conflict with one another or reveal publicly known vulnerabilities that can be exploited. The big three are regularly targeted just because they're popular. Also, check out this security log for PW (you'll have to register first): https://secuniaresearch.flexerasoftware.com/community/advisories/search/?search=processwire ... then search Wordpress, Drupal, Joomla, whatever you want. Processwire : 0 (zero) incidents, EVER! Wordpress : 17 incidents in 2017 Drupal : 4 incidents in 2017 Joomla : 4 incidents in 2017 These include: Cross-Site Scripting Vulnerabilities SQL Injection Vulnerabilities Security Bypass Vulnerabilities Local File Inclusion Vulnerabilities All of which are as scary as nature is in Australia. I've never heard of a PW site being compromised since I discovered it 3 years ago. One curiosity I like to point out is something Ryan said somewhere about password recovery on PW's login page. You don't have that installed by default and need to turn it on yourself, because with password recovery on, the CMS's security will only be as high as that of the admin's email.1 point
-
Quick update to the CreateUsersBatcher action. It now allows two options: 1) Define Username and email address (requires EmailNewUser to generate password). 2) Define additional user template fields (whichever ones you want). If you use this option and include the password, then you don't need the EmailNewUser module. You could even given all staff at a client's office the same temp password and let me know by phone (this way there is no security risk with emailing even a temporary password that will be changed) - it's your choice. Hopefully this screenshot will help to explain it better - note that the "New Users" textarea lists the fields from the user template and the order they need to be entered. In this example I have additional "first_name" and "last_name" fields, as well as the field added by the PasswordForceChange module which you can set to 1 to enforce this if you want.1 point