Using jDownloads Custom fields

jDownloads has 14 custom field that may be set up so that users may supply specific information.  There are four field types:

  1. Select Box (five available);
  2. Short Input Text Field - maximum 256 characters (five available);
  3. Date (two available);
  4. Long Input Text Field (two available);

There are three stages to setting up Custom Fields.

The initial step is to define the contents of the fields in the Custom Data Fields tab in the jD Configuration.  In this very simple example just simple text fields are used but the principle are the same for each field type.  Here just two 'extra' questions will be asked when Downloads are being created.

text field01

The next step is to go to the User Groups Settings and select the User Group (UG) that is allowed to create/edit Downloads. 

These selections are in the Group Creation/Editing Settings tab at the bottom.

Set a 'tick' agaist the questions that you wish to be available for that uploader to fill in as indicated opposite.  Should you wish to make the field mandatory then 'tick' both boxes alongside the relevant Custom Field.

Of course if you have more than one upload enabled UG then you need to repeat the process for all of those UGs as appropriate.

text field02

The result is that now there will be extra fields in the 'Additional' tab of the upload form as shown opposite.

In the backend there is a specific tab called Custom Data Fields.

text field03

The third and final step is to show this information to the User at the front end.  This means editing either your active Files layout or the active Download Details layout. 

Actually never edit the default layouts but use a copy. For more details on Layouts please see the articles at Editing a Layout in the documentation.

In the v3.2 style Files and Download Details layouts there are specific code blocks which show the information associated with a Download such as illustrated opposite

To enable the Custom fields to show then the appropriate placeholder needs to be included in the layout, specifically:
{custom_title_#} for the field title and {custom_value_#} for the field data, where the # character is replaced by the number of the custom field. 

In this example then {custom_title_6}  will show Type and {custom_title_7} would be Brand. Placeholders {custom_value_6} and {custom_value_7} would have the information supplied by the creator or editor of the Download.

So to show the two custom text fields one would add code fragments such as

<div class="jd_field_row" style="width:auto;">
            <span class="jd_field_title">{custom_title_6}             {custom_value_6}</span>

<div class="jd_field_row" style="width:auto;">
            <span class="jd_field_title">{custom_title_7}             {custom_value_7}</span>


Example code block in Information section of layout

<div style="width:auto;">
            <span>{created_date_title}             {created_date_value}</span>

The standard view could be something like shown below



After adding the two code blocks then the view would be modified


 Colin Mercer April 2016

Print Email