Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Posts posted by zyON

  1. It seems like this hook doesn't work with other Lists, only on the Page Tree list (I'm using ListerPro). Any ideas how can I remove publish and hide buttons from lists?

    EDIT: Ok, forget it. The hook still works on a Lister. I had a debug message being fired on the hook handle function that was not appearing, but the unset of the buttons still work.

  2. 11 hours ago, Robin S said:

    You still have the "Unpublished" checkbox on the Settings tab and the "Pub" action button in Page List to deal with. Plus to be extra sure you can hook Pages::publishReady to prevent publishing by any means. 

    Robin, I don't have the "Unpublished" checkbox because I'm using the RestrictTabView module to hide the Settings and Delete tabs for this role.
    Thank you for the hooks code, this will come in handy very soon.

    • Like 1
  3. This is how I solved this question:

    I've assigned page-publish permission to the agent role so they can publish pages based on the property template.

    I've created a module that with a hook on ProcessPageEdit::buildForm like this

    $this->addHookAfter('ProcessPageEdit::buildForm', $this, 'removePublishButton');

    The function that handles this just looks at the page being edited and if it has a status of Unpublished, it removes the Publish button:

    foreach($form->children() as $f){
            if($f->name == "submit_publish" && $page->isUnpublished())
              $form->children()->remove($f);  // Removes the Publish Button from Properties not yet published.

    This allows the users with agent role to edit already published pages (if they belong to them, something that the module also checks) but keeps them from publish new pages directly.

    • Like 2
  4. Hi. I'm going to bump this one alive again.

    What Adrian was mentioning is exactly what I need. I need to give some users (agents) the possibility to create pages with a specific template (property) but I don't want them to have access to publish it before someone checks if everything is correct. I've used the special permission page-publish and that takes care of that part. But I also need to give them permission to edit the page as soon as they are published so they can make alterations.

    I'm kind lost on how to handle this. I guess I'll have creat a module to handle this, but how can I override the page-publish behavior so it can give access to edit published pages? Or should I ignore this permission?

    Thanks in advance.

  5. On 08/03/2017 at 1:52 PM, Wanze said:

    Maybe you can set the headerMargin setting to zero in the WirePDF module configuration? Do you print the header?

    Wanze, yes thanks. I was missing the configuration options on the WirePDF module (was checking only the Pages2PDF module configuration).

  6. Wanze: Thanks. You were right, I had to change it to DejaVuSans (but I also had to to copy the DejaVuSansCondensed family to the module ttfonts folder because it was looking for them somehow and throwing an error.

    I was using Helvetica and it should contain Portuguese characters... I'm using it on the site text too. 

  7. Yes, those are on the front-end, but all the other content is ok except for the text coming from the TextAreaLanguage :/.

    Are those question marks at the frontend? Then you are probably defining wrong character encoding in you template files or you have saved your template files with wrong encoding.

  8. Hi, I'm using multi language support and everything is working well (great module btw) except for the text coming from a TextAreaLanguage field where I get missing characters, like in Portuguese, that are replaced by '?'. Anyone having this problem or know what can be wrong? Thanks.

  9. I've not tried yet to block other sites from hotlinking my CloudFront content. 

    You can also check to apply a cache control http header on the module itself. It will apply it to every file uploaded via the module. 

    Hotlinking Cloudfront solution:

    s3 has bucket policy that you can instruct to only allow images get commands from certain domains and or IP's. But cloudfront does not have this, so this only prtects from direct linking to your s3 files. You can apply some level of defensive tactics to limit hotlinking to your cloudfront distributions.

    Here's what I figured out:

    1 - On cloudfront create a second distribution that you connect to the same bucket that you are already using, wait for it to fully deploy, then:

    2 - Check if ithe files can be served from the new cloudfront distribution, then in PW amazons3/loudfront module, change domain name of cloudfront distribution to new distribution, check if all works and disable the old distribution, it can be deleted it you like (I would if I know it is being used for hotlinking).

    This does not stop hotlinking right away, but allows you to stop images from being served from your cloudfront distribution as soon as you switch.

    The hotlinking sites will now no longer have images showing up and will have to go to your site and get the new locations.

    At least it is an easy defense technique to protect against paying for traffic for images not served via your site. Not fool proof, but it slows things down and makes it harder for leaches...

    BTW, it is wise to apply a cache-control http header to the s3 bucket and get the distribution to use this, so your images are served with cache control headers, saves you from unnecessary traffic costs on your s3 account.

    Would be nice to see this module working together with the minimize solution module. That would really make things easy!

  10. To use amazon cloud front, does the file have to be in s3?  Or is it possible to have cloud front work with local processwire files?

    Great plugin!  I am bookmarking it.  Was just curious how amazon works!


    CloudFront uses S3. There's no other way.

  11. Great module. It's possible to use the module working just with API ? I mean, creating pages with images and files not from the admin but via code.

    Thanks. In the current version of the module it will only work with assets uploaded via the admin. 

    That's something in the roadmap for me but I don't have a date I can share right now because I'm really lacking the time at this moment.

    • Like 1
  12. Manol, the plugin doesn't handle the deletion of the files in the assets folder. If the plugin is active, the files will be delivered through S3 without relying on the local ones , so theoretically you could manually delete them from you local assets folder but I think of it as a backup that you can quickly start using just by deactivating the plugin.

    EDIT: Sorry, I forgot to mention (too much work) that in the admin, the local files are used. So it's definitely not a good Idea.!

    • Like 1
  13. This site is also multilingual.

    I did it like arjen suggested. Created a _init.php file in the templates folder with $config->urls->root = "/" and then I've uncommented the line (50) on config.php :

    $config->prependTemplateFile = '_init.php';

    That way, this code is prepended to every template and so it's executed before any code on the templates.

    • Like 3
  14. I'm having a similar problem with a site hosted on Bluehost and using Processwire 2.4.

    The site files are under the public_html/myfolder folder and when I hit the home page in the browser I get the url as it should like: http://www.mysite.com

    But when I follow a link I get the url like http://www.mysite.com/myfolder/section. So the folder name appears in the address. Not pretty. 

    This is what the .htaccess looks like in the public_html folder:

    Options +SymLinksIfOwnerMatch
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www.)?mysite\.com$
    AddHandler application/x-httpd-php54 .php
    Options ExecCGI Includes IncludesNOEXEC SymLinksIfOwnerMatch -Indexes
    RewriteCond %{REQUEST_URI} !^/myfolder/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /myfolder/$1
    RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$ 
    RewriteRule ^(/)?$ myfolder/index.php [L]
    Anyone having the same issue?
  15. New version available

    The module now has the ability to update the filename when a new thumbnail is created via the thumbnails plugin. 

    This is important if you use Amazon CloudFront option to serve the files and want to show the changes you've made to the thumbnails immediately (without waiting for the cache to expire).

    Because when you create a new image crop it's filename doesn't change, I had to force this change in both the thumbnails files and the source file. 

    • Like 5
  16. There's a new version available. Now supporting file versioning to handle the caching issues of CloudFront. 

    There's an option on the module configuration that will automatically rename the uploaded files by inserting a timestamp in the file name. This way all the files have unique names and that will make it easier to replace old files already cached by CloudFront (something that can be a huge PITA as many CloudFront, or other CDN systems know well).


    • Like 7
  • Create New...