| 88 | | add_filter('post_text','bb_attachments_post_footer',4); |
|---|
| 89 | | add_filter( 'post_edit_uri', 'bb_attachments_link'); |
|---|
| 90 | | } else { |
|---|
| 91 | | if ($bb_attachments['title']) {add_filter('topic_title', 'bb_attachments_title',200);} |
|---|
| 92 | | } |
|---|
| 93 | | |
|---|
| 94 | | if ($bb_attachments['style']) {add_action('bb_head', 'bb_attachments_add_css');} // add css if present (including Kakumei 0.9.0.2 LI fix!) |
|---|
| 95 | | |
|---|
| 96 | | if (bb_current_user_can($bb_attachments['role']['upload'])) { |
|---|
| 97 | | add_action('post_edit_form','bb_attachments'); // auto-insert on post edit form |
|---|
| 98 | | |
|---|
| 99 | | if ($bb_attachments['upload_on_new']) { |
|---|
| 100 | | add_action('post_form','bb_attachments_upload_form'); // auto-insert on new post form |
|---|
| 101 | | add_action('pre_post_form','bb_attachments_enctype'); // multipart workaround on new post form |
|---|
| 102 | | |
|---|
| 103 | | // insane bbPress workaround - adds multipart enctype to the new post form via uri patch |
|---|
| 104 | | function bb_attachments_enctype() {add_filter( 'bb_get_option_uri','bb_attachments_uri',999);} |
|---|
| 105 | | function bb_attachments_uri($uri) {remove_filter( 'bb_get_option_uri','bb_attachments_uri',999); |
|---|
| 106 | | return $uri. 'bb-post.php" enctype="multipart/form-data" hack="';} |
|---|
| 107 | | } |
|---|
| 108 | | } |
|---|
| | 92 | add_filter('post_text', 'bb_attachments_post_footer',4); |
|---|
| | 93 | add_filter('post_edit_uri', 'bb_attachments_link'); |
|---|
| | 94 | |
|---|
| | 95 | if (bb_current_user_can($bb_attachments['role']['upload'])) { |
|---|
| | 96 | add_action('post_edit_form','bb_attachments'); // auto-insert on post edit form |
|---|
| | 97 | |
|---|
| | 98 | if ($bb_attachments['upload_on_new']) { |
|---|
| | 99 | add_action('post_form','bb_attachments_upload_form'); // auto-insert on new post form |
|---|
| | 100 | add_action('pre_post_form','bb_attachments_enctype'); // multipart workaround on new post form |
|---|
| | 101 | |
|---|
| | 102 | // insane bbPress workaround - adds multipart enctype to the new post form via uri patch |
|---|
| | 103 | function bb_attachments_enctype() {add_filter( 'bb_get_option_uri','bb_attachments_uri',999);} |
|---|
| | 104 | function bb_attachments_uri($uri) { |
|---|
| | 105 | // if (strpos($uri,'bb-post.php')===false) {return $uri;} |
|---|
| | 106 | remove_filter( 'bb_get_option_uri','bb_attachments_uri',999); |
|---|
| | 107 | return $uri. 'bb-post.php" enctype="multipart/form-data" hack="'; |
|---|
| | 108 | } |
|---|
| | 109 | } |
|---|
| | 110 | } |
|---|
| | 111 | } // end else |
|---|
| | 112 | |
|---|