Leaderboard
Popular Content
Showing content with the highest reputation on 09/28/2017 in all areas
-
hi and welcome bergy, the topic you are talking about is not an easy one... you can do a forum search (see my signature link) on keywords like "staging", "production", "synch" etc. as always in the world of processwire you have free choice personally i develop locally (i would strongly recommend you take a look on laragon: https://laragon.org/ . i replaced my xampp setup over a year ago and it's really great and fast and you can even put it on a usb drive and have a full dev server with virtual hosts and ssl certificates, mailcatcher etc.). regarding the migrations / staging/dev topic: i develop locally and when i'm (almost) done i put it on the live server. from that time on i develop directly on the server with daily backups and via vscode remote ftp plugin. it has some drawbacks but also some advantages, like monchu already mentioned the quick-fix ability when you are abroad. if you really need a proper dev/live staging system migrations might be the way to go. for simple changes you can also create/edit/remove fields and settings directly in your module so if you push an update to your live system you would also get the same changes to your database. in my projects it was easier to have a simple setup. in the rare case i needed bigger changes i talked to my client that he should not make any changes on day X and i changed their password after copying the live site to something else. of course, this would not work if you had user-input like form submissions or the like. that said, it always depends on the situation. summed up i would say there are three levels of complexity and what i do (or would do) in those cases: simple website with very simple edits --> live edit via SSH / FTP more complex edits with no changes while developing --> backup, do changes locally, upload back to live server complex changes with live changes while developing --> custom migration scripts, migrations module3 points
-
3 points
-
I created an issue https://github.com/processwire/processwire-issues/issues/3883 points
-
3 points
-
Hmm. One thing I missed is that ProcessPageEdit allows super users to pick any template // ProcessPageEdit.module protected function getAllowedTemplates() { // ... foreach($allTemplates as $template) { // ... if($isSuperuser) { $templates[$template->id] = $template; } else if($template->noParents == -1) { // only one of these is allowed to exist if($template->getNumPages() > 0) continue; } else if($template->noParents) { // user can't change to a template that has been specified as no more instances allowed // except for superuser... we'll let them do it continue; // ... } // ... return $templates; } I dont think picking repeater templates should be allowed. if block shouldn't start with checking superuser, but it should come after. This order should stop repeater templates from showing. if($template->noParents == -1) { // only one of these is allowed to exist if($template->getNumPages() > 0) continue; } else if($template->noParents) { // user can't change to a template that has been specified as no more instances allowed // except for superuser... we'll let them do it continue; } elseif($isSuperuser) { $templates[$template->id] = $template; } Can someone confirm changing the order (ProcessPageEdit.module, at line 1973) fixes the issue?3 points
-
I've worked on the "CKEditor customizations" feature and finally decided not to restrict on CKEditor field only. It was refactored to a new submodule called "FieldOverrides". This way it is possible to set a bunch of field properties to override the defaults, in user, field or page contexts. Basically this is an extended version of the built-in field template overrides feature but for almost all field properties. Some examples of what is possible: As you can see the syntax has changed a lot and there are some new keys too. Syntax higlight works with InputfieldAceExtended and CodeMirror too, and in both cases the field auto-grows. CodeMirror uses files from the existing CKE plugins directory so the module's overall filesize hasn't grow much. @szabesz I don't have ListerPro so it's hard to check things. You say that If you turn ListerTweaks off it's still active?3 points
-
Yeah, I think this was in an earlier version of the regions spec and I just got used to using it (so always identifying the region you are modifying with the id attribute, and then adding pw-append / pw-prepend separately when needed). But I see now that it isn't mentioned in the most recent description of the spec. So maybe a bug/oversight that this functionality isn't working with pw-append="some-id". The main bug to watch out for though is this one: https://github.com/processwire/processwire-issues/issues/302 I really hope that it gets fixed sometime soon.2 points
-
Adding classes with pw-append / pw-prepend is working for me... <body id='html-body' class='bgimage' pw-append></body>2 points
-
Yeah, it's how I've been doing it until I met markup regions, and still have to do it so on some occasions. But building segments in HTML and seeing it magically get injected into your layout without touching anything is indisposable. As you're not working inside strings, syntax highlight and intellisense of IDEs are available too. Now having tasted the convenience, I dont want to go back to having template logic in my HTML (except ifs and loops). Markup regions feature is like a template engine but in a pure php. I refrain from tainting it, so to speak.2 points
-
Thanks @rafaoski - definitely lots of options along those lines and certainly something I have done in the past with other output strategies. I guess I just thought the Markup Regions should have this ability built-in given that it seems to be all about preventing the need for this kind of conditional logic. Not sure Markup Regions are going to become a regular thing for me - I usually prefer the simpler approach to things that has the most flexibility in the end, rather than relying on something "magic" that needs hacking at some point along the way. I am continuing with it for the moment, because it is also my first introduction to UiKit (working the new Regular site profile as a starting point), and it's a simple site, so shouldn't be too much of a problem.2 points
-
Hi pwired, this is exactly what Duplicator do, no more or less about deploying the site. It just help to avoid those repetitive tasks.2 points
-
@bernhard Thanks for is advice. Laragon is really great and I will use it from now on. (and thanks for the key words, maybe now I will find something specific) @flydev Thanks to you too , I think I will give Duplicator a try , instead of using ProcessExportProfile.2 points
-
Call it like \ProcessWire\wire()->config Or add <?php namespace ProcessWire; at the top of your file.2 points
-
I feel sorry again to make you guys waiting again, I got some works to finish asap, but theses tasks made me test Duplicator extensively and I think its ready for the release. It will not work for each hosting providers, but its a start. Finally, it will come with a new feature: AutoDeploy. With this feature, you will configure the FTP account and database informations, and the module will deploy automatically the web-site without having to run the installer manually.2 points
-
https://security.stackexchange.com/questions/127808/is-array-injection-a-vulnerability-and-what-is-the-proper-term-for-it2 points
-
################################################################################################# # START PROCESSWIRE HTACCESS DIRECTIVES # @version 2.3 ################################################################################################# ... # ----------------------------------------------------------------------------------------------- # Access Restrictions: Keep web users out of dirs that begin with a period # ----------------------------------------------------------------------------------------------- RewriteRule "(^|/)\." - [F] Eeek! - My PW 2.3 is showing lol! I have go to remove that from my Notepad++ cache2 points
-
@MindFull The htaccess file does allow access to the directory: # ----------------------------------------------------------------------------------------------- # 12. Access Restrictions: Keep web users out of dirs that begin with a period, # but let services like Lets Encrypt use the webroot authentication method. # ----------------------------------------------------------------------------------------------- RewriteRule "(^|/)\.(?!well-known)" - [F]2 points
-
2 points
-
Just a simple contact form including spam protection. Optional support for Twig (TemplateTwigReplace) as template engine. --- Please have a look at the readme on github! If you upgrade from version 0.0.9 and below, there are some extra steps to be taken. The Guides Installation Module Settings Spam Protection Usage Logging Upgrade Notes1 point
-
https://www.baumrock.com/portfolio/individuelles-crm-und-controlling-tool/ I'm happy to share my biggest and most interesting ProcessWire project so far with you It's a 100% custom office-management solution that helps my client to keep track of all their contacts, projects and finance/controlling stuff. Conception was done back in 2016 and the software is productive since begin of this year. My client is very happy with the result and so am I. Some technical insights: Everything is done inside the PW Admin. I'm using the Reno Theme with some custom colors. In the beginning I was not sure if I should stay with the pw admin or build my own admin-framework but now I'm VERY happy that I went with PW Almost all of my custom Process Pages use my RockDatatables module - there are still some limitations but without it, this project would not have been possible For the charts I used Google Charts and chartjs - both play well together with the datatables and make it possible to display filtered data instantly: also my handsontable module was created for this project to have a nice and quick option for matrix data inputs: Lister and ListerPro were no options as i needed much more flexibility regarding data presentation (like colorization, filtering and building sums of selected rows): invoices are highly customisable as well and easy to create. PDFs are created by php and mPDF by the way: all data is dummy data populated via my Module RockDummyData have a nice weekend everybody1 point
-
I discovered that when you rename a Repeater or RepeaterMatrix field, the template and fieldgroup used for the Repeater items keep the old name. So I wrote a little function for renaming a Repeater field including the associated template and fieldgroup. To be clear, you do not need to use this function to rename a Repeater field in normal circumstances. The Repeater template is a system template so it's not something you see normally, and as for the fieldgroup... what on earth is a fieldgroup, right? So this is just for perfectionists. Or if you are doing something like checking the template name in some hook and you don't want to have to deal with the old field name. /** * Rename a Repeater / RepeaterMatrix field, including template and fieldgroup * @param string $old_name The existing name of the Repeater field * @param string $new_name The new name for the Repeater field */ function renameRepeaterField($old_name = '', $new_name = '') { // Both arguments are required if(!$old_name || !$new_name) { wire('log')->error('renameRepeaterField(): Both $old_name and $new_name arguments are required.'); return; } // Rename repeater field $f = wire('fields')->get($old_name); if(!$f) { wire('log')->error("renameRepeaterField(): Field '$old_name' not found."); return; }; if(!$f->type instanceof FieldtypeRepeater) { wire('log')->error("renameRepeaterField(): Field '$old_name' is not an instance of FieldtypeRepeater."); return; } $f->name = $new_name; $label = str_replace('_', ' ', ucfirst($new_name)); $f->label = $label; $f->save(); // Rename template $t = wire('templates')->get('repeater_' . $old_name); $t->flags = Template::flagSystemOverride; $t->flags = 0; $t->save(); $t->name = 'repeater_' . $new_name; $t->flags = 8; $t->save(); // Rename fieldgroup $fg = wire('fieldgroups')->get('repeater_' . $old_name); $fg->name = 'repeater_' . $new_name; $fg->save(); } // Use the function in a one-off operation like this renameRepeaterField('sucky_old_name', 'shiny_new_name'); The function derives a label for the field by replacing underscores with spaces and capitalising the first letter of the field name. If you want a different label you can just edit the field in admin afterwards.1 point
-
Playing around with the UIKit theme this morning and tweaking it. It's called UIKit Classic and it's a nod to the Classic theme. For me the Classic theme always sticks in my mind as being most definitively Processwire-ey because It was my fist intro to PW I thought the colours were quite unique and like the mix of blue, pink and green. They're very distinctive and I'd hate for PW to look like just another WP install. In a crowded CMS marketplace I think it's good to differentiate visually. The two screengrabs are just the same screen. A before and an after. I put this together using the Chrome the web inspect tool so there's no fancy mixins or LESS etc. Actually there's not even any CSS now that I've refreshed the page. I do think there needs to be a detailed comprehensive through tutorial for people wishing to make their own themes. Probably 85% here don't need it and understand the directory structure and how it's all compiled but equally I think there's another 15% here with the design skills but not the tech chops to get this done. If we want designers to design themes then we need the process with screengrabs, list of software (I have CodeKit, Dreamweaver, Sublime etc). Anywho - just my 2€ worth The before shot below...1 point
-
I have puzzled over this too, but I think the confusion comes from a non-standard use of the word "absolute" in relation to the URL. So ProcessPageEditLink never inserts an absolute URL in that it never includes the protocol or domain. But I think the absolute option means absolute relative to the site root. So the link URL starts with '/' as opposed to the two relative options which can give a link URL like '../some-page/'. The current behaviour is a good thing, because otherwise all links would break when the root domain changes (e.g. going from dev to live environment). But it would help if the meaning of the absolute option was clarified.1 point
-
Hi everyone, I thought I'd experiment with markup regions on a small project, but I've come up against a stumbling block pretty quickly. I am trying to use the ability to add a class to an existing element - in this case I want to add a "bgimage" class to the <body> on the homepage. The problem is that by defining: <body id='html-body' class='bgimage'></body> in my home.php file, this replaces everything from the body defined in _main.php which an empty <body></body> which I guess is expected, but not very helpful if all you want to do is add a class to an existing element without changing its content. Is there anyone out there who has used these enough to know if I am missing an option, or whether this just isn't possible? Thanks!1 point
-
https://processwire.com/blog/posts/processwire-3.0.62-and-more-on-markup-regions/#actions-for-populating-regions1 point
-
From the core: * Modifying attributes on an existing element * * <div id='main' class='bar' pw-prepend><p>This prepends #main and adds "bar" class to main</p></div> * <div id='main' class='foo' pw-append><p>This appends #main and adds a "foo" class to #main</p></div> * <div id='main' title='hello' pw-append>Appends #main with this text + adds title attribute to #main</div> * <div id='main' class='-baz' pw-append>Appends #main with this text + removes class “baz” from #main</div> * -class feature looks interesting too1 point
-
@adrian Maybe such a simple way: <body id='html-body' class='<?=$page->name == 'home' ? 'bgimage' : 'custom-class';?>'> // OR <body id='html-body' class='<?=$page->name;?>'>1 point
-
Unfortunately append / prepend operations do not modify region attributes. Only replace does. I'd love to have that feature too1 point
-
Whilst we're on the topic of processors, I've switched over to Stylus completely. The only time I use Sass and Less is when a framework requires it. I've becomed so accustomed to the way stylus works, that if you asked me to type out some Sass, Less, or CSS, you'd find missing colons everywhere.1 point
-
This one seems to work for me. $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->hasField == 'page_list') { $event->return = $event->object->hasPage->children; } }); Edit: Nope. ->hasPage gives the repeater item page (not exactly, keep reading), ->arguments('page') gives the page being edited. $this->addHookAfter('InputfieldPage::getSelectablePages', function (HookEvent $e) { if ($e->object->hasField->name != 'testReference') return; $e->return = $e->arguments('page')->children; }); Weird thing is that InputfieldPage::getSelectablePages is called twice for every new repeater item. On the first call, hasPage and arguments('page') are identical, but on the second call, hasPage is the repeater item, arguments('page') is the page being edited. So using the argument seems to be the better option.1 point
-
I've now merged FlorianA's patch into the allow-blanks branch. Please test and let me know if it works for you.1 point
-
1 point
-
Hi, I had the same situation as the OP described: URL sent by email to go to a specific page after login. I solved it with 2 small hooks that I added to a module. You could also add them to your admin.php or ready.php My URL looks like .../?member=1222 where 1222 is the id of a user 1. hook adds a session variable before Login $this->addHookBefore('ProcessLogin::execute', $this, 'setRedirectId'); public function setRedirectId(HookEvent $event) { if($this->input->get('member')) { $this->session->set('goToMember', $this->sanitizer->int($this->input->get('member')); } } 2. hook has the redirect logic and removes the session variable $this->addHookAfter('Session::login', $this, 'loginRedirects'); public function loginRedirects(HookEvent $event) { if($this->user->hasRole('certificationadmin') && $this->session->get('goToMember')) { $member = $this->pages->get($this->session->get('goToMember')); if($member && $member->id) { $this->session->remove('goToMember'); $this->session->redirect($member->statusPageUrl); // statusPageUrl is a custom property for users that I added via another hook } } }1 point
-
You're probably right. It won't hurt to add the feature and users can make up their own mind what they find easiest to use. The $page argument for that method actually is the page being edited.1 point
-
Both. A free (and decoupled from the back) frontend module and a Pro backend.1 point
-
Right, the module doesn't sync changes. It deploy only a full copy of the current website. If I remember correctly, @LostKobrakai made a module which "do some part of that". Let me check the forum and edit this post. @Bergy there is the module (not a simple one!) :1 point
-
@tpr, I guess the question is "Why use ini format in the AOS config when you can just as easily use a hook?" The hook equivalent of the first two items in your screenshot is: $wire->addHookBefore('Field::getInputfield', function(HookEvent $event) { $field = $event->object; $page = $event->arguments(0); // Add word counter for the "title" field for non-superusers if($field->name == 'title' && !$this->user->isSuperuser()) { $field->showCount = 2; } // Set year range for a date field, if template is "news" if($field->name == 'date_created' && $page->template == 'news') { $field->yearRange = '-3:+3'; } }); Comparing the hook option to the AOS config option my thoughts are: Once the hook function is in place and the $field and $page variables defined, the code for each field override is not significantly longer. It's plain PHP, so we're already familiar with the format. It's easier to read the conditionals. It's file-based. It's easy to dump/log within the hook. It saves any additional complexity being needed in AOS.1 point
-
1 point
-
I found the solution, but in an ugly way. You may find the code in github.1 point
-
Actually, I intentionally do not use any role based features of AOS and the reason for this is that I do not want my admin setups to depend on the module. All should still be usable and "the same" when AOS is disabled/uninstalled. For the same reason, I do not use it for loading "admin CSS and JS" either, for example, but there are other features too I do not use just because of this.1 point
-
Okay, big flip-flop ahead... ...thinking some more, maybe this isn't such a good thing to add into AOS. It introduces another "language" to learn for doing something that is already possible with hooks. And @abdus has recently posted a tutorial for how to add other field settings into the template overrides that allows the admin GUI to be used. And I can see these ini-style settings being difficult to debug. Don't know, I'm really in two minds about it. Be good to hear what others think.1 point
-
I might be wrong, but my understanding is that the ACF/Purifier settings for a CKEditor field only affect content that goes through the CKEditor inputfield and is then saved to the database. A textformatter on the other hand never saves its changes to the database and it isn't involved with the inputfield - it just makes changes on-the-fly as the content is output to the front-end. Another thought: if you have multiple textformatters applied, check to see if the order they are applied makes a difference.1 point
-
Child pages can be good when: You think it will be helpful for the relationship to be shown in the URL to the pages: /manufacturers/dodge/challenger/ Although it is also possible to 'fake' a page URL using URL segments. The child will exclusively belong to that parent (it doesn't belong to multiple categories). If either of these is not the case then you are better off with Page Reference fields. So in your example, you have fish in an aquarium. If by "fish" you mean "species of fish" then you wouldn't want to have these as child pages of an aquarium, because multiple aquariums might have the same species of fish and you don't want to duplicate the species pages.1 point
-
I also would recommend to develop locally. I would go crazy if I had to wait a few seconds after every change. My deploying workflow is currently: Track all files inside site/templates with Git and push/pull them on the remote server via SSH. Sync all files inside site/modules and site/assets/files via Sublime SFTP or Transmit. Sync the database with Sequel Pro. But maybe some time I will try something fancy like a automated shell script.1 point
-
While I understand that fewer inputs mean fewer possible possibilities to invade the system, a non-maintained module pimped by beginners can easily be less secure than something in the core taken good care of. Just by leaving the module out of the core does not help saving ProcessWire's reputation when the modified version of this module leads to a site being hacked. I think it will be quite to the contrary should it ever happen. In my humble opinion this new module (LoginRegister) should be in the core and just like its cousin ProcessForgotPassword, they should be "uninstalled" by default. A good guide on how to implement and/or make proper changes to the module via hooks should be provided so that anyone can do it without compromising security. I vote for teaching people instead of giving them a tool with the label on it: "use at your own risk".1 point
-
Created an issue and pull request with a fix https://github.com/processwire/processwire/pull/91 https://github.com/processwire/processwire-issues/issues/3851 point
-
For reference here's a simple mutation field implementation <?php wire()->addHookAfter('ProcessGraphQL::getMutation', function ($event) { $query = $event->return; $query->addField('log', [ // define return object under type 'type' => new ObjectType([ 'name' => 'Log', 'fields' => [ 'result' => [ 'type' => new StringType() ] ] ]), // available arguments for the query 'args' => [ 'text' => new StringType() ], // what to do with the request 'resolve' => function ($value, $args) { // process given input // return object outline should be same as 'type' return [ 'result' => 'done. ' . $args['text'] ]; } ]); }); When you refresh GraphiQL console, you get your new field!1 point
-
Hi Sephiroth, I'm not a professional module developer, but a person from your target group So my suggestions are from the "beginner's point of view", and are as follow: You probably want to clean it up by fixing typos, missing spaces, extra spaces and similar errors. When referring to code, you might want to copy stuff instead of typing, so ProcessPageImageEditSelect vs. ProcessPageEditImageSelect is spelled right, out of the box. You might also want to list the following resources: v3.x API docs: https://processwire.com/api/ref/#modules Blog post: New module configuration, https://processwire.com/blog/posts/new-module-configuration-options/ Blog post: Module configuration is now even simpler, https://processwire.com/blog/posts/processwire-core-updates-pull-requests-and-more-2.5.25/#module-configuration-is-now-even-simpler Blog post: Config arrays..., Expanded module configuration..., Module configuration methods..., https://processwire.com/blog/posts/processwire-core-updates-2.5.27/#expanded-module-configuration-options-within-module-file What really bugs me is the fact that Ryan has already documented so much in the blog, but it is really hard to find what one is looking for. It often occurs to me that I know I've read something in the blog, I just do know know were... We have tons of useful info buried in the blog. Nice incentive anyway, keep it up!1 point
-
The main reason it's not there is just because $input is another layer on top of $_POST (or $_GET or $_COOKIE) and I wanted to limit the overhead of it as much as possible, at least until we needed it. Didn't want to enable the possibility of someone posting endless multidimensional arrays from a security standpoint. But ultimately if the need was there, I would add it. And now that its come up, we might as well add it. Probably what I will do is just limit the recursion to 2 or 3 levels to keep it safe. I don't see any potential issues with adding it. If you've had the need for it, then I'm sure others will to. If you want to submit a pull request, I'll bring it into the core. Otherwise, I'll plan to add and commit an update to the core soon. Thanks, Ryan1 point