• Resolved jytan

    (@jytan)


    Hi,

    I am adding a PDF gallery for a non-profit engineering site to display copyrighted PDF files for login users for viewing only, without the ability to download, access, print, or right click on the document. I come across Media Library Assistant and it seems to be well-suited for the gallery part (though I still need to go through the documentation and examples on how to do that). I would just like to seek experienced users’ advise here if anyone has attempted a gallery of copyrighted documents before?

    In the frontend PDF gallery I need to display lists of hundreds of copyrighted PDF files arranged in categories. If the security features are not available in MLA, would anyone be able to point me to other plugins compatible with MLA that can implement the security features? I am using Elementor Pro website editor if that makes a difference.

    Thank you.

    Vincent

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for your interest in MLA, your question and the description of your application.

    As you suggested, MLA would be a great way to create category-specific galleries of PDF documents. I regret that MLA itself cannot address the security needs you would like to implement. I do not have any direct experience with these features and I do not know of another plugin that would help.

    If you do find another plugin to complete your application, MLA’s “Support for Other Gallery-generating Plugins” might let you use MLA to select the documents and then hand off control to the other plugin to compose the display and add the security features.

    I regret the news is not more positive, but I am marking this topic resolved simply because I have answered your question to the best of my knowledge. If you do find a solution I hope you will post an update here so I and other MLA users can benefit. Thanks for your understanding.

    • This reply was modified 2 years, 7 months ago by David Lingren.
    Thread Starter jytan

    (@jytan)

    Thanks David.

    Under MLA’s “Support for Other Gallery-generating Plugins”, there is an example using the PDF-Embedder plugin. As it turns out, a paid version of PDF-Embedder indeed has the security functions that I am interested in. This makes me excited.

    Relying heavily on the MLA examples, I have managed to randomly open a PDF file using PDF-Embedder from within a Real Media Library (RML) folder. It is random at this point because I have yet to figure out how to specifically:

    1. allow the user to select a RML folder from a dropdown list; then
    2. display all PDFs in the folder as thumbnails gallery (with file titles); and
    3. when a user click a thumbnail, it will open the file using PDF-Embedder

    I believe answers to 1 and 2 can be found with a bit more digging, but item 3 seems to be a bit more daunting as now I need to call mla_alt_shortcode=pdf-embedder from the thumbnails instead. Any advise to help me shorten the learning curve here would be much appreciated.

    Thank you.

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with the promising news about PDF Embedder. I have used the free version for quite a while and it is an excellent plugin.

    Here is a link to an earlier topic with a solution you may be able to adapt to your application:

    how to create a slide show of pdfs

    For your step 1, you can use MLA’s “Support for the “Real Media Library” Plugin” as described in the Settings/Media Library Assistant Documentation tab. You can add the mla_rml_folder parameter to the [mla_gallery] shortcodes. You might consider using taxonomy terms to filter the documents and [mla_term_list] to generate the dropdown control, eliminating the need for RML.

    I hope you find the approach in the earlier topic helpful. Please post an update if you have problems or further questions about it.

    Thread Starter jytan

    (@jytan)

    Thanks David, the example given in the link above on how to create a slide show of pdfs is very helpful. I am using it to display a list of thumbnails in one column, and when clicked, the PDF file opens in the next column using PDF Embedder. However I am struggling to add the title of the document at the top of the embedded PDF. My attempt below does not come out right. I suspect it requires some CSS skill which unfortunately I am extremely poor in.

    But I am thinking could there be an add-title-to-the-top-of-pdf parameter that can be used within the MLA block and if so, how do I used that for my codes below.

    Code to display the thumbnails of all PDFs located in an RML folder:

    <h6>Title of RML folder</h6>
    [mla_gallery] 
    post_parent=all mla_rml_folder=3  size=small post_mime_type=application/pdf
     orderby=title order=asc 
    columns=1 numberposts=10 mla_rollover_text='{+title+}' mla_page_parameter=mla_page
    mla_link_href="{+page_url+}?document_id={+attachment_ID+}&mla_page={+request:mla_page+}"
    [/mla_gallery]<br />

    Code for pagination:

    [mla_gallery]
    post_parent=all mla_rml_folder=3 post_mime_type=application/pdf orderby=title order=asc numberposts=10 mla_output="paginate_links,prev_next"
    mla_page_parameter=mla_page
    mla_link_href="{+page_url+}?mla_page={+request:mla_page+}"
    [/mla_gallery]

    Code to display PDF title:

    <h3>
    [mla_gallery] 
    post_parent=all mla_rml_folder=3  size=none link=none mla_ post_mime_type=application/pdf
    ids="{+template:({+request:document_id+}|1) +width+}" mla_link_text="{+post_excerpt+}" mla_caption="&nbsp; [/mla_gallery]<br /></h3>

    Code to display embedded PDF by PDF Embedder plugin:

    [mla_gallery post_parent=all mla_rml_folder=3 post_mime_type=application/pdf mla_caption="{+title+}"
    ids="{+template:({+request:document_id+}|1)+}"
    mla_alt_ids_name=url mla_alt_ids_value="{+filelink_url+}" mla_alt_shortcode="pdf-embedder toolbar=top"]
    • This reply was modified 2 years, 2 months ago by jytan.
    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with this excellent example of a PDF gallery and viewer. Thanks especially for including the complete source text of all your shortcodes; very helpful.

    I have one general suggestion. Since your shortcodes include either mla_rml_folder=3 or ids="{+template:({+request:document_id+}|1)+}" you can remove the post_parent=all parameter; it’s not needed.

    The best solution for your PDF Title shortcode is to add a custom markup template to format the “gallery” as an HTML heading. The custom template content is:

    Name
    h3-only

    Description
    This template displays only a heading for an ids-specific gallery.

    Arguments
    (Leave this section empty)

    Open
    (Leave this section empty)

    Row Open
    (Leave this section empty)

    Item
    <h3>[+title+]</h3>

    Row Close
    (Leave this section empty)

    Close
    (Leave this section empty)

    As you can see, only the Item section is necessary. You can replace [+title+] with whatever content your application requires. To create the custom markup template:

    1. Navigate to the Settings/Media Library Assistant Shortcodes tab.
    2. Click the “Add New Template” button to the left of the table views.
    3. Change the “select template type” dropdown control to “Markup”.
    4. Change the “select template shortcode” dropdown control to “Gallery”.
    5. Fill in the sections with the content displayed above.
    6. Scroll to the bottom and click “Add Template”.

    Once that’s done you are ready to use the new template in your shortcode. That makes your “PDF Title” shortcode very simple:

    [mla_gallery mla_style=none mla_markup=h3-only post_mime_type=application/pdf ids="{+template:({+request:document_id+}|1)+}"]
    

    Let me know if you have any problems or further questions regarding the suggested solution.

    Thread Starter jytan

    (@jytan)

    Thanks David for the suggestions, really appreciate your pointer that helps to clean up unneeded part of the code. The custom markup template works like a charm.

    For the thumbnail display, I am trying to improve my code by using mla_tag_cloud and taxonomy. As I currently organize my PDFs in RML folders, I populated the Att. Categories and Att. Tags for all the PDFs in one of the RML folders and place the following code on the webpage. These codes are taken straight out from the MLA Documentation example.

    
    [mla_tag_cloud taxonomy=attachment_category number=0 mla_link_href="{+page_url+}?term_slug={+slug+}"]
    </br>
    [mla_gallery attachment_category="{+template:({+request:term_slug+}|a-bad-term)+}" mla_nolink_text="Click a term to display the gallery."]
    

    The term displays correctly on the website but when clicked, the gallery does not show up. I am using Elementor shortcode widget, so I tried hardcoding the page url but the gallery is still not showing. I wish I could do more trials and testing but would appreciate any pointer or suggestion. Thank you.

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with the good news on your progress. Thanks as well for posting the complete text of your shortcodes; very helpful.

    I pasted your shortcodes into an Elementor shortcode widget in a post and on a page. Both of these are working fine on my system. Here is an earlier topic that might help you:

    MLA shortcode shows in live preview but not on actual page

    If you can post a link to the post/page you’re having trouble with I can investigate further. If not, perhaps you can look closely at the links behind each term and match them with what you see in the browser bar before and after clicking a term. Also, does the mla_nolink_text persist when you click a term? If it disappears, it’s possible the gallery is there but styles in your theme are suppressing it.

    I hope you can post an update with more details. Thanks for your understanding.

    Thread Starter jytan

    (@jytan)

    Thanks David for taking the time to test out my code. Much appreciated!

    With regard to the example “MLA shortcode shows in live preview but not on actual page” given in the previous post, it sounds different from my case as the gallery does show up in my code except when selecting from a dropdown or term.

    With regard to your question “does the mla_nolink_text persist when you click a term?”, the answer is Yes, it is still there.

    I am posting three page urls below to show the outcome of three tests/experiments. I have removed the pages from restriction control but pls let me know if there are problems accessing them.

    The first is a test page where I filter PDFs based on hardcoded value of Att_Category. The thumbnails in this page is showing fine. When clicked, the thumbnail opens on the next column.

    Test Page with hardcoded Attachment Category

    The code on the left column:

    <h6>SPT 1998</h6>
    
    [mla_gallery]
    post_parent=all attachment_category=spt-1998 post_mime_type=application/pdf orderby=title order=asc numberposts=10 mla_output="paginate_links,prev_next"
    mla_page_parameter=mla_page
    mla_link_href="{+page_url+}?mla_page={+request:mla_page+}"
    [/mla_gallery]
    
    [mla_gallery] 
    post_parent=all attachment_category=spt-1998  size=small post_mime_type=application/pdf
     orderby=title order=asc 
    columns=1 numberposts=10 mla_rollover_text='{+title+}' mla_page_parameter=mla_page
    mla_link_href="{+page_url+}?document_id={+attachment_ID+}&mla_page={+request:mla_page+}"
    [/mla_gallery]<br />

    The code on the right column:

    [mla_gallery mla_style=none mla_markup=h3-only post_mime_type=application/pdf ids="{+template:({+request:document_id+}|1)+}"]
    
    [mla_gallery post_mime_type=application/pdf mla_caption="{+title+}"
    ids="{+template:({+request:document_id+}|1)+}"
    mla_alt_ids_name=url mla_alt_ids_value="{+filelink_url+}" mla_alt_shortcode="pdf-embedder toolbar=top"]

    The above works fine, so I went further to implement choices for users to select the att_category value by using examples from MLA_tag_cloud documentation. After user clicked the Att_Category value listed as Terms, the PDF thumbnails are not displayed. The page link is here:

    Test Page Using MLA Term

    Note: Pls pardon the formatting of the terms. But as a side-question, is there a quick example of CSS fix to make them more orderly or aligned?

    The code on the left column:

    [mla_tag_cloud taxonomy=attachment_category number=0 mla_link_href="{+page_url+}/?term_slug={+slug+}"]
     </br>
    [mla_gallery attachment_category="{+template:({+request:term_slug+}|a-bad-term)+}" mla_nolink_text="Click a year to display the list of SPT proceedings."]
    
    [mla_gallery mla_style=none mla_markup=h3-only post_mime_type=application/pdf ids="{+template:({+request:document_id+}|1)+}"]
    
    [mla_gallery]
    attachment_category="{+template:({+request:sub_category+}|no-term-selected)+}" post_mime_type=application/pdf orderby=title order=asc numberposts=10 mla_output="paginate_links,prev_next"
    mla_page_parameter=mla_page
    mla_link_href="{+page_url+}?mla_page={+request:mla_page+}"
    [/mla_gallery]
    
    [mla_gallery] 
    attachment_category="{+template:({+request:sub_category+}|no-term-selected)+}"  size=small post_mime_type=application/pdf
     orderby=title order=asc 
    columns=1 numberposts=10 mla_rollover_text='{+title+}' mla_page_parameter=mla_page
    mla_link_href="{+page_url+}?document_id={+attachment_ID+}&mla_page={+request:mla_page+}"
    [/mla_gallery]<br />

    The code on the right column:

    [mla_gallery post_mime_type=application/pdf mla_caption="{+title+}"
    ids="{+template:({+request:document_id+}|1)+}"
    mla_alt_ids_name=url mla_alt_ids_value="{+filelink_url+}" mla_alt_shortcode="pdf-embedder toolbar=top"]

    And lastly, to try out implementation of a dropdown box for user selection. At this stage, I am experimenting with different ways for user to select the year (and possibly proceeding name in future). Again, after user select the Att_Category value and click Submit, the PDF thumbnails are not displayed. The page is linked here:

    Test Page for MLA Dropdown box

    Code on the left column:

    <form id="mla-text-form" action="." method="post" class="row">
    <strong>Year</strong>
    [mla_term_list taxonomy=attachment_category mla_output=dropdown parent=0 mla_control_name=main_category mla_item_parameter=current_main_category show_count=false use_filters=true]
    <br>
    
    <input id="text-form-submit" name="text_form_submit" type="submit" value="Submit">
    </form>
    
    [mla_gallery]
    attachment_category="{+template:({+request:sub_category+}|no-term-selected)+}" post_mime_type=application/pdf orderby=title order=asc numberposts=10 mla_output="paginate_links,prev_next"
    mla_page_parameter=mla_page
    mla_link_href="{+page_url+}?mla_page={+request:mla_page+}"
    [/mla_gallery]
    
    [mla_gallery] 
    attachment_category="{+template:({+request:sub_category+}|no-term-selected)+}"  size=small post_mime_type=application/pdf
     orderby=title order=asc 
    columns=1 numberposts=10 mla_rollover_text='{+title+}' mla_page_parameter=mla_page
    mla_link_href="{+page_url+}?document_id={+attachment_ID+}&mla_page={+request:mla_page+}"
    [/mla_gallery]<br />

    Codes on the right column:

    [mla_gallery mla_style=none mla_markup=h3-only post_mime_type=application/pdf ids="{+template:({+request:document_id+}|1)+}"]
    
    [mla_gallery post_mime_type=application/pdf mla_caption="{+title+}"
    ids="{+template:({+request:document_id+}|1)+}"
    mla_alt_ids_name=url mla_alt_ids_value="{+filelink_url+}" mla_alt_shortcode="pdf-embedder toolbar=top"]

    Note: I will be adding proceedings from other conferences later so I would like the flexibility for user to select which conference proceedings to view (i.e. “SPT”, etc), followed by the year (i.e. “1997”, “1998”, etc.). Is there a way to allow two or more levels of filtering the Att_Category value?

    Apologies for the lengthy post, I hope they do not lead to more confusion. I wanted to show the different outcomes encountered as I work through the experimentation. I would greatly appreciate if you can just investigate the last page that tests the dropdown list in order not to hog too much of your time. Thank you!

    • This reply was modified 2 years, 1 month ago by jytan.
    Plugin Author David Lingren

    (@dglingren)

    Thanks for your detailed update with the links and source text of your test shortcodes; very helpful!

    I could not access the “Test Page with hardcoded Attachment Category”, but I don’t think that matters.

    Your “Test Page Using MLA Term” can be corrected by avoiding a quirk in the way WordPress parses “enclosing” shortcodes. Your first two [mla_gallery] shortcodes are not “enclosing”, while the last two shortcodes are. WordPress is parsing everything from the first [mla_gallery] to the first [/mla_gallery] as if it was one shortcode. If you simply add [/mla_gallery] to the end of the first two shortcodes everything will work as expected.

    Your “Test Page for MLA Dropdown box” needs a bit more work. Here are updated shortcodes that are working on my system:

    Code on the left column:

    <form id="mla-text-form" class="row" action="." method="post"><strong>Year</strong>
    [mla_term_list taxonomy=attachment_category post_mime_type=application/pdf mla_output=dropdown parent=0 mla_control_name=main_category mla_item_parameter=main_category show_count=false mla_option_value="{+slug+}"]?
    <br />
    <input id="text-form-submit" name="text_form_submit" type="submit" value="Submit" />
    </form>
    
    [mla_gallery]
    attachment_category="{+template:({+request:main_category+}|no-term-selected)+}"
    post_mime_type=application/pdf orderby=title order=asc numberposts=10 mla_page_parameter=mla_page
    mla_output="paginate_links,prev_next" mla_link_href='{+new_url+}?mla_page={+request:mla_page+}&main_category={+request:main_category,url+}'
    [/mla_gallery]
    
    [mla_gallery]
    attachment_category="{+template:({+request:main_category+}|no-term-selected)+}"
    post_mime_type=application/pdf orderby=title order=asc numberposts=10 mla_page_parameter=mla_page
    size=small columns=1 mla_rollover_text='{+title+}'
    mla_link_href="{+page_url+}?document_id={+attachment_ID+}&mla_page={+request:mla_page+}&main_category={+request:main_category,url+}"
    [/mla_gallery]
    

    Code on the right column:

    [mla_gallery mla_style=none mla_markup=h3-only post_mime_type=application/pdf ids="{+template:({+request:document_id+}|1)+}"]
    
    [mla_gallery post_mime_type=application/pdf ids="{+template:({+request:document_id+}|1)+}" mla_alt_ids_name=url mla_alt_ids_value="{+filelink_url+}" mla_alt_shortcode="pdf-embedder toolbar=top"]
    

    For the [mla_term_list]:

    • I added post_mime_type=application/pdf so the list would include only terms assigned to PDF documents.
    • I changed mla_item_parameter=main_category so it matches the control name. This makes the control “sticky”, i.e., it retains the selected term.
    • I added mla_option_value="{+slug+}" to replace the default term ID with the slug, which is what the [mla_gallery] parameters expect.

    For the [mla_gallery] shortcodes:

    • I changed sub_category to main_category to match the output from the term list.
    • I added &main_category={+request:main_category,url+} to the links to retain the selected term when a document is selected.
    • I removed the line break in the PDF Embedder shortcode so it would parse correctly.

    I hope that gets you the results you need. Let me know if you have problems or further questions regarding the suggested changes.

    You asked “Is there a way to allow two or more levels of filtering the Att_Category value? The short answer is yes. Can you be specific about the structure of your Att. Categories taxonomy? It looks like you might have the year at the top level and then the conference ID under that; is that right? Any additional details you can provide will be helpful.

    Thread Starter jytan

    (@jytan)

    Thanks David for updating the shortcodes and detailed explanation. The updated shortcodes work wonderfully. This is a great encourage to me as I continue to experiment with different ways of presenting the PDF resources on the website.

    Note: I have removed the restriction on “Test Page with hardcoded Attachment Category”. Apologies for that.

    Regarding the structure of Att. Categories taxonomy, it will be Conference ID at the top level, and then the year. The workings of taxonomy is still new to me so I am not entirely sure if I am doing it correctly. The simplest way it seems is to put them in the format “Conference_ID – Year”. But this would not allow sorting of PDF files by Conference_ID only or by Year only. That’s why I thought to put them at two levels.

    So, the idea is to have a website list all the conference names, and when clicked, a new page will open displaying the dropdown box for user to choose the year corresponding to the Conference (not all years will be listed as some conferences are bi-annual). When a year is selected, the PDFs corresponding to the Conference and the Year will be listed either by thumbnails or as a title list. Finally, when a thumbnail or title is clicked, the PDF will open as embedded PDF in the page. If possible, a control of some sort can be implemented at the top allowing the user to navigate to other Conferences within the same page. I hope the above makes sense.

    Related to this topic, I am wondering if I am placing the value of Conference_ID and Year correctly on the PDF media. I am currently placing the values of Conference_ID, Year and a Sequence_Number on the PDF title so that they can be listed in the correct sequence by MLA. The disadvantage is that the whole string is displayed when the PDF title is displayed on the website. Could it be possible to put the Conf_ID, Year and Seq_No. on other fields instead, e.g. caption, and still allowing MLA to filter and sort by these values? Your comments or advise on this would be greatly appreciated.

    Plugin Author David Lingren

    (@dglingren)

    Thanks for confirming that the updated shortcodes are working for you. Thanks as well for the additional detail on your application structure and goals.

    Hierarchical taxonomies are designed to capture “parent/child” relationships, where second level terms divide a top-level term into more detailed classification. Conference ID and year do not fit that structure; a year has several conferences and each conference is held multiple years, i.e., conference ID and year are two independent attributes of a particular event. It looks like the sequence number is needed because a conference can have multiple documents; is that right? If so, sequence number is a third independent attribute of an event. Would it be useful to have an attribute like “proceeding type” to classify the documents?

    If sequence number is only used to order the documents you can use the existing WordPress menu_order field for this purpose. Here is an earlier topic along similar lines you may find interesting:

    Using MLA Plugin ‘Simple Mapping Hooks’

    Returning to the ID/year issue, one way to achieve your goal would be to create two custom taxonomies, one for ID and one for year. You could also use a “flat” taxonomy like Att. Tags and simply assign an ID and year there. The queries for “all years for a ID” and “all IDs for a year” would be straightforward, and filtering for “all years for a specific ID” or “all IDs for a specific year” are possible, too. Here’s an earlier topic with something similar:

    combining taxonomies help

    Assuming the conference ID and “proceeding type” are codes, you could use the Description field of the taxonomy term to store the full title for display purposes.

    You asked “Could it be possible to put the Conf_ID, Year and Seq_No. on other fields instead, e.g. caption, and still allowing MLA to filter and sort by these values?” You can use MLA’s mapping rules to extract IPTC, EXIF and XMP metadata from any fields your PDF tool supports and copy them to WordPress standard fields, taxonomy terms or custom fields. For example, the IPTC “Keywords” field can be used for taxonomy terms like year and ID. You can store them in any field that makes sense to you; MLA can map them to the right destination.

    I hope that gives you some good ideas for your application. If you have any problems or further questions, post an update and we can continue the dialog.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Secure PDF gallery’ is closed to new replies.