WordPress.org

Ready to get started?Download WordPress

Forums

Issuu PDF Sync
[resolved] Feature request access parameter (4 posts)

  1. Remco Tolsma
    Member
    Plugin Author

    Posted 2 years ago #

    First of all thanks for this handy plugin. For some sites we don't want the PDF's to be public available. The Issuu upload API function call has an parameter 'access':

    http://issuu.com/services/api/issuu.document.upload.html

    It would be very nice if we can configure that parameter on the options page of the Issuu PDF Sync plugin. It would be great if this option could be added shortly to the plugin.

    http://wordpress.org/extend/plugins/issuu-pdf-sync/

  2. benjaminniess
    Member
    Plugin Author

    Posted 2 years ago #

    Hello,

    Ok I'll think about it. I could add a checkbox with the default param (public or not) and then a box for each publication.

    I'll notice you if I do that.

  3. Jan Egbert
    Member
    Posted 2 years ago #

    I would really like this feature as well. We use Issuu for private documents mostly, so a checkbox to let users choose public / private would be a welcome option!

  4. Remco Tolsma
    Member
    Plugin Author

    Posted 2 years ago #

    Probably relatively easy to implement:

    Index: inc/class.admin.php
    ===================================================================
    --- inc/class.admin.php	(revision 491696)
    +++ inc/class.admin.php	(working copy)
    @@ -256,12 +256,15 @@
     		// Check if the attachment exists and is a PDF file
     		if ( !isset( $post_data->post_mime_type ) || $post_data->post_mime_type != "application/pdf" || !isset( $post_data->guid ) || empty ( $post_data->guid ) )
     			return false;
    -
    +
    +		// Access
    +		$ips_options['issuu_access'] = 'private';
    +
     		// Prepare the MD5 signature for the Issuu Webservice
    -		$md5_signature = md5( $ips_options['issuu_secret_key'] . "actionissuu.document.url_uploadapiKey" . $ips_options['issuu_api_key'] . "formatjsonslurpUrl" . $post_data->guid . "title" . sanitize_title( $post_data->post_title ) );
    +		$md5_signature = md5( $ips_options['issuu_secret_key'] . "actionissuu.document.url_uploadapiKey" . $ips_options['issuu_api_key'] . "access" . $ips_options['issuu_access'] . "formatjsonslurpUrl" . $post_data->guid . "title" . sanitize_title( $post_data->post_title ) );
    
     		// Call the Webservice
    -		$url_to_call = "http://api.issuu.com/1_0?action=issuu.document.url_upload&apiKey=" . $ips_options['issuu_api_key'] . "&slurpUrl=" . $post_data->guid . "&format=json&title=" . sanitize_title( $post_data->post_title ) . "&signature=" . $md5_signature;
    +		$url_to_call = "http://api.issuu.com/1_0?action=issuu.document.url_upload&apiKey=" . $ips_options['issuu_api_key'] . "access=" . $ips_options['issuu_access'] . "&slurpUrl=" . $post_data->guid . "&format=json&title=" . sanitize_title( $post_data->post_title ) . "&signature=" . $md5_signature; 
    
     		// Cath the response
     		$response = wp_remote_get( $url_to_call, array( 'timeout' => 25 ) );

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic