• I have a problem with the attachments…. all attachments (no matter if they have an reply_id or not) are attached to the main topic_id

    <input id=”bbp_topic_id” type=”hidden” value=”122″ name=”bbp_topic_id”></input>
    <input id=”bbp_reply_to” type=”hidden” value=”0″ name=”bbp_reply_to”></input>
    for normal reply form in forum and
    <input id=”bbp_topic_id” type=”hidden” value=”122″ name=”bbp_topic_id”></input>
    <input id=”bbp_reply_to” type=”hidden” value=”3512″ name=”bbp_reply_to”></input>
    for replying to an existing reply.

    But if i understand your code correctly
    public function save_topic($topic_id, $forum_id, $anonymous_data, $topic_author) {
    $this->save_reply(0, $topic_id, $forum_id, $anonymous_data, $topic_author);
    }

    public function save_reply($reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author) {
    $uploads = array();
    you never use the reply_id to store attachments.

    I want to save attachments to the correct reply_id (post_parent = reply_id).
    And no additional attachment link should be created by your plugin if i use inline images (adding images from media library).

    Besides that great plugin !

    https://www.ads-software.com/plugins/gd-bbpress-attachments/

Viewing 1 replies (of 1 total)
  • Thread Starter Asrater

    (@asrater)

    Okay, found some problems within functions.php.

    Attachments are now linked to the correct post/reply…. also pictures, when i use already uploaded images from media library.

    When i want to upload new images to the media_library, the user needs the capability edit_others_topics otherwise he gets a “denied” (both his own and other topics/only participant).

    To deny that he edit other topics i have included a short code in to functions.php

    function sample_add_bbp_admin_link( $links, $args ) {
       $user = wp_get_current_user();
       $post = get_post( $id);
     if (!current_user_can( 'moderate', $topic->ID) AND $post->post_author != $user->ID ) {
    		$links = array();
    		$links = '<span class="bbp-admin-links" class="bbp-topic-reply-link"><a href="#new-post">Antwort</a></span>';
    	};
    
    	return $links;
    }
    add_filter( 'bbp_get_topic_admin_links', 'sample_add_bbp_admin_link', 10, 2 );

    This strips the edit button from admin links…

Viewing 1 replies (of 1 total)
  • The topic ‘Adding attachments to replies (not parent topic)’ is closed to new replies.