Wordpress Cron Job to download files - php

I am using pitch print to get customers to edit business cards through a woocommerce set up. When the order is created a link gets appended to the order for the admin/shop manager to download the rendered pdf.
The pdf is stored on the pitch print server, I believe via s3, and you need a signature/key to access the file. Which is ordinarily installed on the plugin admin.
I would like to set up a cron to automatically download the file, either when the order is created, or happy to settle for a times interval.
Post a comment for more clarification if needed.
Cheers
Andrew

Related

Define permission for a different usersets and role

I use Server-to-server interaction feature of Google Drive using API to maintain files that are uploaded by a group of users and seen by others. Before I note down my problem let me first explain the structure of my app (in php).
I have multiple user groups. Let me explain them in brief:
User group 1 - Super Admin has the ability to upload/view/modify/download/delete a file in any folder.
User group 2 - Sub Admin has the ability to upload/view/modify/delete all files but only in a single folder.
User group 3 - Creator of content, they have the ability to upload/view files uploaded by them. Each creator has his own folder. (and has functionality to mark files to be downloaded)
User group 4 - Reader of content, they have the ability to view files uploaded by reader. (They will be able to download only certain files that the creator has marked for downloading, otherwise not.)
My App is live and functioning till now. And I need to add these functionalities but I couldn't find any specific documentation for these requirements.
How do I restrict files to open only through my website and not otherwise? No public links.
Disable download and other buttons on all files except for some (depending on the user type(id and role)).
Please provide me appropriate links or documentation regarding the same.

Automatically create a Wordpress gallery on a specific post from a Dropbox account

I'm working on a Wordpress project where a client would like to automatically create a new image gallery in a post by adding a new folder of images to a Dropbox account.
The posts will be a custom post-type and the Brand of store will be a category within custom taxonomies.The images will be pre-sized before upload so no need for cropping functionality. Gallery of thumbs clicking through to a lightbox.
If it is simpler to remove Dropbox from the equation and work directly with server directories, this would also work. I will sync the Dropbox account to the server directories separately.
I'm fairly new to PHP scripts (although always happy to learn) but in an ideal world any scripts would need to execute every 5 minutes to ensure content is continuously up-to-date.
Any advice, thoughts, suggestions, comments or solutions would be greatly appreciated.

How To Queue Files for Upload at a Later time/different page

I am developing a cart (utilizing OpenCart). The cart allows people to order prints of images. Because the images will be high resolution and therefore large files, I need a method that allows the following:
The customer arrives at a product page,
The customer selects an image for the product,
The file does NOT upload at that time (or, begins uploading in the background),
Without waiting for the file upload, the customer adds the product to the cart,
Repeat steps 1-4 as needed for additional products (and image files),
AFTER successful checkout, the files are uploaded (or, they complete uploading)
It seems the key is to put the files into a queue, and for that queue to persist across page loads until completion of the order.
I'm familiar with PLupload and have found Uploadify, but do not see in their documentation how to accomplish what I'm after.
Can you get me pointed in the right direction? I'm sure this is doable, I'm just unsure how to get started and am unable to find any writeups/documentation around this specific issue.
Thanks!
If you're not using AJAX for all state changes, you can't "remember" a file upload input and repopulate it. (When using AJAX you could hide the forms). You can either let the user upload files right before checkout (not a good practice) or let the user upload in a popup and have the popup use AJAX so you can add forms on the fly as soon as new items are added to the cart.

Print checks and custom forms with PHP

I have been working on a web based financial manager application that is written almost exclusively in php. I would like to be able to allow users to enter and print checks to their check stock.
My first thought was that I could use something like FPDF to create a .pdf document that is the correct size and places the data (date, amount, english text amount, vendor name) in the correct location. That works fine.
The problem I have is that when I go to print a 4.5" x 2.75" document (size does matter), Adobe Reader (browser pluggin and Windows version) places the document on the users available printer pages. Printers do not come with preset page sizes to it all the possible personal check sizes, and not all printers will allow users to add page sizes to the printer driver (yes you can add forms to windows through the print server; but they may or may not show up a an available form in the print driver).
I have read A LOT online on how to create custom form / documents, but am not getting my problem resolved. So I guess I am looking for suggestions on how to implement check printing from within my web app would be greatly apprecated.
You can try to run Cups server with your check printers connected to it. Cups server communicates with it's clients over IPP protocol.
You can create IPP printing job right from php using http://www.cups.org/articles.php?L545+TNews+Q
Printing jobs have attributes - media size is one of them.
So, this way user's OS won't print anything. User will just POST some query to http server, and php will create print job for cups server with media-size and some other attributes.
One of my clients uses tcpdf to print all of their checks. All of their checks are standard U.S. Letter sized.
As Dagon said, you can't control users printers from a PHP application - so instead how about you force them to use particular size checks? The full letter size checks my client uses are perfect - all of the year-to-date/deductions/tax stuff printed at the top and then the actual check at the bottom. They all go through a folding machine after printing so they can be mailed. (Employees with direct deposit get printed check stubs this way)

How to write to database in Symfony2, when a link is clicked on the website?

In a project I'm working on, the client has required that every time a user clicks on a link to download (they will be downloading a video or mp3), there should be a log kept of who has downloaded what and when.
I have a table in my database set up to record the User ID, the File ID, and the date when it was downloaded. However, I don't know how to do this, as the link is basically an tag (obviously).
What is the best way to achieve this?
Probably the simplest solution would be to write simple onclick ajax event.
If you want noscript solution you'll have to create some download wrapper, that'd serve you proper file. Just create special route and controller (eg. /downloads/filename), increment download meter for this one and return asset instead of html response. Don't forget to set proper Content-Type header tho.
There's also IgorwFileServeBundle that could help you loads.
Instead of linking to the MP3 file, you'll have to funnel the download through a PHP script that writes to the database and then sends the MP3 data with with the right headers. For maximum performance use the "X-Sendfile" header instead of the PHP readfile function.
Alternatively you could set up a cron job for a Symfony console command line tool that parses the Apache access log and writes to the DB whenever it encounters an MP3 file.

Categories