Forums

Join
bbPress Support ForumsPluginsbb-attachments modified nice permalink

Info

bb-attachments modified nice permalink

  1. 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

  2. I applied your modifications and it works but now my old images dont show up. How can i fix this?

  3. is your old image permalink like this ?
    xxx.com?bb_attachments=51644&bbat=8&inline

  4. can you show me your bbpress web?

  5. http://bit.ly/b28aAu

  6. hmm you not use the mod

  7. I placed just the backup back

    Otherwise i put

    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]

    oke now i modified the htaccess with that. Is that what you meant?

  8. this mod only edit the output result with new link but the old link still can be used. so i dont know about your error problem.

    to Moderator : move this topic to plugin section >.<

  9. You must log in to post.