Skip to:
Content
Pages
Categories
Search
Top
Bottom

GD Attachments Archive


  • andyinspired
    Participant

    @andyinspired

    Hi,
    When using GD Attachments is there anyway to display an archive of files that have been attached to topics in a forum, perhaps arranged by topic?.

    The idea being there would be a kind of ‘Downloads’ page with all the forums files listed. I suspect this isn’t possible so I’m wondering if using something like the WP Download manager plugin could be integrated into the forum. The problem with that is I think it would have to be a seperate upload form and not part of a topics attachments.

    Are there any other plugins that could provide this functionality?.

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

  • Milan Petrovic
    Participant

    @gdragon

    Hi,

    I am the author of the GD bbPress Attachments plugin, and you are right, there is no such feature. But, all files are in the media library, so you can create your own template for a theme that can pull files attached to topics and forums and display them.

    A feature like that would be available in the GD bbPress Toolbox Pro plugin, most likely next month, but there are no plans to implement it in the free version.

    Regards,
    Milan


    andyinspired
    Participant

    @andyinspired

    Thank you, thats really helpful!


    andyinspired
    Participant

    @andyinspired

    I’ve been looking into this further, could you point me in the right direction for only displaying media files that are attached to Forum Topics/replies?

    Thanks.


    Milan Petrovic
    Participant

    @gdragon

    I can’t provide you with example code here (I don’t have anything written to use).

    The easiest way to do this is with WP_Query for ‘attachment’ post type having ‘_bbp_attachment’ meta with value ‘1’.

    Milan


    andyinspired
    Participant

    @andyinspired

    Thank you, thats just the advice I needed!


    andyinspired
    Participant

    @andyinspired

    ok, so far I have this code:

    function display_attachments() {
    $args = array(
        'post_type'   => 'attachment',
        'post_status' => 'inherit',      
        'meta_query'  => array(
            array(
                'key'     => '_bbp_attachment',
                'value'   => '1'
            )
        )
    );
    $query = new WP_Query($args);
    	
    	print_r($query);
    }	
    add_shortcode( 'display_attachments', 'display_attachments' );	

    This appears to output the whole SQL query as well as the attachment url string. Can you help?


    Milan Petrovic
    Participant

    @gdragon

    WP_Query doesn’t return the results, it is an object holding a lot of things, including the results. Check out how to use WP_Query for the loop, there are many examples on WordPress.org and elsewhere. And, results are also objects, so you need to create code to take the object and display the results.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Skip to toolbar