Leaderboard
Popular Content
Showing content with the highest reputation on 04/28/2017 in all areas
-
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
-
5 points
-
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
-
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
-
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
-
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
-
Use exec() to run a background task that curls your page maybe? http://stackoverflow.com/a/46282793 points
-
Before i push the website online I run all images true an image optimiser (app). https://imageoptim.com/mac3 points
-
2 points
-
2 points
-
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
-
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 checked2 points
-
2 points
-
2 points
-
2 points
-
2 points
-
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
-
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
-
Thank you so much! You're all very helpful. Really appreciate it. thanks, Ray1 point
-
1 point
-
1 point
-
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
-
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
-
I might take a closer look at https://www.myresponsee.com/ and https://groundworkcss.github.io/. Edit: there are so many of them, like http://ink.sapo.pt/ also. I'm going to concentrate a bit on Responsee 4.1 point
-
It is, and it hasn't been an issue before. I don't know why just the one script was throwing the error, or why it started doing it now. I'm just glad to have a solid workaround for the future. And, tpr, thanks for your help in getting me pointed in the right direction so I could figure out where the problem was!1 point
-
This error occurs if you dont have namespace declared inside the file. Try putting <?php namespace ProcessWire; to the first line. Edit: You should add namespace to all template files to prevent the errors when compilation is disabled. This is actually FileCompiler's purpose, refreshing the page once is often enough to recompile files, but I am not sure why it's not working for you.1 point
-
There are a number of modules available here that may suit your needs.1 point
-
you can also set the icon in the AdminThemeReno settings, if you are using that Admin theme.1 point
-
Interesting. I always would like to stay with pocketgrid since it is so small and easy and practical. But some things I could never accomplish with pocketgrid in a "normal" way. Like giving a processwire block a background picture. In the end I found a way by using padding-bottom (image height/width x 100)% See this post: https://processwire.com/talk/topic/12830-reaching-the-limit-of-pocket-grid-css/ But still this solution gave me always problems with views on different screens like on desktop, laptop, tablet and smartphone So I changed to bootstrap but still thinking about pocketgrid1 point
-
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 wishes1 point
-
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
-
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
-
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
-
Hey there! I find myself discovering more and more beauty when working with ProcessWire. this render method is also new for me. Thank you a lot for sharing this.1 point
-
Can it be done? Absolutely. Is this an ideal first PW project? Hmmm... $64,000 question. It really depends on your level of front end development experience. I don't even say PHP here because you could use almost any front end - I assume nodebb uses node.js and AFAIK there isn't anything to stop you doing that if you really wanted to (but you'd really have to want to) and just use PHP for template files. My thoughts - Front end member registration, password retrieval, etc. Absolutely - simple (and not so simple) forms are easy with just html - no need for the API - just always use sanitizer. (There are a couple of modules for emailing users and forcing new passwords that might help, however.) Front end thread creation by all members (I assume each new thread would be a separate "page") <?php if($user->hasRole('member')){ echo "<form class='createNewThread'>.....</form>"; } You'll need to expand on the <form>, and server side check $user->hasRole() again for security, but that's pretty much all there is to it. Front end member profile editing See my answer re registration. Picture upload required to create each new thread This works lovely with PW (I'm just using it on a project.), for example. Handling the PW side is made much easier by reference to Soma's gist (which has become the de facto method as far as I'm concerned, at least). (Bonus hint - loads of other good stuff there, too.) Picture upload optional on all subsequent comments inside a thread See above. Front end post and comment uploads restricted to images only – .jpg, .gif, .png Because code referred to above uses WireUpload class, that's easy. Appropriate security to prevent uploading malicious files disguised as images See above, but with any security issue, take care. Optional tagging of each thread as it's being created Just search the forum/modules directory. Automatic SEF urls created based on the thread title ( e.g. http://site.com/forum/title-of-my-thread-12345 -or- http://site.com/forum/12345/this-is-title-of-my-thread ) Already built-in, as others have said. Sitewide search feature You'll need to roll your own, but it's not hard. The search page from Ryan's skyscrapers profile is a good source of ideas. I know much of the above duplicates what others have said, but it surely doesn't hurt to have a bit of confirmation.1 point
-
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
-
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
-
Hi, absolutely possible. My thoughts about your points - just some recommendations and very rough ideas: Front end member registration, password retrieval, etc. You may want to check out this: http://modules.processwire.com/modules/frontend-user/ Though I have never used it before. It is quite easy to build your own registration process (once you get the idea how PW works) Regarding this, and regarding everything else, this is a must read I think: Also: Front end thread creation by all members (I assume each new thread would be a separate "page") I would add something like a user role "member". These users are allowed to create threads and post. Then, I think I would only go with one datatype (template) for all the posts. Give them a page-reference field "reply_to". If the field is empty - it is the beginning of a thread. Otherwise you will have a handy reference to the preceding post. Also a page reference like "initial_thread_post" which always references the beginning of a thread could be handy to easily group the posts in threads. Some inspiration: <?php // get the beginning of a thrad $pages->get("template=post, initial_thread_post=$threadNameOrId, reply_to=''"); // find all items of a thread $pages->find("template=post, initial_thread_post=$threadNameOrId"); Front end member profile editing Yep. Just a page / template with that ability. See "Create simple forms using API". Picture upload required to create each new thread About picture upload: Google it, I think it has been asked here before. "required" - absolutely possible. Picture upload optional on all subsequent comments inside a thread Sure. Front end post and comment uploads restricted to images only – .jpg, .gif, .png Sure. Appropriate security to prevent uploading malicious files disguised as images Hm - complex topic I guess, not necessarily related to processwire? https://www.owasp.org/index.php/Unrestricted_File_Upload Optional tagging of each thread as it's being created Automatic SEF urls created based on the thread title ( e.g. http://site.com/forum/title-of-my-thread-12345 -or- http://site.com/forum/12345/this-is-title-of-my-thread ) Already kinda processwires default! : ) You also can change the name of a page (will be the url name) to anything you like. See "Create Pages using API" Sitewide search feature Look it up here in the forums / on the site. There is at least one thread and / or one tutorial! Happy coding1 point
-
1 point
-
Sure It's the second and I thought the first one is on steroids... Now I know I was very wrong1 point
-
I'll have a look on the above issues/requests later, nowadays I'm busy with a 4.04 kg newborn who thinks he can steal all the hours in a day (and night)1 point
-
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
-
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
-
I'd imagine ProcessWire should run on any Linux derivate available to EC2, but may I ask, why you want specifically EC2? DigitalOcean or Linode do charge similarly and are way easier to setup than aws (with all it's enterpricy setup tools and permission hierarchies and stuff). I always feel people preemtively reach for EC2 even though they don't need all the things which make aws great over other services in the first place.1 point
-
1 point
-
1 point
-
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
-
I would still describe this as manual updating. Git hooks provide a fully automated way to get the lastest commited files from git to your server.1 point
-
The simplest tool that I have found for updating databases manually between two different installations is adminer. It's a tiny tiny script much like phpmyadmin. I install it at the root of all my sites.1 point
-
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