Leaderboard
Popular Content
Showing content with the highest reputation on 01/01/2018 in all areas
-
Welcome to the forum @FireDaemon Did you read this page? https://processwire.com/docs/security/admin/ Yes. In fact, during install process you are asked if you want to rename it. But you can do it later also. You could try this module. Yes That's already in core: see https://processwire.com/docs/security/admin/#preventing-dictionary-attacks In a test-environment, you can further add stuff like .htaccess allow/deny rules, i.e. only allow access from certain IPs.7 points
-
sigh... I must say some folks are quite good at marketing. I don't blame them. It's a free market. There's nothing I saw in this article that wouldn't be possible with PW (and without any extra modules either), more or less out of the box. What Magnolia calls fragments is apparently nothing more than PW's fields. But I have to hand it to them, they seem to know how to translate all that tech lingo to marketing speak.2 points
-
Hm, if you view a WordPress frontend with populated data and copy/paste the source you have more or less an HTML theme? Apart from that, there will still be manual work.2 points
-
This one I can't duplicate yet. I'm also running the latest Chrome, except in OS X rather than Windows. I also tested in Firefox and was not able to duplicate it there either. Maybe there is a platform difference I need to look closer at. But you mentioned that after saving the page, everything worked. I'm guessing a JS error is happening somewhere in the process. Try enabling debug mode $config->debug=true; in /site/config.php, and watch your Chrome JS console for any JS errors that might appear in the process, whether from the CKEditor field, or possibly another field in the page editor at the same time. Edit—see further down for my response to the JS error you found. Paste doesn't work in Firefox for me either. As far as I can tell, this CKE plugin doesn't support the paste action in Firefox. It looks like Firefox uses a different type of raw data when it comes to paste that might require Firefox specific code. I haven't looked very far yet though. Okay I think this may possibly be what the issue is with the first issue. Try registering under some name other than "mystyles", which is just what we used for example purposes, but better to choose your own name. It looks like it might be colliding with some built-in example and creating the JS error. The croppable image field is a 3rd party plugin, so I'm not sure to what extent it might support this feature. But if it extends FieldtypeImage, then chances are that it will work for uploads as well. I'm not sure I understand what you mean by "fetches all images"? This feature only uploads images. It sounds like maybe you are talking about the image insert dialog, where you can select from images that are already uploaded? If that's the case, go to Modules > Configure > ProcessPageEditImageSelect. In the settings, you can specify the images fields that it should ignore. You'll want to add your croppable image field there (if you don't want it available for CKE). This new CKE upload feature also honors the setting you specify there. I can't duplicate this one either, but since we know where it's occurring I can add some code to avoid it. What we're seeing there is a $page that has no template assigned, somehow. I'm guessing another module is triggering with a NullPage, which is why template is empty. I'll add a detection for that and commit it in a few mins. I'm pretty sure that'll fix it.2 points
-
Canvas has both kinds: Country AND Western! ahem... LESS + SASS2 points
-
2 points
-
Edit: Because of the great response to this topic I wrote a guest blogpost: https://processwire.com/blog/posts/building-custom-admin-pages-with-process-modules/ One of the hidden treasures of processwire seems to be the creation of custom admin pages. Technically speaking those pages are ProcessModules - but i guess that's the reason why so many people out there seem to be afraid of building them... it sounds so hard! You've never created a module for ProcessWire? You have never created a plugin for any other CMS? You have no clue about OOP with all its classes, methods and properties? No problem! I'll show you how simple you can start: <?php class CustomAdminPage extends Process { public static function getModuleinfo() { return [ 'title' => 'Custom Admin Page Example', 'summary' => 'Minimalistic ProcessModule to show that nobody has to be afraid of building custom admin pages.', 'href' => 'https://processwire.com/talk/topic/17709-how-to-create-custom-admin-pages-aka-processmodules-yes-its-that-simple/', 'author' => 'Bernhard Baumrock, baumrock.com', 'version' => 1, // page that you want created to execute this module 'page' => [ 'name' => 'customadmin', // your page will be online at /youradmin/setup/customadmin/ 'parent' => 'setup', 'title' => 'Custom Admin Page Example' ], ]; } public function ___execute() { return 'This is the most simple Admin-Page you have ever seen :)'; } } Now save this file as CustomAdminPage.module and place it in your /site/modules folder. After a refresh it will show your module in the modules manager of your site where you can install it: After installation you already have your first very own admin page! Congratulations! Was not too hard, was it? It's as simple as that! Now lets add some more custom HTML. And to show you another nice feature we will add this code to a separate method called executeDemo(). And because everything is so simple we will also add some javascript to this page public function ___executeDemo() { $out = ''; $out .= '<h1>H1 has some special css styling in the admin, thats why it seems to have no effect</h1>'; $out .= '<h2>H2 looks different ;)</h2>'; $out .= '<h3>...and so does H3</h3>'; $out .= '<button onclick="myFunction()">Click me</button>'; $out .= '<script>function myFunction() { alert("this is a demo javascript"); }</script>'; return $out; return ''; } Now thanks to ProcessWire-magic your page will already have its own URL: Just append /demo to your url and see what you get: And of course don't forget to click the button Ok, now that code looks a bit hacky, right? Inputfields and especially InputfieldMarkup for the win! We add another method with some advanced code. To use inputfields we need a form that holds all those inputfields and that makes it possible to handle user input lateron. See somas great tutorial about forms here for a quickstart and more details: public function ___executeAdvanced() { $out = '<h2>A more complex Example</h2>'; $form = wire()->modules->get('InputfieldForm'); $field = wire()->modules->get('InputfieldMarkup'); $field->label = 'Markup Test 1'; $field->value = '<h1>h1</h1><h2>h2</h2><h3>h3</h3><h4>h4</h4>'; $form->add($field); $out .= $form->render(); return $out; } Ok, it get's boring Let's do something more fun and add a chart in a second field and change the fields to 50% screen width (I'm sure you know that already from the GUI template editor)! public function ___executeAdvanced() { $out = '<h2>A more complex Example</h2>'; $form = wire()->modules->get('InputfieldForm'); $field = wire()->modules->get('InputfieldMarkup'); $field->label = 'Markup Test 1'; $field->value = '<h1>h1</h1><h2>h2</h2><h3>h3</h3><h4>h4</h4>'; $field->columnWidth = 50; $form->add($field); $field = wire()->modules->get('InputfieldMarkup'); $field->label = 'Chart Sample'; $field->value = '$chart'; //$field->notes = 'Example code taken from here: http://www.chartjs.org/docs/latest/getting-started/usage.html'; $field->columnWidth = 50; $form->add($field); $out .= $form->render(); return $out; } OK, we are almost there... we only need to add the chart library! To keep everything clean we will put the code for the chart in another method. We will make that method PRIVATE to add some security. Our new Method: private function renderChart() { // prepare chart code wire()->config->scripts->add('https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.3/Chart.min.js'); ob_start(); ?> <canvas id="myChart"></canvas> <script> var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, { type: 'bar', data: { labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"], datasets: [{ label: '# of Votes', data: [12, 19, 3, 5, 2, 3], backgroundColor: [ 'rgba(255, 99, 132, 0.2)', 'rgba(54, 162, 235, 0.2)', 'rgba(255, 206, 86, 0.2)', 'rgba(75, 192, 192, 0.2)', 'rgba(153, 102, 255, 0.2)', 'rgba(255, 159, 64, 0.2)' ], borderColor: [ 'rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)' ], borderWidth: 1 }] }, options: { scales: { yAxes: [{ ticks: { beginAtZero:true } }] } } }); </script> <?php return ob_get_clean(); } Now we just need to call $this->renderChart() in the right place! Here is the complete Module: <?php class CustomAdminPage extends Process { public static function getModuleinfo() { return [ 'title' => 'Custom Admin Page Example', 'summary' => 'Minimalistic ProcessModule to show that nobody has to be afraid of building custom admin pages.', 'href' => 'https://processwire.com/talk/topic/17709-how-to-create-custom-admin-pages-aka-processmodules-yes-its-that-simple/', 'author' => 'Bernhard Baumrock, baumrock.com', 'version' => 1, // page that you want created to execute this module 'page' => [ 'name' => 'customadmin', // your page will be online at /youradmin/setup/customadmin/ 'parent' => 'setup', 'title' => 'Custom Admin Page Example' ], ]; } public function ___execute() { return 'This is the most simple Admin-Page you have ever seen :)'; } public function ___executeDemo() { $out = ''; $out .= '<h1>H1 has some special css styling in the admin, thats why it seems to have no effect</h1>'; $out .= '<h2>H2 looks different ;)</h2>'; $out .= '<h3>...and so does H3</h3>'; $out .= '<button onclick="myFunction()">Click me</button>'; $out .= '<script>function myFunction() { alert("this is a demo javascript"); }</script>'; return $out; return ''; } public function ___executeAdvanced() { $out = '<h2>A more complex Example</h2>'; $form = wire()->modules->get('InputfieldForm'); $field = wire()->modules->get('InputfieldMarkup'); $field->label = 'Markup Test 1'; $field->value = '<h1>h1</h1><h2>h2</h2><h3>h3</h3><h4>h4</h4>'; $field->columnWidth = 50; $form->add($field); $field = wire()->modules->get('InputfieldMarkup'); $field->label = 'Chart Sample'; $field->value = $this->renderChart(); $field->notes = 'Example code taken from here: http://www.chartjs.org/docs/latest/getting-started/usage.html'; $field->columnWidth = 50; $form->add($field); $out .= $form->render(); return $out; } private function renderChart() { // prepare chart code wire()->config->scripts->add('https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.3/Chart.min.js'); ob_start(); ?> <canvas id="myChart"></canvas> <script> var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, { type: 'bar', data: { labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"], datasets: [{ label: '# of Votes', data: [12, 19, 3, 5, 2, 3], backgroundColor: [ 'rgba(255, 99, 132, 0.2)', 'rgba(54, 162, 235, 0.2)', 'rgba(255, 206, 86, 0.2)', 'rgba(75, 192, 192, 0.2)', 'rgba(153, 102, 255, 0.2)', 'rgba(255, 159, 64, 0.2)' ], borderColor: [ 'rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)' ], borderWidth: 1 }] }, options: { scales: { yAxes: [{ ticks: { beginAtZero:true } }] } } }); </script> <?php return ob_get_clean(); } } I hope you enjoyed reading this and it will open up many new possibilities for you! Updates: permissions: https://processwire.com/talk/topic/17709-how-to-create-custom-admin-pages-aka-processmodules-yes-its-that-simple/?do=findComment&comment=174746 tutorial on file uploads: https://processwire.com/talk/topic/17709-how-to-create-custom-admin-pages-aka-processmodules-yes-its-that-simple/?do=findComment&comment=185261 snippet how to use NavJSON: https://processwire.com/talk/topic/17709-how-to-create-custom-admin-pages-aka-processmodules-yes-its-that-simple/?do=findComment&comment=2164121 point
-
I've been working on an experimental module set that adds 2-factor authentication to ProcessWire with the help of Steve Gibson's PPP one-time-pad system. This is split into two modules; a CryptoPPP library that implements the otp system and a 2-factor authentication module that uses it to add 2-factor authentication to ProcessWire. The 2-factor module adds an additional "Login Token" field to the login page into which the authenticating user will need to enter the next unused token from their one-time-pad. Pages from their pad can either be printed out in advance in a credit-card sized format (with codes being crossed out as they are used as shown here) or the required token can be sent to their registered email address so they don't need to print anything out. This second option requires a good email address be present in the user's account in order for them to be sent the token. Email Delivery To set up email delivery go to the 2-factor module's config page and choose "token delivery via email" and save the settings. Next, make sure that every user who will use the system has a valid email address set up in their account. Upon the first failed user login attempt, the required token will be emailed to the user’s email address and they should then be able to log in. Printing Pages From The Pad If you prefer to print the tokens in a handy credit-card sized format then… Go to your profile screen Expand the “PPP Initialisation Vector” field Hit the “Show Token Cards” button to open a new browser window with the next 3 useful cards Use your browser’s print option to print these out Trim them to size and store ...but make sure you print these out before you enable 2-factor authentication on your account. If you cross out your used codes, you will always know which code to use when logging back in -- and if you forget, the first login attempt will fail and the token field will then prompt you with the location of the correct code to use. Why would I ever want to use 2-factor authentication? If your site is only for you or for people you know use good passwords then you probably never will need a 2-factor authentication system. But it has been shown that many users use passwords that are, well, rubbish not very good and having a second factor can be useful in mitigating poor passwords. As the second factor in this system comes out of a one-time-pad system (meaning it will not be reused) then having the user's password leaked or guessed should not compromise their account nor will having someone spy out the token they are using to log-in as tokens are not re-used (well, not for a very long time.) Known Problems You need to hit the save button after you install the 2-factor module to get it to remember the initial settings. (I guess I'm not setting the defaults correctly at present but pressing the button will allow you to move forward for now) Uninstall of the 2-factor module leads to a lot of warnings. Attachments1 point
-
There is also somewhere a conversion module from @Nico Knoll for wp to pw, and there also must be an in depth post from ryan explaining the conversion from existing wp sites, (with data), to pw.1 point
-
Sidenote: Even if you come across a template that is not behaving as responsive as you think it should, you can easily change it... case in point: I would expect the phone view to put the article (main content) first, not the sidebar. http://themes.semicolonweb.com/html/canvas/blog-single-split-both-sidebar.html1 point
-
This is what I do. I find it easier to view the source (inspector) and rebuild from there, rather than work with the raw files from WP.1 point
-
In addition to what @Macrura said, @pwuser1 check those videos :1 point
-
If you want to learn PHP framework, you can see the list here, PHP Framework list . You can develop any web application type using PHP framework. However, you have to develop your user interface from scratch, even for the Administration part. Wordpress or Joomla, is a CMS application. Drupal started as CMS, but at some point, they changed the direction not just as CMS. PW is unique though. It is not purely PHP framework nor CMS apps. PW gives you the flexibility to some extent to develop non-CMS apps. In PW you get the Admin page as a starting point. From there it is up to you wants to build Website or another type web apps. But you can't change the existing Admin page model.1 point
-
@Macrura Agree 100%. I view Canvas as an extended Bootstrap toolkit - use the bits I want, disregard the rest and add my own custom code without having to reinvent the wheel when I need a particular feature. It in no way limits my options for original design while saving me time & money on FE development. Anyway, works for me and each to their own1 point
-
$wire->addHookAfter('Inputfield::render', function (HookEvent $event) { $field = $event->object; if (substr($field->name, 0, 13) === 'repeater_item') { $page = $event->arguments(0); $id = str_replace('repeater_item_', '', $field->name); $submitID = "submitRepeaterItem_$id"; $form = wire('modules')->get("InputfieldForm"); $submit = wire('modules')->get("InputfieldButton"); $submit->attr("value", "Edit this repeater item as page"); $submit->attr('data-href', wire('config')->urls->admin . "page/edit/?id=$id"); $submit->addClass('pw-panel'); $submit->addClass('uk-margin-left'); $submit->attr("id+name", $submitID); $form->append($submit); $myForm = $form->render(); $event->return .= $myForm; } }); I've got this in ready.php... seems to work.1 point
-
Most themes come in the plain HTML version, so not much use these days to convert a WP theme.. But, if you absolutely must use a wordpress theme, the easiest way is to copy the HTML that WP outputs and analyze/use that; looking at the source WP theme code is typically close to useless;1 point
-
@pwired think I'll buy it to give it a test, it's cheap enough for a punt, maybe I could actually use it on my own portfolio site to see what can be achieved. At the moment, I spent so much time customising stuff that I'm starting to think this is a waste of time (spending hours upon hours working out how to build/compile with uikit 3 and actually building nothing) when I could churn out sites way quicker and cheaper. Cheaper is the key words here because round here, no-one wants to spend on (low functionality) websites, they go straight to wix and 'You want a website? Why not do it yourself?' *sigh* There seems to be zero 'romance' in the custom design, bespoke, [insert nice sounding keywords here] websites, it's purely about price. This is a bitter pill for me personally as I always considered high quality workmanship more important than price. Some crappy things have happened over Christmas though so maybe I'm just on a downer! Here's to a more positive 20181 point
-
For those interested in what's possible with the Canvas template suite & PW, below are a few examples. PS: all recommendations in the Showcase posts actioned and I'm NOT a themeforest affiliate. These HTML templates simply make my front-end-dev work easier. https://flywithmehorses.com.au/ - also in the PW Showcase forum at https://www.goldcoastholistichealth.com.au/ and another biz owned by the same client, https://www.goldcoastosteopathy.com.au/ - this one uses @kongondo 's blog module https://beautifulhumanway.com/ - also in the PW Showcase forum at1 point
-
I tried this with an (unlimited) images field just to see how it would work. <?php namespace ProcessWire; ?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php echo $page->title; ?></title> <link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates?>styles/main.css" /> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous"> </head> <body> <div class="row"> <?php foreach($page->images as $image): ?> <div class="col-4"> <edit images> <img src="<?= $image->url; ?>" /> </edit> </div> <?php endforeach; ?> </div> </body> </html> (used Option C) I made a very rough video of it: You could just do what @flydev suggested with an overlay icon. They click on that, then can change images. It's not as user friendly as being able to just change one image at a time though, clicking on any of them brings up the entire field (as expected). Still pretty cool though! (this isn't a live site, nor do I use '/login/' on any live ones)1 point
-
This sounds familiar: https://www.magnolia-cms.com/blogs/christopher-zimmermann/detail~&hybrid-headless-cms~.html.1 point
-
Hi @adrianmak You can achieve this by using hooks and my ReCaptcha module. First install the MarkupGoogleReCaptcha module then in file ready.php, write the following code : /* * replace the LAST occurence of $search by $replace in $subject */ function str_lreplace($search, $replace, $subject) { return preg_replace('~(.*)' . preg_quote($search, '~') . '~', '$1' . $replace, $subject, 1); } /* * replace the FIRST occurence of $search by $replace in $subject */ function str_freplace($search, $replace, $subject) { $from = '/'.preg_quote($search, '/').'/'; return preg_replace($from, $replace, $subject, 1); } $captchamod = wire('modules')->get("MarkupGoogleRecaptcha"); wire()->addHookProperty('Page::captcha', function($event) use ($captchamod) { $event->return = $captchamod; }); wire()->addHookAfter('Page::render', function($event) { $template = $event->object->template; $page = $event->object; if ($template == 'admin' && !wire('user')->isLoggedin()) { $captchaScript = $page->captcha->getScript() . '</body>'; $captchaHtml = $page->captcha->render() . '</form>'; $event->return = str_freplace('</form>', $captchaHtml, $event->return); $event->return = str_lreplace('</body>', $captchaScript, $event->return); } }); wire()->addHookAfter('Session::authenticate', function($event) { $page = wire('page'); $template = $page->template; if ($template == 'admin') { if ($page->captcha->verifyResponse() == false) { wire('session')->logout(); wire('session')->redirect(wire('config')->urls->admin); } } });1 point
-
1 point