Skip to:
Content
Pages
Categories
Search
Top
Bottom

bb-attachments modified nice permalink

  • in .htaccess add


    RewriteRule ^attachments/([^/]+)/download/([0-9]+)/inline/?$ /?bb_attachments=$1&bbat=$2&inline [L,QSA]
    RewriteRule ^attachments/([^/]+)/download/([0-9]+)/?$ /?bb_attachments=$1&bbat=$2 [L,QSA]

    in bb-attachments.php line 234 edit like this

    if ($attachment->status==0) {
    $output.=" "."<a href='".$uri."attachments/$attachment->post_id/download/$attachment->id/'>".$attachment->filename."</a> "." ";
    }

    in bb-attachments.php line 289

    if (file_exists($fullpath)) {	// it's been resized, so it's likely on AWS, show directly
    $aws=$bb_attachments['aws']['url'].$file->id.'.'.$file->filename;
    $replace="<a class='bb_attachments_link' href='".$uri."attachments/".$match[1]."/download/".$match[2]."'><img src='$aws' /></a>";
    if (is_bb_feed()) {$replace=wp_specialchars($replace);}
    $text=str_replace($match[0],$replace,$text);
    }

    in bb-attachments.php line 298

    http://pastebin.com/gDG523R2

    so now your attachments have permalink like this

    example.com/attachments/*postid*/download/*attachmentid*/

    and embed image url

    example.com/attachments/*postid*/download/*attachmentid*/inline/

    Related thread : http://bbpress.org/forums/topic/on-attachment-file-permalink

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