Title: parismolver's Replies | WordPress.org

---

# parismolver

  [  ](https://wordpress.org/support/users/parismolver/)

 *   [Profile](https://wordpress.org/support/users/parismolver/)
 *   [Topics Started](https://wordpress.org/support/users/parismolver/topics/)
 *   [Replies Created](https://wordpress.org/support/users/parismolver/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/parismolver/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/parismolver/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/parismolver/engagements/)
 *   [Favorites](https://wordpress.org/support/users/parismolver/favorites/)

 Search replies:

## Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Tip Jar WP] Can i link the shortcode to the file download location?](https://wordpress.org/support/topic/can-i-link-the-shortcode-to-the-file-download-location/)
 *  Thread Starter [parismolver](https://wordpress.org/support/users/parismolver/)
 * (@parismolver)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/can-i-link-the-shortcode-to-the-file-download-location/#post-13855044)
 * Solved.
 * 1. With a fresh install, create a new tip jar block and configure it how you 
   wish.
 * 2. download a plugin or use a tool such as phpMyAdmin (for dreamhost users) and
   investigate your database for wp_tj_forms database. copy the JSON data for your
   form.
 * 3. Edit the ID and attachment ID for your specific form create a ‘INSERT INTO’…‘
   VALUES’ ([https://stackoverflow.com/questions/452859/inserting-multiple-rows-in-a-single-sql-query](https://stackoverflow.com/questions/452859/inserting-multiple-rows-in-a-single-sql-query))
   that inserts the details of a new tip jar form.
 * 4. use the shortcode [wp-tj id=’your id’] !
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Tip Jar WP] Can i link the shortcode to the file download location?](https://wordpress.org/support/topic/can-i-link-the-shortcode-to-the-file-download-location/)
 *  Thread Starter [parismolver](https://wordpress.org/support/users/parismolver/)
 * (@parismolver)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/can-i-link-the-shortcode-to-the-file-download-location/#post-13826658)
 * Hi,
 * I’ve managed to upload my own mysql script to my dreamhost php sql interface 
   and it’s working pretty alright in terms of creating a new tipjar. However, the
   download doesn’t work till i go into the edit mode and reassign the zip, even
   though in the interface the naming is correct.
 * I’ve compared the database entry from before the reassign and after and the only
   thing that changes is the attachment_id parameter.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Tip Jar WP] Can i link the shortcode to the file download location?](https://wordpress.org/support/topic/can-i-link-the-shortcode-to-the-file-download-location/)
 *  Thread Starter [parismolver](https://wordpress.org/support/users/parismolver/)
 * (@parismolver)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/can-i-link-the-shortcode-to-the-file-download-location/#post-13825533)
 * I just did some more digging and I think I’ve found success.
 * With the WP Data Access plugin installed I can browse through my databases.
    
   If i click >explore and page forward in the list till I find the database;
 * myuser_tip_jar_wp_forms
 * From here I can export and import the database as needed. Being able to create
   a database listing with the id 1234 means i can edit the following fields;
 *     ```
          "id":1,
          "mode":"form",
          "open_style":"in_place",
          "currency_code":"NZD",
          "currency_symbol":"$",
          "currency_type":"decimal",
          "blank_flag_url":"https:\/\/www.parisphoto.nz\/wp-content\/plugins\/tip-jar-wp\/\/assets\/images\/flags\/blank.gif",
          "flag_sprite_url":"https:\/\/www.parisphoto.nz\/wp-content\/plugins\/tip-jar-wp\/\/assets\/images\/flags\/flags.png",
          "default_amount":500,
          "top_media_type":"none",
          "featured_image_url":false,
          "featured_embed":"",
          "header_media":null,
          "file_download_attachment_data":{
             "file_download_mode_enabled":true,
             "attachment_id":128,
             "attachment_filename":"12345678.zip",
             "email_required":true,
             "instructions_title":"Thanks for the tip!",
             "instructions_description":""
          },
          "recurring_options_enabled":false,
       ```
   
 * I am guessing that in python I can create a dummy entry, duplicate it and edit
   only the fields I wish to change. I can do this at the same time my QR codes 
   and webpages are being generated.
 * I’m still unsure of two things tho.
 *     ```
       "attachment_id":128,
       ```
   
 * what does this do? It it for bookkeeping in the download logs database or does
   it serve a function elsewhere as discussed in the download.php
 *     ```
       "attachment_filename":"12345678.zip",
       ```
   
 * How does this link to the actual file path? Does TipJarWP always link and look
   in the /wp-content/ directory? If so then simply placing 1234.zip in /wp-content/
   and creating a database with “attachment_filename”:”1234.zip” and “id”:1234, 
   would be enough to create the shortcode [tipjarwp id=1234] which links to 1234.
   zip
    -  This reply was modified 5 years, 6 months ago by [parismolver](https://wordpress.org/support/users/parismolver/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Tip Jar WP] Can i link the shortcode to the file download location?](https://wordpress.org/support/topic/can-i-link-the-shortcode-to-the-file-download-location/)
 *  Thread Starter [parismolver](https://wordpress.org/support/users/parismolver/)
 * (@parismolver)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/can-i-link-the-shortcode-to-the-file-download-location/#post-13825389)
 * I see this is the transient download
 *     ```
        * @param    int    $form_id - The ID of the form containing the attachment we want to download.
       ```
   
 * If possible I’d like to maintain the security of my files and the files of my
   users.
 * When I make a new download attachment it creates a new $form_id correct? And 
   this is also noticed when the new form is placed as the tipjarwp id increments.
 * Is there some way I can create my own TipJarWP form? in such a way where I specify
   where the file location exists (as I do in the GUI interface) and what the id
   used in the shortcode is to be (which i can’t do in the GUI).
 * I’m planning on making 100 business cards for example, would it be possible to
   create the entire TipJarWP database and then manually upload that instead? That
   way site 1234 could have the shortcode id 1234 which downloads 1234.zip. I also
   think this solves every-bodies solution in the future instead of hacking together
   something to work for just me.
    -  This reply was modified 5 years, 6 months ago by [parismolver](https://wordpress.org/support/users/parismolver/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Tip Jar WP] Can i link the shortcode to the file download location?](https://wordpress.org/support/topic/can-i-link-the-shortcode-to-the-file-download-location/)
 *  Thread Starter [parismolver](https://wordpress.org/support/users/parismolver/)
 * (@parismolver)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/can-i-link-the-shortcode-to-the-file-download-location/#post-13825044)
 * 😮 😮 😮
 * Thank you for getting back to me during my slumber. will do more digging and 
   get back to you on any fixed, findings and successes I have whilst I work on 
   it today. I see how I’ve been using an html link instead of a file location as
   you pointed out. Thanks for correcting me.
 * I’ve worked with c, java and python but php is still rather foreign. I think 
   the filter idea is a good one but I think we’ve both run into the same problem.
   There’s no way to tell the download button what file to fetch. I used a php plugin
   that creates a shortcode which is pretty mindblowing. How it’s setup at the moment
   is that the default file delivery is a txt file warning the customer that their
   download has failed.
 * I was diving into the download transient file and i think this script could work,
   but the location it takes me to is a 404 page ../wp-content/uploads/.zip
 *     ```
       	// Create the secret file download URL.
       	// 						https://www.parisphoto.nz/?tjwp_file_download=2e8GjZ5XCovW&tjwp_file_download_value=zFVQ7hZMDSox
       	// $file_download_url = get_bloginfo( 'url' ) . '?tjwp_file_download=' . $file_download_key . '&tjwp_file_download_value=' . $file_download_value;
       	// ZIP LOCATION 		https://www.parisphoto.nz/wp-content/uploads/3082508124.zip
   
       	$url = 'https://';
       	// Append the host(domain name, ip) to the URL.
       	$url .= $_SERVER[‘HTTP_HOST’];
       	// Append the requested resource location to the URL
       	$url .= $_SERVER[‘REQUEST_URI’];
   
       	$split_str        = str_split($url, 29);
       	$double_split_str = str_split($split_str[1], 10);
       	$unique_id        = $double_split_str[0];
   
       	$file_download_url = get_bloginfo( 'url' ) . 'wp-content/uploads/' . $unique_id . '.zip';
       ```
   
 * I really appreciate your help on this but i think this is as deep as I can go
   with my limited understanding, specifically with how the button is written / 
   the button call back implementation so that information can be passed from the
   post housing the TJ to the download transient.
    -  This reply was modified 5 years, 6 months ago by [parismolver](https://wordpress.org/support/users/parismolver/).
    -  This reply was modified 5 years, 6 months ago by [parismolver](https://wordpress.org/support/users/parismolver/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Tip Jar WP] Can i link the shortcode to the file download location?](https://wordpress.org/support/topic/can-i-link-the-shortcode-to-the-file-download-location/)
 *  Thread Starter [parismolver](https://wordpress.org/support/users/parismolver/)
 * (@parismolver)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/can-i-link-the-shortcode-to-the-file-download-location/#post-13822204)
 * Edit. Absolutely stuck here.
 * I have edited the php in such a way that the page will tell me the download link
   to be delivered.
 *  $url = “[https://&#8221](https://&#8221);;
    // Append the host(domain name, 
   ip) to the URL. $url.= $_SERVER[‘HTTP_HOST’];
 *  // Append the requested resource location to the URL
    $url.= $_SERVER[‘REQUEST_URI’];
 *  $split_str = str_split($url, 29);
    $double_split_str = str_split($split_str[
   1], 10); $unique_id = $double_split_str[0];
 *  //echo “zip_dl:”.$unique_id;
    //echo”zip_dl->>>”.”[https://www.parisphoto.nz/wp-content/uploads/&#8221](https://www.parisphoto.nz/wp-content/uploads/&#8221);.
   $unique_id.”.zip”; $deliverable_file_path = “[https://www.parisphoto.nz/wp-content/uploads/&#8221](https://www.parisphoto.nz/wp-content/uploads/&#8221);.
   $unique_id.”.zip”;
 * Is used outside of the function tip_jar_wp_deliver_attached_file() method, however,
 * echo $deliverable_file_path
 * returns nothing when placed in the method and even when the download fails, trying
   to observe via the upcomming leaves blank space where the download url should
   be, indicating that the global is probably not being passed into the function
 *  // If no attachment file path was found…
    if ( ! $deliverable_file_path ) { 
   wp_die( esc_textarea( __( “The download link “.$deliverable_file_path.’ is an
   invalid file download.’, ‘tip-jar-wp’ ) ) ); }
 * I’m feeling so close with getting my hack working. It’s not elegant but to be
   able to dynamically link downloads to this plugin, either via a shortcode entry
   point or another means would be fantastic, especially if you’re running a podcast
   site for example where each post includes a unique file.

Viewing 6 replies - 1 through 6 (of 6 total)