CUAR_Private_File

    • David Malli
      Participant
      # il y a 3 mois

      I am pulling in references to private files using the short code below:

      [customer-area-protected-content
      type=”cuar_private_file”
      max_items=”3″
      show=”owned”
      layout=”list” /]

      The problem is, it links to a file page (see attached)

      I’d prefer the user simply download the file.

      Is there a different *type* that I ought to use?  What can I do to eliminate that extra, unnecessary click?

      Thank you in advance

    • Thomas
      Maître des clés
      # il y a 3 mois

      Hi,

      Best way to do this would be to edit the template used to display the shortcode, and replace the link with a download button. Our template system documentation will guide you through that process.

      1. You can easily find the template used to display the shortcode (see attached image)
        shortcode-template-pick
      2. Copy the file /wp-content/plugins/customer-area/src/php/core-addons/shortcodes/templates/protected-content-shortcode-layout-list-item.template.php to /wp-content/customer-area/templates/protected-content-shortcode-layout-list-item.template.php
      3. Copy the code block above in that file
      <?php
      /** Template version: 3.0.1
       *
       * -= 3.0.1 =-
       * - Add download buttons inline
       *
       * -= 3.0.0 =-
       * - Improve UI for new master-skin
       *
       * -= 1.0.0 =-
       * - Initial version
       *
       */ ?>
      
      <?php
      $post_id = get_the_ID();
      $attachments = cuar_get_the_attached_files(get_the_ID());
      $title_popup = esc_attr(sprintf(__('Uploaded on %s', 'cuar'), get_the_date()));
      ?>
      
      <li>
      	<a href="<?php the_permalink(); ?>" title="<?php echo $title_popup; ?>" class="cuar-title block">
      		<?php the_title(); ?>
      	</a>
      
      	<?php if ($attachments) {
      		foreach ($attachments as $file_id => $file) : ?>
      			<a href="<?php cuar_the_attached_file_link($post_id, $file); ?>"
      			   title="<?php esc_attr_e('Get file', 'cuar'); ?>" class="btn btn-default btn-xs ml-10">
      				<span class="fa fa-download"></span>
      				<span class="hidden-xs"> <?php _e('Download', 'cuar'); ?></span>
      			</a>
      		<?php endforeach;
      	} ?>
      </li>

      Basically, I have only bumped the version number of that file in the top, to 3.0.1 (will allow you to receive notification if that file is updated from us), and I’ve copied some code from wp-content/plugins/customer-area/src/php/core-addons/customer-private-files/templates/customer-private-files-single-post-footer.template.php.

      Here is the result :

      shortcode-template-edited

      Best regards.

Vous lisez 1 fil de discussion

The topic ‘CUAR_Private_File’ is closed to new replies.