Jump to content

Leaderboard

Popular Content

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

  1. Thanks to all that have been helping us to wrap up issue reports on GitHub in preparation for the next master version of the ProcessWire core. Unless any major issues surface, most likely 3.0.95 (next week) will be the next master version. Like last week's version 3.0.93, this week's version 3.0.94 continues along the same path in clearing up new and existing issue reports, and fine tuning little details for the master branch. If you come across any new significant issues please submit them in the issues repository. Or if you opened an issue awhile ago and we haven't fixed it yet, please check that the issue is still applicable and reply to let us know. No blog post this week because I don't have anything else new or interesting to write about other than this. But I am definitely getting excited about having a new master version ready. There's no doubt, this is a really nice upgrade relative to the current master 3.0.62. Have a great weekend!
    8 points
  2. Once upon a time the official PW Repo had way more stars on Github. But as @ryan values customer satisfaction over some abstract regalia like numbers stored in Github database (read the whole story here), they got kind of lost (actually not really lost - they are still present, but lost for the marketing purposes). I guess we could have something about one thousand now if this would be dealt differently . But that is old story. Personally I am visiting https://github.com/trending regularly to see what's going on in the open source world. And stars is what makes me see something. So I am 100% for this @adrian's initiative. And one forum post is not enough for success. At least placing Github star buttons all over the main site and forum and in the sticky top banner somewhere would help. Maybe we could ask @Pete to help here? As I understand from years being here @ryan is expecting ProcessWire to "market itself". But as community is part of PW, us marketing PW is kind of PW marketing itself anyways . So let's attract as much stars as we can to make the real star CMS get a primetime!
    6 points
  3. More updates! Here is what was added since my last post: FieldtypeDatetime now supports format argument. Which allows you to pass PHP date format string and retrieve your datetime values formatted the way you want. Besides FieldtypeDatetime fields, the built-in fields created and modified are also support new format argument. FieldtypeOptions is now supported. first and last fields on PageArray types are now supported. As per @eelkenet's request. See above post for details on those. Finally, now there is a way to add support for any fieldtype you want via third-party module. What you need to do is create a module with the name exactly as the fieldtype you want to add support for with "GraphQL" prefix. So for FieldtypeMapMarker it would be GraphQLFieldtypeMapMarker. Then you need to add three required methods and install it. This will automatically add GraphQL support for your desired fieldtype and it will be available in your GraphQL api. Checkout the documentation and an example module for reference.
    3 points
  4. Video or Social Post Embed Based on the TextformatterVideoEmbed module developed by Ryan Cramer, we have added the possibility to embed publications of the main social networks Facebook, Twitter and Instagram. ProcessWire Textformatter module that enables translation of YouTube, Vimeo, Instagram, Facebook, Twitter or Issuu URLs to full embed codes, resulting in a viewable video or social post in textarea fields you apply it to. How to install Download or Clone from Github: https://github.com/lexsanchez/VideoOrSocialPostEmbed Copy the VideoOrSocialPostEmbed.module file to your /site/modules/ directory (or place it in /site/modules/VideoOrSocialPostEmbed/). Click check for new modules in ProcessWire Admin Modules screen. Click install for the module labeled: "Video or Social Post Embed". Now you will be on the module config screen. Please make note of the config options and set as you see fit. How to use Edit your body field in Setup > Fields (or whatever field(s) you will be placing videos in). On the details tab, find the Text Formatters field and select "Video or Social Post Embed". Save. Edit a page using the field you edited and paste in YouTube, Vimeo, Facebook, Twitter, Instagram and/or Issuu URLs each on their own paragraph. Example How it might look in your editor (like TinyMCE): How it works This module uses YouTube, Vimeo, Instagram, Facebook, Twitter and Issuu oEmbed services to generate the embed codes populated in your content. After these services are queried the first time, the embed code is cached so that it doesn't need to be pulled again. Configuration You may want to update the max width and max height settings on the module's configuration screen. You should make these consistent with what is supported by your site design. If you change these max width / max height settings you may also want to check the box to clear cache, so that YouTube/Vimeo/Facebook/Twitter/Instagram/Issuu oembed services will generate new embed codes for you. Using with Markdown, Textile or other LML This text formatter is looking for a YouTube, Vimeo, Instagram, Facebook, Twitter or Issuu video URL surrounded by paragraph tags. As a result, if you are using Markdown or Textile (or something else like it) you want that text formatter to run before this one. That ensures that the expected paragraph tags will be present when VideoOrSocialPostEmbed runs. You can control the order that text formatters are run in by drag/drop sorting in the field editor. Copyright 2018 by Ryan Cramer / Updated by Lex Sanchez
    2 points
  5. It depends on how you've set up the backend. You say logic for favourites, so I assume a user can have more than one favourite. I am also assuming that users need to login (i.e., no guest users). Finally, I assume an item is a PW page. Two approaches I can think of. Save users to the fav item. I think this is what you are doing in your code above. I wouldn't take this approach though. I'm not sure it would scale very well. I'd do it the other way round (#2) Save favs to users. I explain below If your items are pages, it is easy to reference them in a page field. Create a page field that accepts multiple pages. Let's call it favs. Add the page field favs to the user template. I am assuming your users are normal users. This way, we only need to save the ID of the favourite item. Using that, we can get its title or whatever field it has at runtime to display to the user his/her favourite items. Here's some untested code (could throw up errors). // inputs for favourites; could be whatever input, as long as can take multiple items // <input type='hidden' name='add_fav[]' value='1234'> a listed item // <input type='hidden' name='add_fav[]' value='5678'> another listed item // add favourites for a LOGGED IN user // @note: using ProcessWire $input if(count($input->post->add_fav)) { foreach ($input->post->add_fav as $fav) { $user->favs->add((int)$fav); } $user->of(false); $user->save('favs'); } // fetch favourites for a LOGGED IN user $out = ''; if($user->favs->count) { $out .= '<ul>'; foreach($user->favs as $fav) { $out .= '<li>'. $fav->title .'</li>'; } $out .= '</ul>'; } echo $out; Do you have a need to use $_POST rather than ProcessWire's $input? Edit: If you have losts of listable items (i.e. the selectable pages in the user field favs, although the users will not be interacting with the field directly in the backend, you might want to use autocomplete as the input for the page field.
    2 points
  6. A page ID of zero means a NullPage - that's not a valid page you can redirect to if login is successful. When setting the value of $requested_id you should set a fallback value (e.g. "1", the home page) if no id is present as a GET variable. Something like: $requested_id = (int) $input->get->id ?: 1;
    2 points
  7. Theres a Tutorial for that https://processwire.com/docs/tutorials/installation-moving-and-troubleshooting/page5
    2 points
  8. I meant a regular page edit screen, eg editing the Home page. Sounds great, looking forward to it!
    2 points
  9. Checkbox Reversed Modifies InputfieldCheckbox so that it shows the reverse of its true value. The checkbox will be unchecked when the field value is 1 and checked when the field value is not 1. Background The core FieldtypeCheckbox does not have a setting that allows a checkbox to be checked by default. One reason for this is that only a checked field saves a value to the database. An unchecked field does not save "0" to the database, but rather does not save any value for the field at all. Therefore there is no way to distinguish between a new field that has not yet been saved (and therefore could potentially get a default checked state) and a field that has deliberately been saved as unchecked. Because of this you sometimes have to use a checkbox in the opposite way than you would like. Suppose your client has requested a checkbox labelled "Bootylicious" that will be checked by default. This isn't possible with FieldtypeCheckbox so instead you have to convince them that a checkbox labelled "Not bootylicious" that is unchecked by default is just as good. This alternative will achieve the same thing, but it's not ideal. A solution This module doesn't change the limitations of the core checkbox field, but it provides a workaround that allows you to show the checkbox with the desired default state and label. So in the example above you would still name the field "not_bootylicious" (otherwise it could get confusing in your template files) but you can label the field "Bootylicious" and the checkbox will appear checked when its true value is actually unchecked, and vice versa. This allows new pages to show the checkbox checked by default. Clear as mud? Usage Install the Checkbox Reversed module. For any Checkbox field where you want the inputfield to show the reverse of its true value, activate the "Reverse the checked state of this inputfield?" option in the field settings. https://github.com/Toutouwai/CheckboxReversed http://modules.processwire.com/modules/checkbox-reversed/
    1 point
  10. @adrian, I think that should be fine, but could you first make the change on your local installation? If it seems to work okay let me know and I'll update the module.
    1 point
  11. I'll make optional to keep the list open.
    1 point
  12. Ah ok. I was afraid that I missed something But anyways: same does the module during the installation process: It adds language and country code fields to each language template. Regarding x-default, I'd recommend this for reading: https://www.rebelytics.com/multiple-hreflang-tags-one-url/
    1 point
  13. Hello fellow PW devs! This is a short story from the server management trenches. These past couple of days trying to solve an unexpected problem: after DigitalOcean patched the droplets in NYC3 region last week, my client's droplet became almost useless and went down a couple of times. The droplet has 2GB RAM and was running Ubuntu 16.04 that was updated to kernel 4.4.0-116 after the patch. The server was provisioned using Forge (forge.laravel.com). After sshing into it, and running "top" I've noticed the cause: "php-fpm7.1" processes (3-5 instances) were spiking the CPU to 100%. This was very odd, as the CPU usually kept around 33% most of the time. The site uses ProCache and markupCache and was getting around 800-1000 visits/day last week. I checked everything on PW's side and nothing seemed out of place, so I went restarting PHP and Nginx but the problem continued. I checked access logs and no suspicious activity shown up. I upgraded PHP to 7.2 to see if anything will changed but the problem continued. My only guess after all that is that the droplet in question got screwed up somehow, because I didn't see any complaints on the web of other people getting the same problem on DO (But I confess that I did a quick Google search only). So in the end I decided to create a new droplet, now with 2 CPU cores and kept the 2GB (1 extra core and $5 cheaper ). Reinstalled PW there and pointed the floating IP to this new server. The installation went smooth but to one issue: error log started to show messages of MySQL showing "to many files" error when the users were searching. I've never encountered this message before, so after reading some StackOverflow posts, I changed mysql.services config file to remove its file limit (https://stackoverflow.com/a/36807137) Everything is normal now, but I think I'll never discover what truly happened. Anyone else had this kind of problem with MySQL before?
    1 point
  14. Are you sure that you allowed alternative language for these pages? ( Checkboxes on the settings tab).
    1 point
  15. Thanks, would be interesting to see how your example looks like on the frontend. Maybe you have a screenshot?
    1 point
  16. I think Duplicator is an easy way to do this. It worked here.
    1 point
  17. The steps I can think of right away would be... Moving the site files to the server. This is should be quite straightforward: use the scp command, or an SFTP application, or whatever you prefer. Just get the files to the production server somehow. The database part depends a bit on the tools you have available, but basically you need some way of exporting it as an SQL dump from the dev server to the production server. If you're familiar with command line tools, mysqldump is one way to do this – here's one guide for that. If you have a tool like phpMyAdmin installed, it has tools for both exporting (on the dev server) and importing (on the production server) SQL dumps. Note that you may have to create the database and related MySQL user on the server beforehand. This, again, depends a bit on your particular server setup. Check your /site/config.php on the production server and make sure that the domains and database credentials in there match the ones you're using in production. ... and that's pretty much it, I think. Hopefully I didn't forget anything important – my own process is a bit different, so I don't really do this that often Obviously there will be some more generic things to take care, such as connecting a domain to your production server, and so on and so forth. For these I'd refer to any instructions your hosting provider might have.
    1 point
  18. Weird - I am not seeing that error in the SEO module after upgrading AOS. I am going to be doing some major enhancements to the SEO module shortly so I'll investigate more as I go along. Thanks for the case changer fix though!
    1 point
  19. Thanks, but fortunately this one was totally unrelated. It was the case changer in AOS, in the MarkupSEO module the "Inputfield_titleSmart" named field triggered the case changer beause a selector was written like "[id^="Inputfield_title"]. I've also fixed a CSS positioning issue for the case changer. Check 1.7.9 for the fix. (offtopic) I got a js error if I remove all the selectors in the MarkupSEO settings, like you did in your second screenshot, on a regular page edit screen: Uncaught Error: Syntax error, unrecognized expression: ,input[name=seo_title] In MarkupSEO.php it seems this line assumes there's at least one field selected: $('{$titleFieldsSelectors},input[name=seo_title]').keyup(function(){ This fixes it: $('{$titleFieldsSelectors}').add('input[name=seo_title]').keyup(function(){ Could you check this? I'll add the fix to the MarkupSEO github if you (or someone) could confirm this.
    1 point
  20. Hello, Nice! If I have the choice I prefer to use a program like FileZilla for (S)FTP. I still have to try FreeFileSync (that I'm using for computer backups) for (S)FTP synchronization, but it seems easier to set up (and use) for Windows or Mac OS X than for Linux. You could perhaps at least lower your folders' permissions to 755 (instead of 775, like it's the case for assets/ and templates/). Perhaps quickly check your (sub-)folders' and ("sub-")files' permissions (even outside site/). Have a nice weekend!
    1 point
  21. One of ProcessWire's strength is its .htaccess file. I've never come across another CMS which such a useful one. A lot of security and other issues are taken care of, most of the time we just have to read the inline comments and comment/uncomment lines. If that is not enough, ProcessWire's documentation is adequate in this area, but just in case one runs into issues not yet documented, this forum is full of help. For example, I wanted to remove www from the domain, and in the forum there is a good solution to do just that. Sure, first impression does matter but .htaccess issues can be complex, and most of the time ProcessWire just runs without modifying anything in .htaccess.
    1 point
  22. Looks like a bug in the new ASM tweaks. It's fine if at least one item is selected: But. if you remove the selection in the first ASM, then the field is broken: Here is the js error: Uncaught TypeError: Cannot read property 'length' of null at HTMLSelectElement.<anonymous> (aos.min.js?ts=1.7.8_2018030213:1) at Function.each (JqueryCore.js?v=1519661844:2) at init.each (JqueryCore.js?v=1519661844:2) at HTMLDocument.<anonymous> (aos.min.js?ts=1.7.8_2018030213:1) at l (JqueryCore.js?v=1519661844:2) at Object.fireWith [as resolveWith] (JqueryCore.js?v=1519661844:2) at Function.ready (JqueryCore.js?v=1519661844:2) at HTMLDocument.A (JqueryCore.js?v=1519661844:2)
    1 point
  23. It's a known issue that was fixed in 3.0.80.
    1 point
  24. You could also just use selector arrays and avoid the mess of that selector string. https://processwire.com/blog/posts/processwire-3.0.13-selector-upgrades-and-new-form-builder-version/#building-a-selector-string-with-user-input-example
    1 point
  25. I think checkboxes are sometimes confusing to users and replacing them with an on/off switch can go a long way to making it more obvious. For example, a Yes/No button is more obvious/clear than the assumption that "if this is checked it means yes, and if this is not checked it means no"; For example i'm using this library (incorporated and initialized on some checkbox inputs): https://github.com/olance/jQuery-switchButton Here is my initialized checkbox in PW admin: This still doesn't solve the conundrum of where you want to have it checked by default... the checkbox reversed module is a clever way to solve that...other than js to set the checked attrib..
    1 point
  26. The Field longtext is in my dev installation its just a fieldname created by me but you can test it with the current dev Version (the dev Version will be the the Master Version in „some“ Weeks (?))
    1 point
  27. @Jest does the following works instead? $pages->find("template=project, title*='two, maybe three words'|unknown"); //or $pages->find('template=project, title*=\"two, maybe three words\"|unknown');
    1 point
  28. Just wanted to say how great all these new ASM tweaks are - thanks @tpr and @Karl_T
    1 point
  29. v1.7.7 is uploaded, docs will come later I'm happy with the asmSelect + Select2 result. The jump on click is still present but I think it's a minor issue. There are also 2 extra field config settings: placeholder and limit for FieldtypePage and FieldtypeOptions, you can find it under the Input tab. Currently it's working with asmSelect variants only. I think these additions make using asmSelect much more convenient, feels native after using it once or twice @adrian That top checkbox would mess up the look a bit, but it would be handy otherways.
    1 point
  30. You don't need to set GET parameters or URL segments. (which is not exactly the same b.t.w.) Install LanguageSupportPageNames module and configure it for your needs. go to home page and set names for the home page. Use 'it' for default language and 'en' for english. Don't use 'home'. Don't leave empty. Access language code from $pages->get(1)->name for current user language and $pages->get(1)->getLanguageValue($language, 'name') for specified language. Get the URLs with $pages->get(1)->localUrl($language)
    1 point
  31. Done, 318 Having almost finished my first ProcessWire project I can honestly say its been a pleasure. A site / service built out of the PW admin, custom modules etc (theres no frontend at all) to help manage a manufacturing setup. Has been a great fit and shows how flexible PW is. Even with learning about PW and not being the strongest PHP coder out there I've manage to get things done in a fraction of the time. Heres to PW, glass raised
    1 point
  32. Hey everyone! It's been a while since I last had a time to work on this module. But now I finally managed to focus on this module. So here are the latest updates. The codebase of the module grew very big and the more features I added the more time I had to spend to make sure the changes I made does not break anything. Because I had to manually verify if everything works as expected. After long night hours of trial and error I managed to setup tests for this module. Tests will help us quickly add/remove features as needed, because now there is no need for manually verifying all edge cases. Also I setup the Travis-CI so people can contribute more confidently and I can merge pull requests without worrying! There are already bunch of tests, but there is still some I'll be adding. ? ? I will add some documentation on how to run tests locally in github wiki pages soon and let you know here. Another thing to note is that the master branch of our module no longer tracks the vendor code. This means that if you download the master branch and put it into your /site/modules directory it will not work. Instead you should use release builds that are a cleaned version of the module. It includes required vendor codes and does not have extra files that are not relevant to ProcessWire. Like presentation gif images, test files and so on. This makes the module size smaller!
    1 point
  33. Hello! If this can help someone, this is how I build my login form: // Sign In controller <?php namespace ProcessWire; /** * Class SignIn * * @package ProcessWire */ class SignIn { /** * Render * * @return string * */ public function render(): string { $input = wire("input"); $template = $this->getSignInTemplate(); if($input->post("login_submit")) { // taken from ProcessLogin->execute(); $name = wire('sanitizer')->pageName($input->post("login_name")); $pass = substr($input->post("login_pass"), 0, 128); if(wire('session')->login($name, $pass)) { // Successful login wire("session")->redirect(""); } else { // Login failed $template->set("error", "login failed!"); $template->set("sign_in_form", $this->signInForm()); } } else { // set template variables $template->set("sign_in_form", $this->signInForm()); } return $template->render(); } /** * @return string */ protected function signInForm() { $input = wire("input"); $modules = wire("modules"); // create a new form field (also field wrapper) $form = $modules->get("InputfieldForm"); $form->action = "./"; $form->method = "post"; $form->attr("id+name", 'sign-in-form'); $f = $modules->get('InputfieldText'); $f->set('label', "Username"); // Login form: username field label $f->attr('id+name', 'login_name'); $f->attr('class', 'Name'); $f->attr('value', $input->post("login_name")); $f->collapsed = Inputfield::collapsedNever; $form->add($f); $f = $modules->get('InputfieldText'); $f->set('label', "Password"); // Login form: password field label $f->attr('id+name', 'login_pass'); $f->attr('type', 'password'); $f->attr('class', 'Pass'); $f->collapsed = Inputfield::collapsedNever; $form->add($f); $f = $modules->get('InputfieldSubmit'); $f->attr('name', 'login_submit'); $f->attr('value', "Sign in"); // Login form: submit login button $form->add($f); return $form->render(); } /** * Get Sign In template * * @return \TemplateEngine * */ protected function getSignInTemplate(): \TemplateEngine { return wire("factory")->load("/components/sign-in"); } } Thanks :).
    1 point
  34. A small news for this morning, the AmazonS3 feature is implemented on the module (its a pain when you don't know about a SDK). Also please check the name of the final package as it was suggested by @szabesz. Thanks again for the suggestion, its better and easily manageable. Edit: For information, all SDKs are installed via composer. Is it a problem for you ?
    1 point
×
×
  • Create New...