Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/09/2017 in all areas

  1. Password Generator Adds a password generator to InputfieldPassword. Usage Install the Password Generator module. Now any InputfieldPassword has a password generation feature. The settings for the generator are taken automatically from the settings* of the password field. *Settings not supported by the generator: Complexify: but generated passwords should still satisfy complexify settings in the recommended range. Banned words: but the generated passwords are random strings so actual words are unlikely to occur. https://modules.processwire.com/modules/password-generator/ https://github.com/Toutouwai/PasswordGenerator
    4 points
  2. And thank you guys for all the feedback - seriously, it makes it much easier - often the decisions on the best way to do something can take longer than the coding
    4 points
  3. I just made a textformatter module that allows you to insert dummy content (lorem ipsum style) in text fields via shortcodes. Usage is simple - just type for example [dc3] into a textarea with this textformatter applied (plain textarea or CKEditor) and it will be replaced at runtime by 3 paragraphs of dummy content. It can also be used to populate text fields (for headings etc) using e.g. [dc4w]. This will produce 4 words (rather than paragraphs) at runtime. The actual content comes from an included 'dummytext.txt' file containing 50 paragraphs of 'Lorem ipsum' from lipsum.com. The 50 paragraphs is arbitrary - it could be 10 or 100 or anything in between, and the contents of that file can be changed for your own filler text if you wish. The slightly clever bit is that for any given page, the same content will be returned for the same tag, but the more paragraphs available in 'dummytext.txt', the less likely it is that two pages will get the same content (very roughly speaking - it's actually based on the page ID) so content selection is determinate rather than random, even though only the tags are saved to the db. Update Tags now work like this - [dc3] - Show 3 paragraphs ([dc:3], [dc3p] & [dc:3p] all do the same). [dc3-6] - Show 3 to 6 paragraphs randomly per page load ([dc:3-6], [dc3-6p] & [dc:3-6p] all do the same). [dc3w] - Show 3 words ([dc:3w] does the same). [dc3-6w] - Show 3 to 6 words randomly per page load ([dc:3-6w] does the same). <End update on tags.> If you think it might be useful, you can download it from GitHub and give it a try.
    3 points
  4. @abdus Handling modules is realm of the superuser as one can potentially break lots of things there. If you need non-superusers to edit module settings I'd create a custom process module, which does handle changing the module config in a more secure way with validation of changes and alike.
    3 points
  5. Simply create a new role, and assign only the permissions you want to that role. If you have existing super-users, change their role to that new "not-so-super-user" role
    3 points
  6. Both would be probably be fine. I prefer everything to be in site/templates so I know I can copy that whole directory to another site if needed to get the same functionality. If snippets are uploaded to site/assets, I then have to change out of my working directory and hunt down specific folders in site/assets. I prefer to work in one primary directory (site/templates) without switching around if necessary. It saves time. The way I see it is: Does the module have to generate files? if yes, store the files in site/assets. If no, store the files in site/templates somewhere. Sounds good Thanks for all you do!
    3 points
  7. just add the "pw-panel" class to your link. if you want it to reload on every open add "pw-panel-reload". see here for details: https://github.com/processwire/processwire/blob/master/wire/modules/Jquery/JqueryUI/panel.js
    3 points
  8. Ok, I am going to provide two options (/site/assets/TracyDebugger/snippets/ and /site/templates/TracyDebugger/snippets/) - you can choose whichever you want from the config settings. I definitely see the version control issue, but semantically "assets" seems more appropriate, so you guys can decide what suits you better I like having the parent "TracyDebugger" rather than your suggested "TracySnippets" in case we end up with a need for another Tracy folder in the future - this way they are nested, rather that having them on the same level which I think will be cleaner. Hope that's ok with everyone
    3 points
  9. check this too: https://www.fastcomet.com/ (https://www.fastcomet.com/processwire-hosting)
    3 points
  10. the latest weekly.pw had a survey about that topic: i'm on self-managed VPS using plesk as controlpanel. current pricing is 15€ for 2core / 4GB / 150ssd / 10 domains or 30€ for 4core / 8GB / 400ssd / 30 domains i tried several other options over the last months ( digitalocean self managed, cpanel, laravel forge, serverpilot ) but i came back to vps + plesk because it is quite easy to use (for me as a non expert) but also offers a lot of freedom if you need advanced stuff (having full ssh access). all the other solutions where always lacking some parts and would have made another service necessary (like backups, for example). looking forward to hearing other experiences
    3 points
  11. It's hard to keep track of these great modules! That's exactly why I made it. Thanks. Just committed changes to enable pretty much exactly what you asked. Tags now work like this - [dc3] - Show 3 paragraphs ([dc:3], [dc3p] & [dc:3p] all do the same). (Same as original functionality.) [dc3-6] - Show 3 to 6 paragraphs randomly per page load ([dc:3-6], [dc3-6p] & [dc:3-6p] all do the same). (New stuff.) [dc3w] - Show 3 words ([dc:3w] does the same). (Same as original functionality.) [dc3-6w] - Show 3 to 6 words randomly per page load ([dc:3-6w] does the same). (New stuff.) (Anyone who has already downloaded and is happy has no need to update - the only changes are in response to @abdus's request above.)
    3 points
  12. Update: It seems that function_exists() is broken in some way on PHP 5 versions in this particular hosting environment. It returns false when passed a namespaced function name (as per the FileCompiler compiled module files). It should return true, as the function is certainly present and callable. I've done some tests and it's not Processwire related; the same issue is present in vanilla PHP scripts. If I switch to PHP 7 function_exists() once again behaves as expected.
    3 points
  13. Very nice - would be awesome if we could somehow integrate these kinds of passwords (for easy memorisation): https://untroubled.org/pwgen/ppgen.cgi
    3 points
  14. You cannot do that because a superuser is the "web master" in ProcessWire. Just do not give this role to anyone except yourself, create roles for others and you "are done" Seriously, see this discussion, for example: https://github.com/processwire/processwire-issues/issues/371
    2 points
  15. Ha, thanks! I'm not a 'proper' programmer but I don't like it when I can't establish a logical explanation. It's been raised as a fault to the hosting team and they're looking into it..
    2 points
  16. Of course, wasn't thinking about the renaming with dot character prefix. This does of course mean that your snippets will end up in that archived version so you'd have to copy across with each upgrade. I was literally just writing this when your reply came through. This is safe from the files being run directly from the browser and we have a history of this approach with several other modules using this location. Done!
    2 points
  17. you are right! thanks. than that's of course not possible. didn't think of that since i always updated my modules through git pull... so +1 for /site/assets/TracyDebugger/snippets agree
    2 points
  18. I think it depends on how you update modules. Manual overwrite of files would depend on whether you merge or replace when copying. I think if you use the PW Upgrade module it will replace /site/modules/TracyDebugger/ completely so the snippets directory would be lost / replaced with an empty one. I haven't tested this, but I think that's what happens. Either way, I think there are too many chances it will be lost. What do others think?
    2 points
  19. Your know your topic had me thinking, can a non-coder use Processwire and actually setup a lot of things on the go, I had to think deeply about this, because I'm highly technical and know my way around, but to be honest It would take some effort compared to WordPress (in terms of adding additional features), I don't think you can *easily* do that with Processwire, and this is where 3rd Party Modules Developers come in, Modules have to developed with user in focus so that users can easily configure and tweak settings without needing to touch the code, which is always what WordPress has going, it's why users find WP a haven and not developers, Processwire has a developer-esque to it in some ways. I would because Processwire is a CMF which is why, the developer presence might feel strong but unlike other CMS (Bolt,Backbee CMS, ImpressPages , Silverstripe, Concrete 5 and October CMS) I would say this is the most friendliest you can feel comfortable with, a basic knowledge of PHP is all that is required. WordPress is just.................................. don't even want to talk about it, I am currently handling a WordPress project, and am this close to picking diving in front of a bus than working on the project
    2 points
  20. You should be commended on sticking with the troubleshooting. I'm glad you finally got to the root of the problem.
    2 points
  21. You need to either put the call to count() outside of the string or use curly braces. So both of these should work: // outside of string $out .= "<a href='$item->url'>$item->title</a> <span class=''>" . $item->children->count() . "</span>"; // or with curly braces $out .= "<a href='$item->url'>$item->title</a> <span class=''>{$item->children->count()}</span>";
    2 points
  22. when you put variables in selectors you need to use double quotes! otherwise php will use $var as regular string and not as a variable. // this does not work $pages->find('categories=$cat') // this works $pages->find("categories=$cat") edit: just saw you have some more code... // change this echo "<li><a href='$cat->url'>{$cat->title} {$pages->find('categories=$cat')->count}</a></li>"; // to something like that echo "<li><a href='{$cat->url}'>{$cat->title} " . $pages->find("categories=$cat")->count . "</a></li>";
    2 points
  23. Sure, this is done in v0.0.2 If you know of a Javascript library that can generate those sorts of passwords while still satisfying password field settings I'd be happy to integrate it. But I think memorising passwords is only a short hop away from reusing passwords, which is asking for trouble.
    2 points
  24. @Karl_T I fixed this too but without publishing here. Sorry for this Furthermore I added options for the label etc. In the environments I use it (latest PW) everything works as expected, even single select. I forked now the original module and pushed my latest version on github. https://github.com/kixe/Processwire_FieldType_Templates
    2 points
  25. Good to hear! I hope to have the shortcut keys working - it's a little different because with the Console panel they work when the editor is focused which we don't have in this case. I can probably add the eventListener on "document", but I would like to check that the Snippet Runner panel is open as well - will see what I can do. A question for you - do you think it's ok to have the path to snippets be relative to /site/templates/ so you would just enter something like "snippets" in the config setting which would scan /site/templates/snippets/ for files? Or maybe it doesn't need to be configurable and it's just in that folder, or do you think it should be configurable by full path, or maybe relative to document root? Any thoughts?
    2 points
  26. The superuser is like it's names suggests super. It's like the admin user you get in each other system out there. There aren't any access restrictions on that role. It's meant for the people developing the website and should not be used for content-creators. Also it wouldn't make much sense to add access restrictions to an user, which most likely has access to any configuration files as well as the database behind the website.
    1 point
  27. if($item->hasChildren() && $maxDepth) { $out .= '<div class="w3-block w3-padding w3-white w3-left-align accordion">'; $out .= $item->title; $out .= ' <i class="fa fa-caret-down"></i></div>'; if ( $item->id == wire('page')->id ) { $out .= '<div class="w3-bar-block w3-padding-large w3-medium">'; } else { $out .= '<div class="w3-bar-block w3-hide w3-padding-large w3-medium">'; } $out .= renderNavTree($item->children, $maxDepth-1); $out .= '</div>'; } else { // markup for the link $out .= "<a href='$item->url' class='w3-bar-item w3-button w3-opacity-min'>$item->title</a>"; } Quick & Dirty. Can you try this one?
    1 point
  28. Also true - though passphrases and passwords are different beasts in themselves, and one would use them differently, in the context mentioned anyway. I generally like to have passphrases generated, and then saved to my local wallet (and then synced to my cloud wallet). As for a JS lib, I did find some, but they were a bit hectic, and one of them requires a user dictionary (doesn't come with a stock one)... Anyways, was just an idea.
    1 point
  29. yes, it is working as it should now. thank you for the quick fix and for your devotion for this superb project called Processwire,
    1 point
  30. Hi Thanks for this nice module, you have created so far very useful modules, thank you again for all your contributions to Processwire. One thing I noticed, this module does not work (modules not displayed) for modules who are not implementing the ConfigurableModule interfacce but are using the new module configuration described in here. https://processwire.com/blog/posts/new-module-configuration-options/
    1 point
  31. IMHO.. I think it would be best to specify a default directory in site/templates/TracySnippets and allow an override in Tracy for the directory to use in site/templates. I wouldn't recommend snippets in /site/assets/TracyDebugger/snippets because that folder typically isn't versioned control whereas site/templates/ is version controlled.
    1 point
  32. Not really. The one I use is reliable and provides good support, but it's Portuguese. Last year's CMS Critic awards elected Bluehost (https://www.bluehost.com) as the best provider, and Inmotion (http://www.inmotionhosting.com/) as runner-up. Maybe they're worth checking out.
    1 point
  33. I've been using shared hosting without any problems. Unless you're developing a big project with very specific needs, you should be fine going that way.
    1 point
  34. Thanks for this module @DaveP It's so easy to use and saved me heaps of time copy/pasting from lipsum.com
    1 point
  35. Not sure what do you mean by "Selector field type", do you mean page reference field? A little more info would be nice, what are you trying to do with the reapeater
    1 point
  36. It looks fantastic, thanks! Could the shortcut keys for Run and Clear work here like they do in Console?
    1 point
  37. Hi @kixe, I found that single select is not working. I have fixed the issue based on your files. I forked the original repo here: Github
    1 point
  38. I'll look into it further. This is a bit of an issue for me.
    1 point
  39. Thanks for the great module. It would be awesome if you make the link text " Generate password " translateable
    1 point
  40. Hi @Robin S - here's a screencap of my first version of SnippetRunner. It looks and works quite similarly to the Console panel, except that it loads snippets from files in a configurable folder and of course the code itself isn't shown. I kept the "Processing" and "Completed!" notifications, as well as the results pane in case the snippet returns any output. If case it's not obvious, clicking "Run" executes the latest version of the snippet from disk, so no need to reload anything here after saving changes in your code editor. Also, the code in your snippets has access to $page when viewing a page on the frontend, or editing a page on the backend. It also has access to $field, $template, & $module when appropriate: see #2 here: https://processwire.com/talk/topic/12208-tracy-debugger/?do=findComment&comment=152466 Please let me know if you have any suggestions before I put the final touches on it.
    1 point
  41. There is another related bug. If you have more than one image fields, you will see the image all in the same size even you have adjust the size bar individually after you save and refresh.
    1 point
  42. First, I really like this admin theme! So what follows isn't meant to be a full picture of my reaction to it because overall I love it - just a few things that could use tweaking IMHO. Fonts Currently users will see completely different fonts depending on what OS they are using. The font-family rule is: font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif It's become popular lately to use system fonts like this (was it GitHub that started it?) but the problem is that the fonts in this stack are not very similar. It's one thing to fall back to Arial if Helvetica isn't available because they are so similar that the average audience won't be able to tell the difference. But San Francisco, Segoe UI, Roboto and Helvetica Neue are completely different typeface designs. So for instance there will be no consistency with x-height or position of type within the line-height box across platforms, so what looks pixel-perfect on MacOS might look sloppy on Windows or some other OS. If the desire is to move away from the bog-standard Helvetica/Arial then wouldn't it be better to bundle an open-source webfont kit with PW so there is reasonable consistency across platforms? From the blog post screenshot: From the demo site, Windows 8.1: Search box Like the current default admin theme search box styling, I think this is way too subtle: I have 20/20 vision and I can only barely make out the bounds of the search box - imagine what it's like for users with less-than-perfect vision. The search feature is hugely useful for quickly finding a page to edit in a deeply nested tree structure, so we want users to know that it exists. With the current admin default theme, most of my clients had never noticed the search box (until I boosted the contrast in some custom admin CSS). Tab metaphor For a tab metaphor to make sense there has to be some visual connection between the active tab and the content within that tab. Otherwise it isn't clear what content on the screen is controlled by the tab. On this screen... ...not knowing better, I would expect the tabs to control only the Title, Date and Headline fields. Body looks like it is outside of the tabbed content and so the expectation is that it remains on screen when switching to a different tab. Of course you learn how it works once you use it, but every time a thing works differently to how a user expects it to work there is a little bit of mental friction - a bit more effort required to understand it and a bit less satisfaction. I understand that there is a setting for controlling the border style of different fields (although it is disabled in the demo so I couldn't easily try it) - that's great. But I think the default style should be one that lends itself to the tabbed interfaces that are used throughout the PW admin (i.e. a visible border that connects to adjacent fields that are within the same tab). Breadcrumb separator Getting a little nit-picky here, but I think a guillemet › is a better breadcrumb separator than a slash /. The breadcrumb is supposed to indicate a hierarchy of pages. With the slash there is less sense that Posts is within Blog. It looks like a group of items that are all on the same level. Container width My preference is for some max-width to be set for pw-container (1600px maybe?). On my 2560px-wide monitor the interface becomes too wide for comfortable use. But that's an easy override for me to apply if there's no agreement on that.
    1 point
  43. @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
  44. I thought of another option around this: you could give the 'module-admin' permission to the role, and then use a hook to check which module is being requested and only allow access to a particular module. $this->addHookBefore('ProcessModule::executeEdit', function($event) { if(!$this->user->isSuperuser() && $this->input->get->name !== 'MarkupSEO') { throw new WirePermissionException('You do not have permission to configure this module.'); } }); Now you just need to create a custom link in admin to the module config page, maybe using a simple Process module. Or I think AdminOnSteroids lets you add custom menu items - haven't tried it myself.
    1 point
  45. I would add a field to the user template and set its timezone for every user page. as you did. then using horst´s example hooks and session public function init() { $this->pages->addHookAfter('Session::logout', $this, 'timezoneLogout'); $this->pages->addHookAfter('Session::login', $this, 'timezoneLogin'); } public function timezoneLogin(HookEvent $event) { $user = $event->object; $session = wire('session'); $session->timezone = $user->timezone; } public function timezoneLogout(HookEvent $event) { $session = wire('session'); $session->remove('timezone'); } Now you can use the session var across the backend and the frontend without querying the user
    1 point
  46. Sounds great, I look forward to seeing it. As promised, here's a full example of a simple contact form. This is bare bones, but safe. I've left out spam prevention measures, which I'll be happy to follow-up with if you'd like. Below is an entire template file. I figured it was simpler to show this way rather than splitting into multiple files. Though when forms get really large, I tend to split them in multiple files (and include them). But for smaller forms, I do it like the example below. /site/templates/contact.php <?php $sent = false; $error = ''; $emailTo = 'nikola@company.com'; // or pull from PW page field // sanitize form values or create empty $form = array( 'fullname' => $sanitizer->text($input->post->fullname), 'email' => $sanitizer->email($input->post->email), 'comments' => $sanitizer->textarea($input->post->comments), ); // check if the form was submitted if($input->post->submit) { // determine if any fields were ommitted or didn't validate foreach($form as $key => $value) { if(empty($value)) $error = "<p class='error'>Please check that you have completed all fields.</p>"; } // if no errors, email the form results if(!$error) { $msg = "Full name: $form[fullname]\n" . "Email: $form[email]\n" . "Comments: $form[comments]"; mail($emailTo, "Contact Form", $message, "From: $form[email]"); // populate body with success message, or pull it from another PW field $page->body = "<h2>Thank you, your message has been sent.</h2>"; $sent = true; } } if(!$sent) { // sanitize values for placement in markup foreach($form as $key => $value) { $form[$key] = htmlentities($value, ENT_QUOTES, "UTF-8"); } // append form to body copy $page->body .= <<< _OUT $error <form action="./" method="post"> <p> <label for="fullname">Your Name</label><br /> <input type="text" id="fullname" name="fullname" value="$form[fullname]" /> </p> <p> <label for="email">Your Email</label><br /> <input type="email" name="email" id="email" value="$form[email]" /> </p> <p> <label for="comments">Comments</label><br /> <textarea id="comments" name="comments">$form[comments]</textarea> </p> <p><input type="submit" name="submit" value="Submit" /></p> </form> _OUT; } // include site's main template which outputs everything include("./main.php");
    1 point
×
×
  • Create New...