Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/28/2017 in all areas

  1. This week we’ve got lots of details on our successful migration to Amazon AWS services for the processwire.com network of sites. We've also got updates on the current core and ProDrafts status. https://processwire.com/blog/posts/amazon-aws-now-powering-processwire.com-sites/
    8 points
  2. Go to Setup/Templates: You should now be able to add any additional fields that you need.
    5 points
  3. Additionally, if you look at the link on the user template that says: To configure what fields a user can edit in their profile, see the profile module settings. You will be able to choose which fields are editable by users themselves. Like so: When users log in, their profile will be editable like:
    4 points
  4. I'm proud to present you: "The Crafters" Premium cocktails from Belgium! Enjoy! https://www.crafters.be/ (Front-end build with https://semantic-ui.com/)
    4 points
  5. Some more links you might also find useful: Multiple templates or parents for users front-end system to handle logins, password resets and changing passwords (old but should still help you a lot if you want to implement it on your own without Front-End User module) @adrian's Some User related actions @adrian' Tracy Debugger with loooots of developer tools, such as User Switcher Panel lots of other info in the forum Hope this helps too.
    3 points
  6. Yes. More info here: Rather than try and render the user template you can create a separate template for the profile page and... Get individual fields with $user->some_field Get all fields with $user->getInputfields() Get an array of named fields with $user->getInputfields(['some_field', 'another_field', 'field_the_third'])
    3 points
  7. Use exec() to run a background task that curls your page maybe? http://stackoverflow.com/a/4628279
    3 points
  8. Before i push the website online I run all images true an image optimiser (app). https://imageoptim.com/mac
    3 points
  9. To get a page's children... $skyscrapers = $page->children();
    2 points
  10. 2 points
  11. one thing i did for a complex table was - single row data is cached (wire cache) - entire table is cached (wirecache) from the row data - the json is used to create the table itself (data tables). if a single row changes, that row's cache is refreshed and the whole table, but this was fast because all of the other rows didn't need to be re-calculated. also in my case, each row had some pretty complex rendering functions that needed to run, so this was the best solution i came up with; and wirecache worked really well! in testing datatables, for my use case, inline json was the fastest to render, when compared with table markup and ajax.
    2 points
  12. Media Manager version 010 (released 28/04/2017) Happy to announce the latest release of Media Manager. Changelog As per this request, added option to confirm duplicate media overwrite on upload. This, obviously, only works when the setting Duplicate Media is set to overwrite existing media with the one being uploaded. If you have that option selected, you will see a new option 'Always confirm when replacing/overwriting duplicate media' in the Duplicate Media sub-section. Tick that and save if you want to use this option. On the Uploads Tab you should now see a 'Confirm Overwrite' checkbox toward the top right of that page. Unless that checkbox is ticked, you will not see 'Start' upload buttons. Made various strings used in success/error messages in JavaScript translatable This latest version is now available for download Screens 'Always Confirm Overwrites' setting 'Confirm Overwrites' checkbox unchecked 'Confirm Overwrites' checkbox checked
    2 points
  13. What about an Ajax call on doc or window ready?
    2 points
  14. 2 points
  15. I still haven't released a new version but just added a new feature to set pagelist icons, similar to MarkInPageTree:
    2 points
  16. ImageOptim is great, I use it every day!
    2 points
  17. I would try the session fingerprint config setting. Start by setting it to false and if that works you can try to make it more secure after that: https://github.com/processwire/processwire/blob/36984e4a057268b7a45b848e1b3b6ee757583459/wire/config.php#L241 Obviously make the change in your site/config.php file, not the wire one I pointed to.
    2 points
  18. Since I'm doing a lot of detailed logging in our internal PW-based systems, that has become a bit of a bottleneck under heavy load and I was missing a centralized view with the growing number of separate PW instances. So I dug into the core a bit, namely WireLog.php and FileLog.php as well as ProcessWire.php. I managed to whip up my own WireLogDatabase and DbLog classes mimicking the behaviour of the regular logging classes, but not without a little bit of tweaking to the ProcessWire class itself to replace the regular logger. Now I'm logging to a MySQL server instead of plain files and ProcessLogger works smoothly with it without tweaking. I thought it would be shame to keep this all to myself, but a release-worthy version would need or could benefit from: a bit of polishing in regards to error handling and proper treatment of conflicting concurrent operations without too much lock overhead (drop table vs. insert especially) more source code documentation a little more abstraction so all csv operations are deprecated in favor of database columns where avaible last but not least, an approved way to configure the substitute logger and load it early on, which means touching the core ProcessWire class Before I invest too much into that, I'd love to hear all thoughts on this, especially if you think such a module may fit your requirements, and I would be especially happy to hear from @ryan - could you see such a mechanism in the core?
    1 point
  19. Docker (http://www.docker.com) is an open platform for building, shipping and running distributed applications. Docker containers are a great way to package a complete application with its specific dependencies in a portable way so that it can easily be deployed on any compatible network or cloud infrastructure. Recently I spent a few days making my ProcessWire site run in a Docker container, and - as I could not find any good tutorial for this - it sounded like a good idea to write one. You will find on the web plenty of presentations and tutorials about Docker, so I won't start with the basic concepts, and this tuto assumes that you have a first understanding of Docker's fundamentals. What we want to do here is to migrate an existing site to a set of docker containers. Therefore, to start with, you should have: - docker installed on your computer; - the site directory of your ProcessWIre site - a backup of your site's MySQL database Let's start. Create a docker container for the site database For several reasons (insulation, security, scalability), it is preferable to host the site database in a separate docker container. 1. Set-up a SQL database with MariaDb or MySQL $ docker run --name database -e MYSQL_ROOT_PASSWORD=rootdbpassword -d mariadb Here I choose to use the MariaDB official container in its latest version, but MySQLwould be just fine as well. 2. Run a PhpMyAdmin container and create the ProcessWire database We first select an simple image with PhpMyAdmin on the Docker Hub: nazarpc/phpmyadmin and we create a docker container based on this image. This container will access the port exposed by the database container via a private networking interface. We specify this with the `--link` option. It can be run temporarily (and exited by ctrl-C): docker run --rm --link database:mysql -p 8881:80 nazarpc/phpmyadmin Or it can be run as a daemon in the background: docker run -d --name phpmyadmin --link database:mysql -p 8881:80 nazarpc/phpmyadmin From phpmyadmin (accessed from your browser at http://hostaddress:8881) you can now create your ProcessWire database, create a dedicated user for it, and import the database content from a previously saved SQL file. Note: alternatively, you can do all database operations from the command line in the database docker container created during step 1, or use another mysql user interface container if you prefer… 3. Update the database parameters in your site configuration In your site's `config.php` file, the sql server name shall be set to `mysql`: $config->dbHost = 'mysql'; Other `$config->dbXxx` settings shall match the database name, user and password of the just-created database. Create a Docker Image for Apache, PHP and the Processwire site 1. Create an image-specific directory with the following contents and `cd` to it bash-3.2$ ls -l . config .: total 16 -rw-rw-rw- 1 jean-luc staff 1163 21 aoû 12:09 Dockerfile drwxr-xr-x 17 jean-luc staff 578 17 aoû 12:48 ProcessWire drwxr-xr-x 7 jean-luc staff 238 21 aoû 12:07 config drwxr-xr-x 7 jean-luc staff 238 20 aoû 18:46 site config: total 160 -rw-rw-rw- 1 jean-luc staff 160 20 aoû 18:28 msmtprc -rw-rw-rw- 1 jean-luc staff 72518 20 aoû 18:56 php.ini where: `ProcessWire` contains the version of ProcessWire that we want to use for this site; It can be retrieved from github with a link like https://github.com/ryancramerdesign/ProcessWire/archive/{version}.zip` For example, the 2.6.13 dev version can be obtained by the link https://github.com/ryancramerdesign/ProcessWire/archive/7d37db8d6b4ca6a132e50aff496a70e48fcd2284.zip `site`: our site-specific files `Dockerfile`: the dockerfile for building the image (see below) `config`: a directory containing specific configuration files copied to the docker image (see below) 2. Set the `Dockerfile` content FROM php:5.6-apache RUN apt-get update \ && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng12-dev zziplib-bin msmtp\ && a2enmod rewrite \ && a2enmod ssl \ && docker-php-ext-install mysqli pdo_mysql iconv mcrypt zip \ && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ && docker-php-ext-install gd EXPOSE 80 EXPOSE 443 # Add a specific php.ini file COPY config/php.ini /usr/local/etc/php/ # Configure the mail sent utility msmtp (http://msmtp.sourceforge.net) and make it readable only by www-data COPY config/msmtprc /usr/local/etc/php/ RUN chmod 600 /usr/local/etc/php/msmtprc \ && chown www-data:www-data /usr/local/etc/php/msmtprc # Remove all default site files in /var/www/html RUN rm -fR /var/www/html/* # Copy ProcessWire core files COPY ProcessWire/wire /var/www/html/wire COPY ProcessWire/index.php /var/www/html/index.php COPY ProcessWire/htaccess.txt /var/www/html/.htaccess # Copy site-specific files COPY site /var/www/html/site # Make www-data the owner of site-specific files RUN chown -R www-data:www-data /var/www/html/site VOLUME /var/www/html/site Based on the official image `php:5.6-apache`, it installs missing packages to the system, adds mod-rewrite and mod-ssl to Apache, plus a number of PHP modules needed by Processwire (core or modules): mysqli, pdo_mysql, iconv, mcrypt, zip, and gd. Then it copies the site files to the location expected by the Apache server. Finally it declares a Docker volume `/var/www/html/site` (i.e. the site files and assets), so that it can be shared with other containers. 3. Set the msmtp configuration We need to configure a sendmail utility, so that we can send emails from php, for example when a user registers on the website. The simplest way to do it is to rely on an external smtp server to do the actual sending. That's why we use msmtp. - define the desired smtp account in `config/msmtprc` account celedev-webmaster tls on tls_certcheck off auth on host smtp.celedev.com port 587 user webmaster@celedev.com from webmaster@celedev.com password thepasswordofwebmasteratceledevdotcom - in `config/php.ini`, configure the sendmail command so it uses msmtp: sendmail_path = /usr/bin/msmtp -C /usr/local/etc/php/msmtprc --logfile /var/log/msmtp.log -a celedev-webmaster -t 4. Build the Docker image docker build -t php-5.6-pw-celedev . 5. Create a Data-only container for the site files docker run --name celedev-data php-5.6-pw-celedev echo "Celedev site data-only container" 6. Run the web server container docker run --name celedev-site -p 8088:80 --link database:mysql --volumes-from celedev-data -d php-5.6-pw-celedev Note that this container is linked to our database and shares the 'celedev-data' volume created previously During development, it can be convenient to keep an access to the host file system from the container. For this, we can add a shared volume to the previous command: docker run --name celedev-site -p 8088:80 --link database:mysql -v /Users/jean-luc/web/test-docker:/hostdir --volumes-from celedev-data -d php-5.6-pw-celedev Our ProcessWire website is now up and running and we can test it in our browser at http://hostaddress:8088. Great! What we now have in Docker bash-3.2$ docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE php-5.6-pw-celedev latest 2aaeb241c2e2 3 hours ago 1.149 GB nazarpc/phpmyadmin latest e25cd4fd48b3 8 days ago 521 MB mariadb latest dd208bafcc33 2 weeks ago 302.2 MB debian latest 9a61b6b1315e 5 weeks ago 125.2 MB bash-3.2$ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 68cc5d976f0d php-5.6-pw-celedev "apache2-foreground" 20 hours ago Up 20 hours 443/tcp, 0.0.0.0:8088->80/tcp celedev-site 0729fe6d6752 php-5.6-pw-celedev "echo 'Celedev site d" 20 hours ago Exited (0) 20 hours ago celedev-data e3e9e3a4715c mariadb "/docker-entrypoint.s" 3 days ago Up 3 days 3306/tcp database Saving the site data We can create an archive of the site files by running a tar command in a dedicated container: bash-3.2$ docker run --rm -it --volumes-from celedev-data -v /Users/jean-luc/web/test-docker:/hostdir debian /bin/bash root@2973c5af3eaf:/# cd /var/www/html/ root@2973c5af3eaf:/var/www/html# tar cvf /hostdir/backup.tar site root@2973c5af3eaf:exit bash-3.2$ Tagging and archiving the Docker image We can also add a tag to the docker image that we have created in step 4 (recommended): bash-3.2$ docker tag 2aaeb241c2e2 php-5.6-pw-celedev:0.11 bash-3.2$ docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE php-5.6-pw-celedev latest 2aaeb241c2e2 3 hours ago 1.149 GB php-5.6-pw-celedev 0.11 2aaeb241c2e2 3 hours ago 1.149 GB nazarpc/phpmyadmin latest e25cd4fd48b3 8 days ago 521 MB mariadb latest dd208bafcc33 2 weeks ago 302.2 MB And we can archive this image locally if we dont want to push it now to the Docker Hub: bash-3.2$ docker save php-5.6-pw-celedev:0.11 | gzip > php-5.6-pw-celedev-0.11.tar.gz And that's it! You now have a portable image of your ProcessWire website that you can run directly on any docker-compatible system.
    1 point
  20. @szabesz Nicely done.
    1 point
  21. You might want to read my tutorial, in which I explain how I did it and why.
    1 point
  22. BTW, if you have GhostScript installed on your server, you can use it to compress PDFs locally using a command-line call... gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=out.pdf in.pdf Source: SuperUser.com (See 2nd answer.)
    1 point
  23. Hi @ktagel, Welcome to the forums! That information, I believe, is described here. Have a look around at the other articles too, as they are indispensable. Feel free to post any questions you may have and someone will be along shortly to help.
    1 point
  24. Is opcode caching active on those sites (opcache, APC)? If yes, one of those could be responsible. If the site used opcache, make sure that opcache.validate_timestamps is true, for APC make sure that apc.stat is enabled.
    1 point
  25. @neonwired When debugging AJAX, I do recommend: https://processwire.com/blog/posts/introducing-tracy-debugger/#dumps-recorder-panel
    1 point
  26. What a great site! Love seeing new design methods - this really is great!
    1 point
  27. There are a number of modules available here that may suit your needs.
    1 point
  28. you can also set the icon in the AdminThemeReno settings, if you are using that Admin theme.
    1 point
  29. you can rename your homepage to blog, but then you page tree on the backend will show all the posts at the root (sub home) level. Usually this sort of thing is done using url segments in combination with a page path rewrite hook to make the blog posts live off the root. Look for the CMS critic case study to see an example of that.
    1 point
  30. I could be wrong, but I think Home is the parent of all pages. You can't have another page at that level. What is it you want to accomplish? Maybe there is a means to do so with your current structure. And welcome to the forum!
    1 point
  31. Do you have Tracy Debugger installed? I believe you can test the rss feed in the console. You would use the Example 1 code from Ryan's post, minus the php tag, like so: $rss = $modules->get("MarkupLoadRSS"); $rss->load("http://www.di.net/articles/rss/"); foreach($rss as $item) { echo "<p>"; echo "<a href='{$item->url}'>{$item->title}</a> "; echo $item->date . "<br /> "; echo $item->description; echo "</p>"; } This example works on my 3.0.61 install, so it should work for you as well. What do you mean you purchased a template with all files (What files?) and the pages (What pages?) were already created? Did you purchase a site profile?
    1 point
  32. I've created a quick module implementation of @Can's work. https://github.com/benbyford/PostProcessUrl Hard Truncates any page name / url to a max length if exceeded.
    1 point
  33. Hi @nabo You can use http://modules.processwire.com/modules/process-admin-actions/ By default, it includes Page Active Languages Batcher that lets you enable or disable active status of multiple languages on multiple pages at once.
    1 point
  34. 404 on /processwire doesn't say to me that this is a permission error. Also I don't believe you can remove the administration role from the initial admin account without taking from the database. Have you changed the url to the login page? Can you echo out <?=$page->editUrl?> this will give you the url with the admin panel.
    1 point
  35. You may well be right, Guy. You know your application better than anyone else. If you design your cron script to process a small part of the larger picture on each invocation, there's no reason that an invocation has to process the entire input set in a single run. Also, as you already have an exact record of the previous input set in the form of the previously imported CSV file, it should be fairly easy to compare the newly generated file you want to import into PW with the previous one in order to quickly generate your addition, deletion and change lines. This approach does work if the external data set is the master copy and is in sync with any sales that are made through the PW site. If stock levels are independently tracked in PW and/or take some time to back propagate the external data source, then this pre-processing approach can't be used for updates, just for additions and deletions. Also, if a large percentage of the data set is different between imports, then it may not gain you anything to pre-process. Best wishes
    1 point
  36. I built this one on bootstrap 4 with a number of extras. ie. Animate on scroll for photos and carousels, navbar animate on scroll, lightbox, facebook sdk for page embed, google map embed, and font awesome. I am using the page tree as a row builder instead of navigation. I detached the menu system from the page tree to give more control on external links, single page website situations that need to link to sections, and add new window target options. It also lets you have different footer links vs header links this way. You can add something like a privacy policy to the footer and not the header and still have one place that controls your menus. Extensions used: Color Picker, Inputfield ACE Extended, Google map marker, MarkInPageTree, Media Library, and Hana Code. I made a little module that will combine all of my ACE code fields into one merged javascript file and one merged css file on page save also. (Filename time stamped for cache busting.) Its pretty neat! I have code tabs on pages that contain css and js ace fields tied to various things. containers, themes, quick styles, and my sitewide code snippets can all have css or js that are merged on page save. While the page rows are great for adding elements to single pages, the sitewide snippet template is very powerful also. Located under the template page, these are filed under the location name. It has fields for files, css, js, php, and html code. By adding this one page to the correct location; Top, Head, Body, Bottom, it will autoload and add code to various locations all at the same time and keep everything organized. ie. Install a header file, and it pulls in all of the related css styles and javascript code at the same time for you. You can check out my screenshots to see how it all works! You can insert bootstrap rows, columns, and add bootstrap elements to columns. https://www.lakehamiltonoutfitters.com/
    1 point
  37. You shouldn't use the actual token value you get from the session, you must use the value from the guest. The whole premise of CSRF (cross site request forgery) protection is to detect requests with invalid/missing tokens, so you know they're originated from a form on your site. If you don't use the posted value (a field starting with TOKEN in $input->post and its value that is sent with the request) you're practically removing CSRF protection altogether.
    1 point
  38. To change settings for all fields via API you could use: /** * make all fields accessible to view only for all roles except superuser * */ foreach ($fields as $field) { if ($field->hasFlag(8) && $field->name !== 'title') continue; // skip system fields `Field::flagSystem` $field->addFlag(160); // Add flags `Field::flagAccess` = 32 + `Field::flagAccessEditor` = 128 // Applicable only if the `Field::flagAccess` is set to this field's flags. $field->editRoles = array(); // leave empty if you want to give access to superuser only $field->viewRoles = array(1026); // assign field view permission to specific roles (IDs) // save the field $field->save(); }
    1 point
  39. Since the module hooks into Pages::saveReady and Pages::saveFieldReady, it should be called whenever $somePage->save() function is called and a change to DB is necessary.
    1 point
  40. You can use this hook to remove Settings tab from page edit pages <?php wire()->addHook('ProcessPageEdit::buildFormSettings', function (HookEvent $e) { // get the page currently being edited $page = $e->object->getPage(); // check its template if($page->template->name !== 'some-template') return; // remove settings tab $e->object->removeTab('ProcessPageEditSettings') })
    1 point
  41. @seddass, @Karl_T I'm a little out of the loop regarding Redis, at the moment, but I like the idea of collaborating on this. As I have the original repo on github, how about I add you both as collaborators, and we can make this a more community oriented effort?
    1 point
  42. @Karl_T Glad to save your time. If we join forces we can create a great Redis Sess Handler for PW. Hope @netcarver will help too. If it's just occasionally, I would try with strings using TTL (or PTTL) to get their expire time and to sort all the keys in php array. BTW never played with TTL till now. It has to be tested with a lot of sessions. The next feature will be to provide connection support for local socket and to multiple Redis servers with priority and auth. My experience with Redis started when I find out session_id() took 12 seconds because of many sess files.
    1 point
  43. @seddass Thanks for your great lesson. I have really learnt a lot! I lack the knowledge and sense to find out the potential threats. And, I should have made it clear about the existence of any open issues affecting the usage before using a library. I will dig deeper and try to resolve the issue. Your attached code would be a great help for this. I was using string as datatype originally. Hash is used because it is the only way I found that can let me to do calculation like finding recent active session using timestamp by ZADD. Thanks for poitning this out. I overlooked this one.
    1 point
  44. After @ryan broke my hearth here i added uikit icon support to my font icon picker module v.0.1.6 Fix FieldtypeFontIconPicker sanitizeValue() v.0.1.5 Added uikit icon select support (required AdminThemeUikit), because uikit icons not working standalone.
    1 point
  45. Sure It's the second and I thought the first one is on steroids... Now I know I was very wrong
    1 point
  46. There is a monolog plugin for Tracy: https://componette.com/nextras/tracy-monolog-adapter/ so if you're already using Tracy for logging errors in production mode (no debug bar), this might be an option. If people are interested in that approach, I'd be willing to add. PS - @BitPoet - not meaning to take away from your approach - just throwing another option out there.
    1 point
  47. Apache and Nginx are both individual webservers, but only apache is supported officially by processwire. EC2 is from a plain server pov not different to other virtual server providers, but aws does have a lot of privacy / access rulings around all it's services, which is (or at least can be) super complicated for simple setups. That's why I think one should only use aws if one does need aws. I'm not sure how much knowledge you have about setting up your own servers, but if you're not quite comfortable with it I'd suggest you not doing it for any production work. If a simple shared hosting would be enough I'd charge the client a good amount extra for the hoops of setting up a virtual server in the first place. It's not only the time spent, but also the responsibility coming with setting up anything on your own. If you still want to roll with it I'd suggest you the tutorials over at digital ocean (initial setup / lamp setup) and using ubuntu. Ubuntu is the most used system out there and the digital ocean tutorials are quite well written and not really dedicated to their service per se. And just a suggestion about your "cloud loving" client. You might take a look a PaaS like heroku, which is as cloudy (in terms of scalablity/on-demand hosting) as aws, but a lot simpler to setup.
    1 point
  48. Update: OpenShift already accept the quickstart
    1 point
  49. How many of you use a service like OpenShift? I ask because I am looking to change my development methods. I have used it before. But at the time I didn't see the value in it. Now with my use of GIT rising and my worrisome failing WAMP server (discussed in a previous post) I need something more robust than just working on my local machine. Do you use OpenShift? Heroku? Amazon? If so, which? why? Give me some ideas on how I can improve my development.
    1 point
  50. This is the only way I know to create different sizes when uploading images: <?php class ImageCreateThumbs extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'ImageCreateThumbs', 'version' => 100, 'summary' => '', 'href' => '', 'singular' => true, 'autoload' => true ); } public function init() { $this->addHookAfter('InputfieldFile::fileAdded', $this, 'sizeImage'); } public function sizeImage($event) { $inputfield = $event->object; if($inputfield->name != 'images') return; // we assume images field $image = $event->argumentsByName("pagefile"); $image->size(120,120); $image->size(1000,0); } } https://gist.github.com/5685631 What I don't know is if it really makes a difference (I guess), and if using drag and drop ajax upload and old school upload would process image one by one. My suggestion is to also upload image already in 1000x* pixels because if they upload 3000+ px images it will just takes a lot longer.
    1 point
×
×
  • Create New...