BuddyPress - Version 2.6.0-rc1

Version Description

= 2.5.1 = See: https://codex.buddypress.org/releases/version-2-5-1/

= 2.5 = See: https://codex.buddypress.org/releases/version-2-5-0/

= 2.4.3 = See: https://codex.buddypress.org/releases/version-2-4-3/

= 2.4.2 = See: https://codex.buddypress.org/releases/version-2-4-2/

= 2.4.1 = See: https://codex.buddypress.org/releases/version-2-4-1/

= 2.4 = See: https://codex.buddypress.org/releases/version-2-4-0/

= 2.3.5 = See: https://codex.buddypress.org/releases/version-2-3-5/

= 2.3.4 = See: https://codex.buddypress.org/releases/version-2-3-4/

= 2.3.3 = See: https://codex.buddypress.org/releases/version-2-3-3/

= 2.3.2 = See: https://codex.buddypress.org/releases/version-2-3-2/

= 2.3.1 = See: https://codex.buddypress.org/releases/version-2-3-1/

= 2.3.0 = See: https://codex.buddypress.org/releases/version-2-3-0/

= 2.2.3.1 = See: https://codex.buddypress.org/releases/version-2-2-3-1/

= 2.2.3 = See: https://codex.buddypress.org/releases/version-2-2-3/

= 2.2.2.1 = See: https://codex.buddypress.org/releases/version-2-2-2-1/

= 2.2.2 = See: https://codex.buddypress.org/releases/version-2-2-2/

= 2.2.1 = See: https://codex.buddypress.org/releases/version-2-2-1/

= 2.2 = See: https://codex.buddypress.org/releases/version-2-2/

= 2.1 = See: https://codex.buddypress.org/releases/version-2-1/

= 2.0.3 = See: https://codex.buddypress.org/releases/version-2-0-3/

= 2.0.2 = See: https://codex.buddypress.org/releases/version-2-0-2/

= 2.0.1 = See: https://codex.buddypress.org/releases/version-2-0-1/

= 2.0 = See: https://codex.buddypress.org/releases/version-2-0/

= 1.9.2 = See: https://codex.buddypress.org/releases/version-1-9-2/

= 1.9.1 = See: https://codex.buddypress.org/releases/version-1-9-1/

= 1.9 = See: https://codex.buddypress.org/releases/version-1-9/

= 1.8.1 = See: https://codex.buddypress.org/releases/version-1-8-1/

= 1.8 = See: https://codex.buddypress.org/releases/version-1-8/

= 1.7.3 = See: https://codex.buddypress.org/releases/version-1-7-3/

= 1.7.2 = See: https://codex.buddypress.org/releases/version-1-7-2/

= 1.7.1 = See: https://codex.buddypress.org/releases/version-1-7-1/

= 1.7 = See: https://codex.buddypress.org/releases/version-1-7/

= 1.6.5 = See: https://codex.buddypress.org/releases/version-1-6-5/

= 1.6.4 = See: https://codex.buddypress.org/releases/version-1-6-4/

= 1.6.3 = See: https://codex.buddypress.org/releases/version-1-6-3/

= 1.6.2 = Compatibility with WordPress 3.5

= 1.6.1 = Fixes 4 bugs

= 1.6 = See: https://codex.buddypress.org/releases/version-1-6/

= 1.5 = See: https://codex.buddypress.org/releases/version-1-5/

= 1.2.9 = Compatibility with WordPress 3.2

= 1.2.8 = Compatibility with WordPress 3.1

= 1.2.7 = Fixes over 10 bugs.

Download this release

Release Info

Developer dcavins
Plugin Icon 128x128 BuddyPress
Version 2.6.0-rc1
Comparing to
See all releases

Code changes from version 2.5.3 to 2.6.0-rc1

Files changed (291) hide show
  1. bp-activity/admin/js/admin.min.js +0 -1
  2. bp-activity/bp-activity-actions.php +0 -102
  3. bp-activity/bp-activity-admin.php +40 -10
  4. bp-activity/bp-activity-adminbar.php +47 -0
  5. bp-activity/bp-activity-akismet.php +3 -1
  6. bp-activity/bp-activity-classes.php +5 -0
  7. bp-activity/bp-activity-embeds.php +352 -0
  8. bp-activity/bp-activity-filters.php +39 -31
  9. bp-activity/bp-activity-functions.php +109 -160
  10. bp-activity/bp-activity-loader.php +3 -1
  11. bp-activity/bp-activity-notifications.php +180 -92
  12. bp-activity/bp-activity-screens.php +25 -63
  13. bp-activity/bp-activity-template.php +27 -268
  14. bp-activity/classes/class-bp-activity-activity.php +60 -8
  15. bp-activity/classes/class-bp-activity-component.php +16 -16
  16. bp-activity/classes/class-bp-activity-list-table.php +17 -7
  17. bp-activity/classes/class-bp-activity-oembed-extension.php +329 -0
  18. bp-activity/css/mentions-rtl.css +2 -3
  19. bp-activity/css/mentions-rtl.min.css +1 -1
  20. bp-activity/css/mentions.css +3 -3
  21. bp-activity/css/mentions.min.css +1 -1
  22. bp-activity/js/mentions.js +1 -1
  23. bp-activity/js/mentions.min.js +1 -2
  24. bp-blogs/bp-blogs-activity.php +125 -1
  25. bp-blogs/bp-blogs-filters.php +0 -1
  26. bp-blogs/bp-blogs-functions.php +118 -148
  27. bp-blogs/bp-blogs-loader.php +3 -1
  28. bp-blogs/bp-blogs-screens.php +3 -1
  29. bp-blogs/bp-blogs-template.php +34 -22
  30. bp-blogs/bp-blogs-widgets.php +3 -1
  31. bp-blogs/classes/class-bp-blogs-component.php +13 -2
  32. bp-blogs/classes/class-bp-blogs-recent-posts-widget.php +3 -2
  33. bp-core/admin/bp-core-admin-actions.php +0 -9
  34. bp-core/admin/bp-core-admin-components.php +27 -94
  35. bp-core/admin/bp-core-admin-functions.php +26 -18
  36. bp-core/admin/bp-core-admin-schema.php +0 -22
  37. bp-core/admin/bp-core-admin-settings.php +0 -16
  38. bp-core/admin/bp-core-admin-slugs.php +0 -1
  39. bp-core/admin/bp-core-admin-tools.php +25 -1
  40. bp-core/admin/css/common-rtl.css +169 -78
  41. bp-core/admin/css/common-rtl.min.css +1 -1
  42. bp-core/admin/css/common.css +169 -78
  43. bp-core/admin/css/common.min.css +1 -1
  44. bp-core/admin/images/activity-embeds.png +0 -0
  45. bp-core/admin/images/autolink-feature.png +0 -0
  46. bp-core/admin/images/bp-emails-feature.png +0 -0
  47. bp-core/admin/images/default-themes.png +0 -0
  48. bp-core/admin/images/emoji-feature.png +0 -0
  49. bp-core/admin/images/group-type-pop.png +0 -0
  50. bp-core/admin/images/new-nav-api.png +0 -0
  51. bp-core/admin/images/post-type.png +0 -0
  52. bp-core/admin/images/twentytwelve.png +0 -0
  53. bp-core/admin/images/user-frontpage.png +0 -0
  54. bp-core/admin/js/customizer-controls.min.js +0 -1
  55. bp-core/admin/js/customizer-receiver-emails.min.js +0 -1
  56. bp-core/bp-core-actions.php +2 -0
  57. bp-core/bp-core-admin.php +3 -2
  58. bp-core/bp-core-adminbar.php +0 -11
  59. bp-core/bp-core-attachments.php +1 -1
  60. bp-core/bp-core-avatars.php +58 -28
  61. bp-core/bp-core-buddybar.php +224 -158
  62. bp-core/bp-core-caps.php +0 -17
  63. bp-core/bp-core-catchuri.php +71 -7
  64. bp-core/bp-core-classes.php +8 -0
  65. bp-core/bp-core-component.php +3 -1
  66. bp-core/bp-core-cssjs.php +0 -2
  67. bp-core/bp-core-customizer-email.php +6 -4
  68. bp-core/bp-core-dependency.php +50 -29
  69. bp-core/bp-core-filters.php +0 -6
  70. bp-core/bp-core-functions.php +164 -64
  71. bp-core/bp-core-loader.php +4 -1
  72. bp-core/bp-core-moderation.php +28 -27
  73. bp-core/bp-core-options.php +0 -40
  74. bp-core/bp-core-taxonomy.php +55 -17
  75. bp-core/bp-core-template-loader.php +59 -15
  76. bp-core/bp-core-template.php +144 -106
  77. bp-core/bp-core-theme-compatibility.php +7 -31
  78. bp-core/bp-core-update.php +0 -18
  79. bp-core/bp-core-widgets.php +3 -1
  80. bp-core/classes/class-bp-admin.php +127 -61
  81. bp-core/classes/class-bp-attachment-avatar.php +0 -17
  82. bp-core/classes/class-bp-attachment.php +0 -14
  83. bp-core/classes/class-bp-component.php +2 -16
  84. bp-core/classes/class-bp-core-bp-nav-backcompat.php +270 -0
  85. bp-core/classes/class-bp-core-bp-options-nav-backcompat.php +138 -0
  86. bp-core/classes/class-bp-core-login-widget.php +3 -2
  87. bp-core/classes/class-bp-core-nav-item.php +34 -0
  88. bp-core/classes/class-bp-core-nav.php +402 -0
  89. bp-core/classes/class-bp-core-oembed-extension.php +616 -0
  90. bp-core/classes/class-bp-core-user.php +1 -13
  91. bp-core/classes/class-bp-core.php +6 -1
  92. bp-core/classes/class-bp-email-recipient.php +36 -13
  93. bp-core/classes/class-bp-embed.php +0 -9
  94. bp-core/classes/class-bp-user-query.php +3 -2
  95. bp-core/classes/class-bp-walker-category-checklist.php +1 -1
  96. bp-core/css/avatar-rtl.css +1 -1
  97. bp-core/css/avatar-rtl.min.css +1 -1
  98. bp-core/css/avatar.css +1 -1
  99. bp-core/css/avatar.min.css +1 -1
  100. bp-core/css/buddybar-rtl.css +3 -3
  101. bp-core/css/buddybar-rtl.min.css +1 -1
  102. bp-core/deprecated/1.2.php +0 -2
  103. bp-core/deprecated/1.7.php +0 -1
  104. bp-core/deprecated/2.6.php +50 -0
  105. bp-core/images/mystery-group-50.png +0 -0
  106. bp-core/images/mystery-group.png +0 -0
  107. bp-core/js/avatar.min.js +0 -1
  108. bp-core/js/bp-plupload.min.js +0 -1
  109. bp-core/js/confirm.min.js +0 -1
  110. bp-core/js/cover-image.min.js +0 -1
  111. bp-core/js/jquery-cookie.min.js +0 -1
  112. bp-core/js/jquery-query.min.js +0 -1
  113. bp-core/js/jquery-scroll-to.min.js +0 -1
  114. bp-core/js/jquery.atwho.min.js +0 -1
  115. bp-core/js/jquery.caret.min.js +0 -1
  116. bp-core/js/webcam.min.js +0 -1
  117. bp-core/js/widget-members.js +12 -1
  118. bp-core/js/widget-members.min.js +1 -2
  119. bp-forums/bp-forums-bbpress-sa.php +35 -0
  120. bp-forums/bp-forums-filters.php +12 -0
  121. bp-forums/bp-forums-functions.php +50 -0
  122. bp-forums/bp-forums-loader.php +11 -0
  123. bp-forums/bp-forums-screens.php +12 -0
  124. bp-forums/bp-forums-template.php +306 -9
  125. bp-forums/deprecated/1.6.php +12 -6
  126. bp-friends/bp-friends-activity.php +1 -1
  127. bp-friends/bp-friends-loader.php +3 -1
  128. bp-friends/bp-friends-notifications.php +1 -3
  129. bp-friends/bp-friends-screens.php +16 -4
  130. bp-friends/bp-friends-template.php +20 -14
  131. bp-friends/bp-friends-widgets.php +3 -1
  132. bp-friends/classes/class-bp-core-friends-widget.php +16 -5
  133. bp-friends/classes/class-bp-friends-component.php +28 -6
  134. bp-friends/classes/class-bp-friends-friendship.php +13 -9
  135. bp-friends/js/widget-friends.js +12 -1
  136. bp-friends/js/widget-friends.min.js +1 -2
  137. bp-groups/admin/js/admin.min.js +0 -1
  138. bp-groups/bp-groups-actions.php +21 -6
  139. bp-groups/bp-groups-activity.php +2 -1
  140. bp-groups/bp-groups-admin.php +113 -10
  141. bp-groups/bp-groups-adminbar.php +9 -9
  142. bp-groups/bp-groups-cache.php +41 -0
  143. bp-groups/bp-groups-filters.php +28 -1
  144. bp-groups/bp-groups-functions.php +592 -48
  145. bp-groups/bp-groups-loader.php +3 -1
  146. bp-groups/bp-groups-screens.php +54 -11
  147. bp-groups/bp-groups-template.php +95 -110
  148. bp-groups/bp-groups-widgets.php +3 -1
  149. bp-groups/classes/class-bp-group-extension.php +3 -3
  150. bp-groups/classes/class-bp-groups-component.php +63 -10
  151. bp-groups/classes/class-bp-groups-group.php +148 -107
  152. bp-groups/classes/class-bp-groups-list-table.php +13 -6
  153. bp-groups/classes/class-bp-groups-member.php +45 -0
  154. bp-groups/classes/class-bp-groups-template.php +35 -29
  155. bp-groups/classes/class-bp-groups-widget.php +15 -5
  156. bp-groups/js/widget-groups.js +12 -1
  157. bp-groups/js/widget-groups.min.js +1 -2
  158. bp-loader.php +128 -21
  159. bp-members/admin/css/admin-rtl.css +98 -8
  160. bp-members/admin/css/admin-rtl.min.css +1 -1
  161. bp-members/admin/css/admin.css +98 -8
  162. bp-members/admin/css/admin.min.css +1 -1
  163. bp-members/admin/js/admin.min.js +0 -1
  164. bp-members/bp-members-actions.php +4 -0
  165. bp-members/bp-members-activity.php +2 -2
  166. bp-members/bp-members-admin.php +3 -1
  167. bp-members/bp-members-adminbar.php +2 -2
  168. bp-members/bp-members-cache.php +1 -1
  169. bp-members/bp-members-filters.php +1 -1
  170. bp-members/bp-members-functions.php +94 -11
  171. bp-members/bp-members-loader.php +5 -1
  172. bp-members/bp-members-screens.php +14 -4
  173. bp-members/bp-members-template.php +332 -38
  174. bp-members/bp-members-widgets.php +5 -3
  175. bp-members/classes/class-bp-core-members-template.php +25 -0
  176. bp-members/classes/class-bp-core-members-widget.php +22 -7
  177. bp-members/classes/class-bp-core-recently-active-widget.php +11 -3
  178. bp-members/classes/class-bp-core-whos-online-widget.php +11 -3
  179. bp-members/classes/class-bp-members-admin.php +23 -8
  180. bp-members/classes/class-bp-members-component.php +116 -28
  181. bp-members/classes/class-bp-members-list-table.php +12 -9
  182. bp-members/classes/class-bp-members-ms-list-table.php +11 -8
  183. bp-members/classes/class-bp-signup.php +10 -0
  184. bp-messages/bp-messages-functions.php +6 -6
  185. bp-messages/bp-messages-loader.php +3 -1
  186. bp-messages/bp-messages-notifications.php +64 -21
  187. bp-messages/bp-messages-screens.php +12 -3
  188. bp-messages/bp-messages-template.php +30 -19
  189. bp-messages/bp-messages-widgets.php +3 -1
  190. bp-messages/classes/class-bp-messages-component.php +23 -4
  191. bp-messages/classes/class-bp-messages-sitewide-notices-widget.php +3 -2
  192. bp-messages/css/autocomplete/jquery.autocompletefb-rtl.css +2 -2
  193. bp-messages/css/autocomplete/jquery.autocompletefb-rtl.min.css +1 -1
  194. bp-messages/js/autocomplete/jquery.autocomplete.js +2 -1
  195. bp-messages/js/autocomplete/jquery.autocomplete.min.js +1 -2
  196. bp-messages/js/autocomplete/jquery.autocompletefb.js +1 -1
  197. bp-messages/js/autocomplete/jquery.autocompletefb.min.js +1 -2
  198. bp-messages/js/autocomplete/jquery.bgiframe.min.js +0 -1
  199. bp-messages/js/autocomplete/jquery.dimensions.min.js +0 -1
  200. bp-notifications/bp-notifications-functions.php +33 -14
  201. bp-notifications/bp-notifications-loader.php +3 -1
  202. bp-notifications/bp-notifications-template.php +204 -102
  203. bp-notifications/classes/class-bp-notifications-component.php +29 -4
  204. bp-notifications/classes/class-bp-notifications-notification.php +12 -1
  205. bp-settings/bp-settings-loader.php +3 -1
  206. bp-settings/bp-settings-template.php +8 -7
  207. bp-templates/bp-legacy/buddypress-functions.php +35 -62
  208. bp-templates/bp-legacy/buddypress/activity/entry.php +4 -1
  209. bp-templates/bp-legacy/buddypress/activity/post-form.php +8 -2
  210. bp-templates/bp-legacy/buddypress/assets/_attachments/uploader.php +4 -1
  211. bp-templates/bp-legacy/buddypress/assets/embeds/activity.php +11 -0
  212. bp-templates/bp-legacy/buddypress/assets/embeds/footer.php +9 -0
  213. bp-templates/bp-legacy/buddypress/assets/embeds/header-activity.php +26 -0
  214. bp-templates/bp-legacy/buddypress/assets/embeds/header.php +18 -0
  215. bp-templates/bp-legacy/buddypress/groups/create.php +4 -1
  216. bp-templates/bp-legacy/buddypress/groups/single/admin.php +20 -1
  217. bp-templates/bp-legacy/buddypress/groups/single/forum/edit.php +4 -1
  218. bp-templates/bp-legacy/buddypress/groups/single/forum/topic.php +4 -1
  219. bp-templates/bp-legacy/buddypress/groups/single/group-header.php +1 -1
  220. bp-templates/bp-legacy/buddypress/groups/single/requests-loop.php +22 -13
  221. bp-templates/bp-legacy/buddypress/members/single/home.php +4 -1
  222. bp-templates/bp-legacy/buddypress/members/single/messages/messages-loop.php +12 -3
  223. bp-templates/bp-legacy/buddypress/members/single/messages/single.php +5 -2
  224. bp-templates/bp-legacy/buddypress/members/single/notifications/notifications-loop.php +8 -2
  225. bp-templates/bp-legacy/buddypress/members/single/profile/change-avatar.php +4 -1
  226. bp-templates/bp-legacy/buddypress/members/single/settings/general.php +4 -1
  227. bp-templates/bp-legacy/css/buddypress-rtl.css +14 -3
  228. bp-templates/bp-legacy/css/buddypress-rtl.min.css +1 -1
  229. bp-templates/bp-legacy/css/buddypress.css +14 -3
  230. bp-templates/bp-legacy/css/buddypress.min.css +1 -1
  231. bp-templates/bp-legacy/css/embeds-activity-rtl.css +152 -0
  232. bp-templates/bp-legacy/css/embeds-activity-rtl.min.css +1 -0
  233. bp-templates/bp-legacy/css/embeds-activity.css +152 -0
  234. bp-templates/bp-legacy/css/embeds-activity.min.css +1 -0
  235. bp-templates/bp-legacy/css/twentyeleven-rtl.css +2025 -0
  236. bp-templates/bp-legacy/css/twentyeleven-rtl.min.css +1 -0
  237. bp-templates/bp-legacy/css/twentyeleven.css +2025 -0
  238. bp-templates/bp-legacy/css/twentyeleven.min.css +1 -0
  239. bp-templates/bp-legacy/css/twentyeleven.scss +2577 -0
  240. bp-templates/bp-legacy/css/twentysixteen-rtl.css +1 -1
  241. bp-templates/bp-legacy/css/twentysixteen-rtl.min.css +1 -1
  242. bp-templates/bp-legacy/css/twentysixteen.css +1 -1
  243. bp-templates/bp-legacy/css/twentysixteen.min.css +1 -1
  244. bp-templates/bp-legacy/css/twentysixteen.scss +1 -3
  245. bp-templates/bp-legacy/css/twentyten-rtl.css +1976 -0
  246. bp-templates/bp-legacy/css/twentyten-rtl.min.css +1 -0
  247. bp-templates/bp-legacy/css/twentyten.css +1976 -0
  248. bp-templates/bp-legacy/css/twentyten.min.css +1 -0
  249. bp-templates/bp-legacy/css/twentyten.scss +2478 -0
  250. bp-templates/bp-legacy/css/twentythirteen-rtl.css +1 -1
  251. bp-templates/bp-legacy/css/twentythirteen-rtl.min.css +1 -1
  252. bp-templates/bp-legacy/css/twentythirteen.css +1 -1
  253. bp-templates/bp-legacy/css/twentythirteen.min.css +1 -1
  254. bp-templates/bp-legacy/css/twentythirteen.scss +1 -1
  255. bp-templates/bp-legacy/css/twentytwelve-rtl.css +1 -1
  256. bp-templates/bp-legacy/css/twentytwelve-rtl.min.css +1 -1
  257. bp-templates/bp-legacy/css/twentytwelve.css +1 -1
  258. bp-templates/bp-legacy/css/twentytwelve.min.css +1 -1
  259. bp-templates/bp-legacy/css/twentytwelve.scss +1 -1
  260. bp-templates/bp-legacy/js/buddypress.js +32 -16
  261. bp-templates/bp-legacy/js/buddypress.min.js +2 -3
  262. bp-templates/bp-legacy/js/password-verify.min.js +0 -1
  263. bp-xprofile/admin/js/admin.min.js +0 -1
  264. bp-xprofile/bp-xprofile-actions.php +2 -2
  265. bp-xprofile/bp-xprofile-activity.php +0 -5
  266. bp-xprofile/bp-xprofile-admin.php +19 -10
  267. bp-xprofile/bp-xprofile-caps.php +0 -3
  268. bp-xprofile/bp-xprofile-filters.php +8 -9
  269. bp-xprofile/bp-xprofile-functions.php +54 -11
  270. bp-xprofile/bp-xprofile-loader.php +5 -1
  271. bp-xprofile/bp-xprofile-screens.php +6 -7
  272. bp-xprofile/bp-xprofile-settings.php +0 -2
  273. bp-xprofile/bp-xprofile-template.php +161 -22
  274. bp-xprofile/classes/class-bp-xprofile-component.php +16 -2
  275. bp-xprofile/classes/class-bp-xprofile-data-template.php +21 -0
  276. bp-xprofile/classes/class-bp-xprofile-field-type-checkbox.php +9 -6
  277. bp-xprofile/classes/class-bp-xprofile-field-type-datebox.php +68 -46
  278. bp-xprofile/classes/class-bp-xprofile-field-type-multiselectbox.php +4 -1
  279. bp-xprofile/classes/class-bp-xprofile-field-type-number.php +4 -1
  280. bp-xprofile/classes/class-bp-xprofile-field-type-radiobutton.php +11 -8
  281. bp-xprofile/classes/class-bp-xprofile-field-type-selectbox.php +4 -1
  282. bp-xprofile/classes/class-bp-xprofile-field-type-textbox.php +4 -1
  283. bp-xprofile/classes/class-bp-xprofile-field-type-url.php +4 -1
  284. bp-xprofile/classes/class-bp-xprofile-field-type.php +4 -1
  285. bp-xprofile/classes/class-bp-xprofile-field.php +18 -12
  286. bp-xprofile/classes/class-bp-xprofile-group.php +26 -8
  287. bp-xprofile/classes/class-bp-xprofile-meta-query.php +1 -4
  288. bp-xprofile/classes/class-bp-xprofile-profiledata.php +42 -2
  289. bp-xprofile/classes/class-bp-xprofile-user-admin.php +39 -17
  290. buddypress.pot +2116 -1874
  291. readme.txt +2 -2
bp-activity/admin/js/admin.min.js CHANGED
@@ -1,2 +1 @@
1
- /*! buddypress - v2.5.3 - 2016-05-24 5:17:45 PM UTC - https://wordpress.org/plugins/buddypress/ */
2
!function(a){var b={init:function(){a(document).on("click",".row-actions a.reply",b.open),a(document).on("click","#bp-activities-container a.cancel",b.close),a(document).on("click","#bp-activities-container a.save",b.send),a(document).on("keyup","#bp-activities:visible",function(a){27===a.which&&b.close()})},open:function(){var b=a("#bp-activities-container").hide();return a(this).parents("tr").after(b),b.fadeIn("300"),a("#bp-activities").focus(),!1},close:function(){return a("#bp-activities-container").fadeOut("200",function(){a("#bp-activities").val("").blur(),a("#bp-replysubmit .error").html("").hide(),a("#bp-replysubmit .waiting").hide()}),!1},send:function(){a("#bp-replysubmit .error").hide(),a("#bp-replysubmit .waiting").show();var c={};return c["_ajax_nonce-bp-activity-admin-reply"]=a('#bp-activities-container input[name="_ajax_nonce-bp-activity-admin-reply"]').val(),c.action="bp-activity-admin-reply",c.content=a("#bp-activities").val(),c.parent_id=a("#bp-activities-container").prev().data("parent_id"),c.root_id=a("#bp-activities-container").prev().data("root_id"),a.ajax({data:c,type:"POST",url:ajaxurl,error:function(a){b.error(a)},success:function(a){b.show(a)}}),!1},error:function(b){var c=b.statusText;a("#bp-replysubmit .waiting").hide(),b.responseText&&(c=b.responseText.replace(/<.[^<>]*?>/g,"")),c&&a("#bp-replysubmit .error").html(c).show()},show:function(c){var d,e,f;return"string"==typeof c?(b.error({responseText:c}),!1):(f=wpAjax.parseAjaxResponse(c),f.errors?(b.error({responseText:wpAjax.broken}),!1):(f=f.responses[0],void a("#bp-activities-container").fadeOut("200",function(){a("#bp-activities").val("").blur(),a("#bp-replysubmit .error").html("").hide(),a("#bp-replysubmit .waiting").hide(),a("#bp-activities-container").before(f.data),e=a("#activity-"+f.id),d=e.closest(".widefat").css("backgroundColor"),e.animate({backgroundColor:"#CEB"},300).animate({backgroundColor:d},300)})))}};a(document).ready(function(){b.init(),a("#bp_activity_action h3, #bp_activity_content h3").unbind("click"),"undefined"!=typeof postboxes&&postboxes.add_postbox_toggles(bp_activity_admin_vars.page)})}(jQuery);
1
!function(a){var b={init:function(){a(document).on("click",".row-actions a.reply",b.open),a(document).on("click","#bp-activities-container a.cancel",b.close),a(document).on("click","#bp-activities-container a.save",b.send),a(document).on("keyup","#bp-activities:visible",function(a){27===a.which&&b.close()})},open:function(){var b=a("#bp-activities-container").hide();return a(this).parents("tr").after(b),b.fadeIn("300"),a("#bp-activities").focus(),!1},close:function(){return a("#bp-activities-container").fadeOut("200",function(){a("#bp-activities").val("").blur(),a("#bp-replysubmit .error").html("").hide(),a("#bp-replysubmit .waiting").hide()}),!1},send:function(){a("#bp-replysubmit .error").hide(),a("#bp-replysubmit .waiting").show();var c={};return c["_ajax_nonce-bp-activity-admin-reply"]=a('#bp-activities-container input[name="_ajax_nonce-bp-activity-admin-reply"]').val(),c.action="bp-activity-admin-reply",c.content=a("#bp-activities").val(),c.parent_id=a("#bp-activities-container").prev().data("parent_id"),c.root_id=a("#bp-activities-container").prev().data("root_id"),a.ajax({data:c,type:"POST",url:ajaxurl,error:function(a){b.error(a)},success:function(a){b.show(a)}}),!1},error:function(b){var c=b.statusText;a("#bp-replysubmit .waiting").hide(),b.responseText&&(c=b.responseText.replace(/<.[^<>]*?>/g,"")),c&&a("#bp-replysubmit .error").html(c).show()},show:function(c){var d,e,f;return"string"==typeof c?(b.error({responseText:c}),!1):(f=wpAjax.parseAjaxResponse(c),f.errors?(b.error({responseText:wpAjax.broken}),!1):(f=f.responses[0],void a("#bp-activities-container").fadeOut("200",function(){a("#bp-activities").val("").blur(),a("#bp-replysubmit .error").html("").hide(),a("#bp-replysubmit .waiting").hide(),a("#bp-activities-container").before(f.data),e=a("#activity-"+f.id),d=e.closest(".widefat").css("backgroundColor"),e.animate({backgroundColor:"#CEB"},300).animate({backgroundColor:d},300)})))}};a(document).ready(function(){b.init(),a("#bp_activity_action h3, #bp_activity_content h3").unbind("click"),"undefined"!=typeof postboxes&&postboxes.add_postbox_toggles(bp_activity_admin_vars.page)})}(jQuery);
bp-activity/bp-activity-actions.php CHANGED
@@ -17,7 +17,6 @@ defined( 'ABSPATH' ) || exit;
17
*
18
* @since 1.2.0
19
*
20
- * @uses do_action() To call 'bp_register_activity_actions' hook.
21
*/
22
function bp_register_activity_actions() {
23
@@ -35,18 +34,6 @@ add_action( 'bp_init', 'bp_register_activity_actions', 8 );
35
*
36
* @since 1.2.0
37
*
38
- * @uses bp_is_activity_component()
39
- * @uses bp_is_current_action()
40
- * @uses bp_action_variable()
41
- * @uses bp_activity_get_specific()
42
- * @uses bp_is_active()
43
- * @uses bp_core_get_user_domain()
44
- * @uses groups_get_group()
45
- * @uses bp_get_group_permalink()
46
- * @uses apply_filters_ref_array() To call the 'bp_activity_permalink_redirect_url' hook.
47
- * @uses bp_core_redirect()
48
- * @uses bp_get_root_domain()
49
- *
50
* @return bool False on failure.
51
*/
52
function bp_activity_action_permalink_router() {
@@ -122,17 +109,6 @@ add_action( 'bp_actions', 'bp_activity_action_permalink_router' );
122
*
123
* @since 1.1.0
124
*
125
- * @uses bp_is_activity_component()
126
- * @uses bp_is_current_action()
127
- * @uses bp_action_variable()
128
- * @uses check_admin_referer()
129
- * @uses bp_activity_user_can_delete()
130
- * @uses do_action() Calls 'bp_activity_before_action_delete_activity' hook to allow actions to be taken before the activity is deleted.
131
- * @uses bp_activity_delete()
132
- * @uses bp_core_add_message()
133
- * @uses do_action() Calls 'bp_activity_action_delete_activity' hook to allow actions to be taken after the activity is deleted.
134
- * @uses bp_core_redirect()
135
- *
136
* @param int $activity_id Activity id to be deleted. Defaults to 0.
137
* @return bool False on failure.
138
*/
@@ -267,20 +243,6 @@ add_action( 'bp_actions', 'bp_activity_action_spam_activity' );
267
*
268
* @since 1.2.0
269
*
270
- * @uses is_user_logged_in()
271
- * @uses bp_is_activity_component()
272
- * @uses bp_is_current_action()
273
- * @uses check_admin_referer()
274
- * @uses apply_filters() To call 'bp_activity_post_update_content' hook.
275
- * @uses apply_filters() To call 'bp_activity_post_update_object' hook.
276
- * @uses apply_filters() To call 'bp_activity_post_update_item_id' hook.
277
- * @uses bp_core_add_message()
278
- * @uses bp_core_redirect()
279
- * @uses bp_activity_post_update()
280
- * @uses groups_post_update()
281
- * @uses bp_core_redirect()
282
- * @uses apply_filters() To call 'bp_activity_custom_update' hook.
283
- *
284
* @return bool False on failure.
285
*/
286
function bp_activity_action_post_update() {
@@ -371,17 +333,6 @@ add_action( 'bp_actions', 'bp_activity_action_post_update' );
371
*
372
* @since 1.2.0
373
*
374
- * @uses is_user_logged_in()
375
- * @uses bp_is_activity_component()
376
- * @uses bp_is_current_action()
377
- * @uses check_admin_referer()
378
- * @uses apply_filters() To call 'bp_activity_post_comment_activity_id' hook.
379
- * @uses apply_filters() To call 'bp_activity_post_comment_content' hook.
380
- * @uses bp_core_add_message()
381
- * @uses bp_core_redirect()
382
- * @uses bp_activity_new_comment()
383
- * @uses wp_get_referer()
384
- *
385
* @return bool False on failure.
386
*/
387
function bp_activity_action_post_comment() {
@@ -435,16 +386,6 @@ add_action( 'bp_actions', 'bp_activity_action_post_comment' );
435
*
436
* @since 1.2.0
437
*
438
- * @uses is_user_logged_in()
439
- * @uses bp_is_activity_component()
440
- * @uses bp_is_current_action()
441
- * @uses check_admin_referer()
442
- * @uses bp_activity_add_user_favorite()
443
- * @uses bp_action_variable()
444
- * @uses bp_core_add_message()
445
- * @uses bp_core_redirect()
446
- * @uses wp_get_referer()
447
- *
448
* @return bool False on failure.
449
*/
450
function bp_activity_action_mark_favorite() {
@@ -469,16 +410,6 @@ add_action( 'bp_actions', 'bp_activity_action_mark_favorite' );
469
*
470
* @since 1.2.0
471
*
472
- * @uses is_user_logged_in()
473
- * @uses bp_is_activity_component()
474
- * @uses bp_is_current_action()
475
- * @uses check_admin_referer()
476
- * @uses bp_activity_remove_user_favorite()
477
- * @uses bp_action_variable()
478
- * @uses bp_core_add_message()
479
- * @uses bp_core_redirect()
480
- * @uses wp_get_referer()
481
- *
482
* @return bool False on failure.
483
*/
484
function bp_activity_action_remove_favorite() {
@@ -503,11 +434,6 @@ add_action( 'bp_actions', 'bp_activity_action_remove_favorite' );
503
*
504
* @since 1.0.0
505
*
506
- * @uses bp_is_activity_component()
507
- * @uses bp_is_current_action()
508
- * @uses bp_is_user()
509
- * @uses status_header()
510
- *
511
* @return bool False on failure.
512
*/
513
function bp_activity_action_sitewide_feed() {
@@ -535,10 +461,6 @@ add_action( 'bp_actions', 'bp_activity_action_sitewide_feed' );
535
*
536
* @since 1.0.0
537
*
538
- * @uses bp_is_user_activity()
539
- * @uses bp_is_current_action()
540
- * @uses status_header()
541
- *
542
* @return bool False on failure.
543
*/
544
function bp_activity_action_personal_feed() {
@@ -565,13 +487,6 @@ add_action( 'bp_actions', 'bp_activity_action_personal_feed' );
565
*
566
* @since 1.0.0
567
*
568
- * @uses bp_is_active()
569
- * @uses bp_is_user_activity()
570
- * @uses bp_is_current_action()
571
- * @uses bp_get_friends_slug()
572
- * @uses bp_is_action_variable()
573
- * @uses status_header()
574
- *
575
* @return bool False on failure.
576
*/
577
function bp_activity_action_friends_feed() {
@@ -598,13 +513,6 @@ add_action( 'bp_actions', 'bp_activity_action_friends_feed' );
598
*
599
* @since 1.2.0
600
*
601
- * @uses bp_is_active()
602
- * @uses bp_is_user_activity()
603
- * @uses bp_is_current_action()
604
- * @uses bp_get_groups_slug()
605
- * @uses bp_is_action_variable()
606
- * @uses status_header()
607
- *
608
* @return bool False on failure.
609
*/
610
function bp_activity_action_my_groups_feed() {
@@ -639,11 +547,6 @@ add_action( 'bp_actions', 'bp_activity_action_my_groups_feed' );
639
*
640
* @since 1.2.0
641
*
642
- * @uses bp_is_user_activity()
643
- * @uses bp_is_current_action()
644
- * @uses bp_is_action_variable()
645
- * @uses status_header()
646
- *
647
* @return bool False on failure.
648
*/
649
function bp_activity_action_mentions_feed() {
@@ -676,11 +579,6 @@ add_action( 'bp_actions', 'bp_activity_action_mentions_feed' );
676
*
677
* @since 1.2.0
678
*
679
- * @uses bp_is_user_activity()
680
- * @uses bp_is_current_action()
681
- * @uses bp_is_action_variable()
682
- * @uses status_header()
683
- *
684
* @return bool False on failure.
685
*/
686
function bp_activity_action_favorites_feed() {
17
*
18
* @since 1.2.0
19
*
20
*/
21
function bp_register_activity_actions() {
22
34
*
35
* @since 1.2.0
36
*
37
* @return bool False on failure.
38
*/
39
function bp_activity_action_permalink_router() {
109
*
110
* @since 1.1.0
111
*
112
* @param int $activity_id Activity id to be deleted. Defaults to 0.
113
* @return bool False on failure.
114
*/
243
*
244
* @since 1.2.0
245
*
246
* @return bool False on failure.
247
*/
248
function bp_activity_action_post_update() {
333
*
334
* @since 1.2.0
335
*
336
* @return bool False on failure.
337
*/
338
function bp_activity_action_post_comment() {
386
*
387
* @since 1.2.0
388
*
389
* @return bool False on failure.
390
*/
391
function bp_activity_action_mark_favorite() {
410
*
411
* @since 1.2.0
412
*
413
* @return bool False on failure.
414
*/
415
function bp_activity_action_remove_favorite() {
434
*
435
* @since 1.0.0
436
*
437
* @return bool False on failure.
438
*/
439
function bp_activity_action_sitewide_feed() {
461
*
462
* @since 1.0.0
463
*
464
* @return bool False on failure.
465
*/
466
function bp_activity_action_personal_feed() {
487
*
488
* @since 1.0.0
489
*
490
* @return bool False on failure.
491
*/
492
function bp_activity_action_friends_feed() {
513
*
514
* @since 1.2.0
515
*
516
* @return bool False on failure.
517
*/
518
function bp_activity_action_my_groups_feed() {
547
*
548
* @since 1.2.0
549
*
550
* @return bool False on failure.
551
*/
552
function bp_activity_action_mentions_feed() {
579
*
580
* @since 1.2.0
581
*
582
* @return bool False on failure.
583
*/
584
function bp_activity_action_favorites_feed() {
bp-activity/bp-activity-admin.php CHANGED
@@ -16,7 +16,9 @@ defined( 'ABSPATH' ) || exit;
16
// Include WP's list table class.
17
if ( !class_exists( 'WP_List_Table' ) ) require( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
18
19
- require dirname( __FILE__ ) . '/classes/class-bp-activity-list-table.php';
20
21
// Per_page screen option. Has to be hooked in extremely early.
22
if ( is_admin() && ! empty( $_REQUEST['page'] ) && 'bp-activity' == $_REQUEST['page'] )
@@ -299,6 +301,7 @@ function bp_activity_admin_load() {
299
// Add accessible hidden heading and text for Activity screen pagination.
300
if ( bp_get_major_wp_version() >= 4.4 ) {
301
get_current_screen()->set_screen_reader_content( array(
302
'heading_pagination' => __( 'Activity list navigation', 'buddypress' ),
303
) );
304
}
@@ -576,9 +579,9 @@ function bp_activity_admin_load() {
576
577
// If an error occurred, pass back the activity ID that failed.
578
if ( $error )
579
- $redirect_to = add_query_arg( 'error', (int) $error, $redirect_to );
580
else
581
- $redirect_to = add_query_arg( 'updated', (int) $activity->id, $redirect_to );
582
583
/**
584
* Filters URL to redirect to after saving.
@@ -674,6 +677,10 @@ function bp_activity_admin_edit() {
674
<div id="bp_activity_action" class="postbox">
675
<h2><?php _e( 'Action', 'buddypress' ); ?></h2>
676
<div class="inside">
677
<?php wp_editor( stripslashes( $activity->action ), 'bp-activities-action', array( 'media_buttons' => false, 'textarea_rows' => 7, 'teeny' => true, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ) ) ); ?>
678
</div>
679
</div>
@@ -681,6 +688,10 @@ function bp_activity_admin_edit() {
681
<div id="bp_activity_content" class="postbox">
682
<h2><?php _e( 'Content', 'buddypress' ); ?></h2>
683
<div class="inside">
684
<?php wp_editor( stripslashes( $activity->content ), 'bp-activities-content', array( 'media_buttons' => false, 'teeny' => true, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ) ) ); ?>
685
</div>
686
</div>
@@ -704,10 +715,16 @@ function bp_activity_admin_edit() {
704
</form>
705
706
<?php else : ?>
707
- <p>
708
- <?php _e( 'No activity found with this ID.', 'buddypress' ); ?>
709
- <a href="<?php echo esc_url( bp_get_admin_url( 'admin.php?page=bp-activity' ) ); ?>"><?php _e( 'Go back and try again.', 'buddypress' ); ?></a>
710
- </p>
711
<?php endif; ?>
712
713
</div><!-- .wrap -->
@@ -781,7 +798,10 @@ function bp_activity_admin_edit_metabox_status( $item ) {
781
function bp_activity_admin_edit_metabox_link( $item ) {
782
?>
783
784
- <label class="screen-reader-text" for="bp-activities-link"><?php _e( 'Link', 'buddypress' ); ?></label>
785
<input type="url" name="bp-activities-link" id="bp-activities-link" value="<?php echo esc_url( $item->primary_link ); ?>" aria-describedby="bp-activities-link-description" />
786
<p id="bp-activities-link-description"><?php _e( 'Activity generated by posts and comments, forum topics and replies, and some plugins, uses the link field for a permalink back to the content item.', 'buddypress' ); ?></p>
787
@@ -798,7 +818,10 @@ function bp_activity_admin_edit_metabox_link( $item ) {
798
function bp_activity_admin_edit_metabox_userid( $item ) {
799
?>
800
801
- <label class="screen-reader-text" for="bp-activities-userid"><?php _e( 'Author ID', 'buddypress' ); ?></label>
802
<input type="number" name="bp-activities-userid" id="bp-activities-userid" value="<?php echo esc_attr( $item->user_id ); ?>" min="1" />
803
804
<?php
@@ -873,7 +896,10 @@ function bp_activity_admin_edit_metabox_type( $item ) {
873
874
?>
875
876
- <label for="bp-activities-type" class="screen-reader-text"><?php esc_html_e( 'Select activity type', 'buddypress' ); ?></label>
877
<select name="bp-activities-type" id="bp-activities-type">
878
<?php foreach ( $actions as $k => $v ) : ?>
879
<option value="<?php echo esc_attr( $k ); ?>" <?php selected( $k, $selected ); ?>><?php echo esc_html( $v ); ?></option>
@@ -1016,6 +1042,10 @@ function bp_activity_admin_index() {
1016
<form method="get" action="">
1017
1018
<h3 id="bp-replyhead"><?php _e( 'Reply to Activity', 'buddypress' ); ?></h3>
1019
<?php wp_editor( '', 'bp-activities', array( 'dfw' => false, 'media_buttons' => false, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ), 'tinymce' => false, ) ); ?>
1020
1021
<p id="bp-replysubmit" class="submit">
16
// Include WP's list table class.
17
if ( !class_exists( 'WP_List_Table' ) ) require( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
18
19
+ if ( ! buddypress()->do_autoload ) {
20
+ require dirname( __FILE__ ) . '/classes/class-bp-activity-list-table.php';
21
+ }
22
23
// Per_page screen option. Has to be hooked in extremely early.
24
if ( is_admin() && ! empty( $_REQUEST['page'] ) && 'bp-activity' == $_REQUEST['page'] )
301
// Add accessible hidden heading and text for Activity screen pagination.
302
if ( bp_get_major_wp_version() >= 4.4 ) {
303
get_current_screen()->set_screen_reader_content( array(
304
+ /* translators: accessibility text */
305
'heading_pagination' => __( 'Activity list navigation', 'buddypress' ),
306
) );
307
}
579
580
// If an error occurred, pass back the activity ID that failed.
581
if ( $error )
582
+ $redirect_to = add_query_arg( 'error', $error, $redirect_to );
583
else
584
+ $redirect_to = add_query_arg( 'updated', $activity->id, $redirect_to );
585
586
/**
587
* Filters URL to redirect to after saving.
677
<div id="bp_activity_action" class="postbox">
678
<h2><?php _e( 'Action', 'buddypress' ); ?></h2>
679
<div class="inside">
680
+ <label for="bp-activities-action" class="screen-reader-text"><?php
681
+ /* translators: accessibility text */
682
+ _e( 'Edit activity action', 'buddypress' );
683
+ ?></label>
684
<?php wp_editor( stripslashes( $activity->action ), 'bp-activities-action', array( 'media_buttons' => false, 'textarea_rows' => 7, 'teeny' => true, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ) ) ); ?>
685
</div>
686
</div>
688
<div id="bp_activity_content" class="postbox">
689
<h2><?php _e( 'Content', 'buddypress' ); ?></h2>
690
<div class="inside">
691
+ <label for="bp-activities-content" class="screen-reader-text"><?php
692
+ /* translators: accessibility text */
693
+ _e( 'Edit activity content', 'buddypress' );
694
+ ?></label>
695
<?php wp_editor( stripslashes( $activity->content ), 'bp-activities-content', array( 'media_buttons' => false, 'teeny' => true, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ) ) ); ?>
696
</div>
697
</div>
715
</form>
716
717
<?php else : ?>
718
+
719
+ <p><?php
720
+ printf(
721
+ '%1$s <a href="%2$s">%3$s</a>',
722
+ __( 'No activity found with this ID.', 'buddypress' ),
723
+ esc_url( bp_get_admin_url( 'admin.php?page=bp-activity' ) ),
724
+ __( 'Go back and try again.', 'buddypress' )
725
+ );
726
+ ?></p>
727
+
728
<?php endif; ?>
729
730
</div><!-- .wrap -->
798
function bp_activity_admin_edit_metabox_link( $item ) {
799
?>
800
801
+ <label class="screen-reader-text" for="bp-activities-link"><?php
802
+ /* translators: accessibility text */
803
+ _e( 'Link', 'buddypress' );
804
+ ?></label>
805
<input type="url" name="bp-activities-link" id="bp-activities-link" value="<?php echo esc_url( $item->primary_link ); ?>" aria-describedby="bp-activities-link-description" />
806
<p id="bp-activities-link-description"><?php _e( 'Activity generated by posts and comments, forum topics and replies, and some plugins, uses the link field for a permalink back to the content item.', 'buddypress' ); ?></p>
807
818
function bp_activity_admin_edit_metabox_userid( $item ) {
819
?>
820
821
+ <label class="screen-reader-text" for="bp-activities-userid"><?php
822
+ /* translators: accessibility text */
823
+ _e( 'Author ID', 'buddypress' );
824
+ ?></label>
825
<input type="number" name="bp-activities-userid" id="bp-activities-userid" value="<?php echo esc_attr( $item->user_id ); ?>" min="1" />
826
827
<?php
896
897
?>
898
899
+ <label for="bp-activities-type" class="screen-reader-text"><?php
900
+ /* translators: accessibility text */
901
+ esc_html_e( 'Select activity type', 'buddypress' );
902
+ ?></label>
903
<select name="bp-activities-type" id="bp-activities-type">
904
<?php foreach ( $actions as $k => $v ) : ?>
905
<option value="<?php echo esc_attr( $k ); ?>" <?php selected( $k, $selected ); ?>><?php echo esc_html( $v ); ?></option>
1042
<form method="get" action="">
1043
1044
<h3 id="bp-replyhead"><?php _e( 'Reply to Activity', 'buddypress' ); ?></h3>
1045
+ <label for="bp-activities" class="screen-reader-text"><?php
1046
+ /* translators: accessibility text */
1047
+ _e( 'Reply', 'buddypress' );
1048
+ ?></label>
1049
<?php wp_editor( '', 'bp-activities', array( 'dfw' => false, 'media_buttons' => false, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ), 'tinymce' => false, ) ); ?>
1050
1051
<p id="bp-replysubmit" class="submit">
bp-activity/bp-activity-adminbar.php ADDED
@@ -0,0 +1,47 @@
1
+ <?php
2
+ /**
3
+ * BuddyPress Activity Toolbar.
4
+ *
5
+ * Handles the activity functions related to the WordPress Toolbar.
6
+ *
7
+ * @package BuddyPress
8
+ * @subpackage Activity
9
+ */
10
+
11
+ // Exit if accessed directly.
12
+ defined( 'ABSPATH' ) || exit;
13
+
14
+ /**
15
+ * Add the Activity top-level menu link when viewing single activity item.
16
+ *
17
+ * @since 2.6.0
18
+ *
19
+ * @return null Null if user does not have access to editing functionality.
20
+ */
21
+ function bp_activity_admin_menu() {
22
+ global $wp_admin_bar;
23
+
24
+ // Only show if viewing a single activity item.
25
+ if ( ! bp_is_single_activity() ) {
26
+ return;
27
+ }
28
+
29
+ // Only show this menu to super admins
30
+ if ( ! bp_current_user_can( 'bp_moderate' ) ) {
31
+ return;
32
+ }
33
+
34
+ $activity_edit_link = add_query_arg( array(
35
+ 'page' => 'bp-activity',
36
+ 'aid' => bp_current_action(),
37
+ 'action' => 'edit'
38
+ ), bp_get_admin_url( 'admin.php' ) );
39
+
40
+ // Add the top-level Edit Activity button.
41
+ $wp_admin_bar->add_menu( array(
42
+ 'id' => 'activity-admin',
43
+ 'title' => __( 'Edit Activity', 'buddypress' ),
44
+ 'href' => esc_url( $activity_edit_link ),
45
+ ) );
46
+ }
47
+ add_action( 'admin_bar_menu', 'bp_activity_admin_menu', 99 );
bp-activity/bp-activity-akismet.php CHANGED
@@ -10,7 +10,9 @@
10
// Exit if accessed directly.
11
defined( 'ABSPATH' ) || exit;
12
13
- require dirname( __FILE__ ) . '/classes/class-bp-akismet.php';
14
15
/**
16
* Delete old spam activity meta data.
10
// Exit if accessed directly.
11
defined( 'ABSPATH' ) || exit;
12
13
+ if ( ! buddypress()->do_autoload ) {
14
+ require dirname( __FILE__ ) . '/classes/class-bp-akismet.php';
15
+ }
16
17
/**
18
* Delete old spam activity meta data.
bp-activity/bp-activity-classes.php CHANGED
@@ -13,3 +13,8 @@ defined( 'ABSPATH' ) || exit;
13
require dirname( __FILE__ ) . '/classes/class-bp-activity-activity.php';
14
require dirname( __FILE__ ) . '/classes/class-bp-activity-feed.php';
15
require dirname( __FILE__ ) . '/classes/class-bp-activity-query.php';
13
require dirname( __FILE__ ) . '/classes/class-bp-activity-activity.php';
14
require dirname( __FILE__ ) . '/classes/class-bp-activity-feed.php';
15
require dirname( __FILE__ ) . '/classes/class-bp-activity-query.php';
16
+
17
+ // Embeds - only applicable for WP 4.5+
18
+ if ( version_compare( $GLOBALS['wp_version'], '4.5', '>=' ) && bp_is_active( 'activity', 'embeds' ) ) {
19
+ require dirname( __FILE__ ) . '/classes/class-bp-activity-oembed-extension.php';
20
+ }
bp-activity/bp-activity-embeds.php ADDED
@@ -0,0 +1,352 @@
1
+ <?php
2
+ /**
3
+ * Functions related to embedding single activity items externally.
4
+ *
5
+ * Relies on WordPress 4.5.
6
+ *
7
+ * @since 2.6.0
8
+ *
9
+ * @package BuddyPress
10
+ * @subpackage ActivityEmbeds
11
+ */
12
+
13
+ // Exit if accessed directly.
14
+ defined( 'ABSPATH' ) || exit;
15
+
16
+ /**
17
+ * Loads our activity oEmbed component.
18
+ *
19
+ * @since 2.6.0
20
+ */
21
+ function bp_activity_setup_oembed() {
22
+ if ( version_compare( $GLOBALS['wp_version'], '4.5', '>=' ) && bp_is_active( 'activity', 'embeds' ) ) {
23
+ buddypress()->activity->oembed = new BP_Activity_oEmbed_Extension;
24
+ }
25
+ }
26
+ add_action( 'bp_loaded', 'bp_activity_setup_oembed' );
27
+
28
+ /**
29
+ * Catch links in embed excerpt so top.location.href can be added.
30
+ *
31
+ * Due to <iframe sandbox="allow-top-navigation">, links in embeds can only be
32
+ * clicked if invoked with top.location.href via JS.
33
+ *
34
+ * @since 2.6.0
35
+ *
36
+ * @param string $text Embed excerpt
37
+ * @return string
38
+ */
39
+ function bp_activity_embed_excerpt_onclick_location_filter( $text ) {
40
+ return preg_replace_callback( '/<a\s+[^>]*href=\"([^\"]*)\"/iU', 'bp_activity_embed_excerpt_onclick_location_filter_callback', $text );
41
+ }
42
+ /**
43
+ * Add onclick="top.location.href" to a link.
44
+ *
45
+ * @since 2.6.0
46
+ *
47
+ * @param array $matches Items matched by bp_activity_embed_excerpt_onclick_location_filter().
48
+ * @return string
49
+ */
50
+ function bp_activity_embed_excerpt_onclick_location_filter_callback( $matches ) {
51
+ return sprintf( '<a href="%1$s" onclick="top.location.href=\'%1$s\'"', $matches[1] );
52
+ }
53
+
54
+ /**
55
+ * Add inline styles for BP activity embeds.
56
+ *
57
+ * @since 2.6.0
58
+ */
59
+ function bp_activity_embed_add_inline_styles() {
60
+ if ( false === bp_is_single_activity() ) {
61
+ return;
62
+ }
63
+
64
+ $min = bp_core_get_minified_asset_suffix();
65
+
66
+ if ( is_rtl() ) {
67
+ $css = bp_locate_template_asset( "css/embeds-activity-rtl{$min}.css" );
68
+ } else {
69
+ $css = bp_locate_template_asset( "css/embeds-activity{$min}.css" );
70
+ }
71
+
72
+ // Bail if file wasn't found.
73
+ if ( false === $css ) {
74
+ return;
75
+ }
76
+
77
+ // Grab contents of CSS file and do some rudimentary CSS protection.
78
+ $css = file_get_contents( $css['file'] );
79
+ $css = wp_kses( $css, array( "\'", '\"' ) );
80
+
81
+ printf( '<style type="text/css">%s</style>', $css );
82
+ }
83
+ add_action( 'embed_head', 'bp_activity_embed_add_inline_styles', 20 );
84
+
85
+ /**
86
+ * Query for the activity item on the activity embed template.
87
+ *
88
+ * Basically a wrapper for {@link bp_has_activities()}, but allows us to
89
+ * use the activity loop without requerying for it again.
90
+ *
91
+ * @since 2.6.0
92
+ *
93
+ * @param int $activity_id The activity ID.
94
+ * @return bool
95
+ */
96
+ function bp_activity_embed_has_activity( $activity_id = 0 ) {
97
+ global $activities_template;
98
+
99
+ if ( empty( $activity_id ) ) {
100
+ return false;
101
+ }
102
+
103
+ if ( ! empty( $activities_template->activities ) ) {
104
+ $activity = (array) $activities_template->activities;
105
+ $activity = reset( $activity );
106
+
107
+ // No need to requery if we already got the embed activity
108
+ if ( (int) $activity_id === $activity->id ) {
109
+ return $activities_template->has_activities();
110
+ }
111
+ }
112
+
113
+ return bp_has_activities( array(
114
+ 'display_comments' => 'threaded',
115
+ 'show_hidden' => true,
116
+ 'include' => (int) $activity_id,
117
+ ) );
118
+ }
119
+
120
+ /**
121
+ * Outputs excerpt for an activity embed item.
122
+ *
123
+ * @since 2.6.0
124
+ */
125
+ function bp_activity_embed_excerpt( $content = '' ) {
126
+ echo bp_activity_get_embed_excerpt( $content = '' );
127
+ }
128
+
129
+ /**
130
+ * Generates excerpt for an activity embed item.
131
+ *
132
+ * @since 2.6.0
133
+ *
134
+ * @param string $content The content to generate an excerpt for.
135
+ * @return string
136
+ */
137
+ function bp_activity_get_embed_excerpt( $content = '' ) {
138
+ if ( empty( $content ) && ! empty( $GLOBALS['activities_template']->in_the_loop ) ) {
139
+ $content = $GLOBALS['activities_template']->activity->content;
140
+ }
141
+
142
+ /*
143
+ * bp_activity_truncate_entry() includes the 'Read More' link, which is why
144
+ * we're using this instead of bp_create_excerpt().
145
+ */
146
+ $content = html_entity_decode( $content );
147
+ $content = bp_activity_truncate_entry( $content, array(
148
+ 'html' => false,
149
+ 'filter_shortcodes' => true,
150
+ 'strip_tags' => true,
151
+ 'force_truncate' => true
152
+ ) );
153
+
154
+ /**
155
+ * Filter the activity embed excerpt.
156
+ *
157
+ * @since 2.6.0
158
+ *
159
+ * @var string $content Embed Excerpt.
160
+ * @var string $unmodified_content Unmodified activity content.
161
+ */
162
+ return apply_filters( 'bp_activity_get_embed_excerpt', $content, $GLOBALS['activities_template']->activity->content );
163
+ }
164
+
165
+ /**
166
+ * Outputs the first embedded item in the activity oEmbed template.
167
+ *
168
+ * @since 2.6.0
169
+ */
170
+ function bp_activity_embed_media() {
171
+ // Bail if oEmbed request explicitly hides media.
172
+ if ( isset( $_GET['hide_media'] ) && true == wp_validate_boolean( $_GET['hide_media'] ) ) {
173
+ /**
174
+ * Do something after media is rendered for an activity oEmbed item.
175
+ *
176
+ * @since 2.6.0
177
+ */
178
+ do_action( 'bp_activity_embed_after_media' );
179
+
180
+ return;
181
+ }
182
+
183
+ /**
184
+ * Should we display media in the oEmbed template?
185
+ *
186
+ * @since 2.6.0
187
+ *
188
+ * @param bool $retval Defaults to true.
189
+ */
190
+ $allow_media = apply_filters( 'bp_activity_embed_display_media', true );
191
+
192
+ // Find oEmbeds from only WP registered providers.
193
+ bp_remove_all_filters( 'oembed_providers' );
194
+ $media = bp_core_extract_media_from_content( $GLOBALS['activities_template']->activity->content, 'embeds' );
195
+ bp_restore_all_filters( 'oembed_providers' );
196
+
197
+ // oEmbeds have precedence over inline video / audio.
198
+ if ( isset( $media['embeds'] ) && true === $allow_media ) {
199
+ // Autoembed first URL.
200
+ $oembed_defaults = wp_embed_defaults();
201
+ $oembed_args = array(
202
+ 'width' => $oembed_defaults['width'],
203
+ 'height' => $oembed_defaults['height'],
204
+ 'discover' => true
205
+ );
206
+ $url = $media['embeds'][0]['url'];
207
+ $cachekey = '_oembed_response_' . md5( $url . serialize( $oembed_args ) );
208
+
209
+ // Try to fetch oEmbed response from meta.
210
+ $oembed = bp_activity_get_meta( bp_get_activity_id(), $cachekey );
211
+
212
+ // No cache, so fetch full oEmbed response now!
213
+ if ( '' === $oembed ) {
214
+ $o = _wp_oembed_get_object();
215
+ $oembed = $o->fetch( $o->get_provider( $url, $oembed_args ), $url, $oembed_args );
216
+
217
+ // Cache oEmbed response.
218
+ bp_activity_update_meta( bp_get_activity_id(), $cachekey, $oembed );
219
+ }
220
+
221
+ $content = '';
222
+
223
+ /**
224
+ * Filters the default embed display max width.
225
+ *
226
+ * This is used if the oEmbed response does not return a thumbnail width.
227
+ *
228
+ * @since 2.6.0
229
+ *
230
+ * @param int $width.
231
+ */
232
+ $width = (int) apply_filters( 'bp_activity_embed_display_media_width', 550 );
233
+
234
+ // Set thumbnail.
235
+ if ( 'photo' === $oembed->type ) {
236
+ $thumbnail = $oembed->url;
237
+ } elseif ( isset( $oembed->thumbnail_url ) ) {
238
+ $thumbnail = $oembed->thumbnail_url;
239
+
240
+ /* Non-oEmbed standard attributes */
241
+ // Mixcloud
242
+ } elseif ( isset( $oembed->image ) ) {
243
+ $thumbnail = $oembed->image;
244
+ // ReverbNation
245
+ } elseif ( isset( $oembed->{'thumbnail-url'} ) ) {
246
+ $thumbnail = $oembed->{'thumbnail-url'};
247
+ }
248
+
249
+ // Display thumb and related oEmbed meta.
250
+ if ( true === isset ( $thumbnail ) ) {
251
+ $play_icon = $caption = '';
252
+
253
+ // Add play icon for non-photos.
254
+ if ( 'photo' !== $oembed->type ) {
255
+ /**
256
+ * ion-play icon from Ionicons.
257
+ *
258
+ * @link http://ionicons.com/
259
+ * @license MIT
260
+ */
261
+ $play_icon = <<<EOD
262
+ <svg id="Layer_1" style="enable-background:new 0 0 512 512;" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M405.2,232.9L126.8,67.2c-3.4-2-6.9-3.2-10.9-3.2c-10.9,0-19.8,9-19.8,20H96v344h0.1c0,11,8.9,20,19.8,20 c4.1,0,7.5-1.4,11.2-3.4l278.1-165.5c6.6-5.5,10.8-13.8,10.8-23.1C416,246.7,411.8,238.5,405.2,232.9z"/></svg>
263
+ EOD;
264
+
265
+ $play_icon = sprintf( '<a rel="nofollow" class="play-btn" href="%1$s" onclick="top.location.href=\'%1$s\'">%2$s</a>', esc_url( $url ), $play_icon );
266
+ }
267
+
268
+ // Thumb width
269
+ $thumb_width = isset( $oembed->thumbnail_width ) && 'photo' !== $oembed->type && (int) $oembed->thumbnail_width < 550 ? (int) $oembed->thumbnail_width : $width;
270
+
271
+ $float_width = 350;
272
+
273
+ // Set up thumb.
274
+ $content = sprintf( '<div class="thumb" style="max-width:%1$spx">%2$s<a href="%3$s" rel="nofollow" onclick="top.location.href=\'%3$s\'"><img src="%4$s" /></a></div>', $thumb_width, $play_icon, esc_url( $url ), esc_url( $thumbnail ) );
275
+
276
+ // Show title.
277
+ if ( isset( $oembed->title ) ) {
278
+ $caption .= sprintf( '<p class="caption-title"><strong>%s</strong></p>', apply_filters( 'single_post_title', $oembed->title ) );
279
+ }
280
+
281
+ // Show description (non-oEmbed standard)
282
+ if ( isset( $oembed->description ) ) {
283
+ $caption .= sprintf( '<div class="caption-description">%s</div>', apply_filters( 'bp_activity_get_embed_excerpt', $oembed->description ) );
284
+ }
285
+
286
+ // Show author info.
287
+ if ( isset( $oembed->provider_name ) && isset( $oembed->author_name ) ) {
288
+ /* translators: By [oEmbed author] on [oEmbed provider]. eg. By BuddyPress on YouTube. */
289
+ $anchor_text = sprintf( __( 'By %1$s on %2$s', 'buddypress' ), $oembed->author_name, $oembed->provider_name );
290
+
291
+ } elseif ( isset( $oembed->provider_name ) ) {
292
+ $anchor_text = sprintf( __( 'View on %s', 'buddypress' ), $oembed->provider_name );
293
+ }
294
+
295
+ if ( true === isset( $anchor_text ) ) {
296
+ $caption .= sprintf( '<a rel="nofollow" href="%1$s" onclick="top.location.href=\'%1$s\'">%2$s</a>', esc_url( $url ), apply_filters( 'the_title', $anchor_text ) );
297
+ }
298
+
299
+ // Set up caption.
300
+ if ( '' !== $caption ) {
301
+ $css_class = isset( $oembed->provider_name ) ? sprintf( ' provider-%s', sanitize_html_class( strtolower( $oembed->provider_name ) ) ) : '';
302
+ $caption = sprintf( '<div class="caption%1$s" style="width:%2$s">%3$s</div>',
303
+ $css_class,
304
+ $thumb_width > $float_width ? 100 . '%' : round( ( $width - (int) $thumb_width ) / $width * 100 ) . '%',
305
+ $caption
306
+ );
307
+
308
+ $content .= $caption;
309
+ }
310
+ }
311
+
312
+ // Print rich content.
313
+ if ( '' !== $content ) {
314
+ printf( '<div class="bp-activity-embed-display-media %s" style="max-width:%spx">%s</div>',
315
+ $thumb_width < $float_width ? 'two-col' : 'one-col',
316
+ $thumb_width < $float_width ? $width : $thumb_width,
317
+ $content
318
+ );
319
+ }
320
+
321
+ // Video / audio.
322
+ } elseif ( true === $allow_media ) {
323
+ // Call BP_Embed if it hasn't already loaded.
324
+ bp_embed_init();
325
+
326
+ // Run shortcode and embed routine.
327
+ $content = buddypress()->embed->run_shortcode( $GLOBALS['activities_template']->activity->content );
328
+ $content = buddypress()->embed->autoembed( $content );
329
+
330
+ // Try to find inline video / audio.
331
+ $media = bp_core_extract_media_from_content( $content, 96 );
332
+
333
+ // Video takes precedence. HTML5-only.
334
+ if ( isset( $media['videos'] ) && 'shortcodes' === $media['videos'][0]['source'] ) {
335
+ printf( '<video controls preload="metadata"><source src="%1$s"><p>%2$s</p></video>',
336
+ esc_url( $media['videos'][0]['url'] ),
337
+ esc_html__( 'Your browser does not support HTML5 video', 'buddypress' )
338
+ );
339
+
340
+ // No video? Try audio. HTML5-only.
341
+ } elseif ( isset( $media['audio'] ) && 'shortcodes' === $media['audio'][0]['source'] ) {
342
+ printf( '<audio controls preload="metadata"><source src="%1$s"><p>%2$s</p></audio>',
343
+ esc_url( $media['audio'][0]['url'] ),
344
+ esc_html__( 'Your browser does not support HTML5 audio', 'buddypress' )
345
+ );
346
+ }
347
+
348
+ }
349
+
350
+ /** This hook is documented in /bp-activity/bp-activity-embeds.php */
351
+ do_action( 'bp_activity_embed_after_media' );
352
+ }
bp-activity/bp-activity-filters.php CHANGED
@@ -43,6 +43,7 @@ add_filter( 'bp_get_activity_content', 'wptexturize' );
43
add_filter( 'bp_get_activity_parent_content', 'wptexturize' );
44
add_filter( 'bp_get_activity_latest_update', 'wptexturize' );
45
add_filter( 'bp_get_activity_latest_update_excerpt', 'wptexturize' );
46
47
add_filter( 'bp_get_activity_action', 'convert_smilies' );
48
add_filter( 'bp_get_activity_content_body', 'convert_smilies' );
@@ -50,6 +51,7 @@ add_filter( 'bp_get_activity_content', 'convert_smilies' );
50
add_filter( 'bp_get_activity_parent_content', 'convert_smilies' );
51
add_filter( 'bp_get_activity_latest_update', 'convert_smilies' );
52
add_filter( 'bp_get_activity_latest_update_excerpt', 'convert_smilies' );
53
54
add_filter( 'bp_get_activity_action', 'convert_chars' );
55
add_filter( 'bp_get_activity_content_body', 'convert_chars' );
@@ -57,11 +59,13 @@ add_filter( 'bp_get_activity_content', 'convert_chars' );
57
add_filter( 'bp_get_activity_parent_content', 'convert_chars' );
58
add_filter( 'bp_get_activity_latest_update', 'convert_chars' );
59
add_filter( 'bp_get_activity_latest_update_excerpt', 'convert_chars' );
60
61
add_filter( 'bp_get_activity_action', 'wpautop' );
62
add_filter( 'bp_get_activity_content_body', 'wpautop' );
63
add_filter( 'bp_get_activity_content', 'wpautop' );
64
add_filter( 'bp_get_activity_feed_item_description', 'wpautop' );
65
66
add_filter( 'bp_get_activity_action', 'make_clickable', 9 );
67
add_filter( 'bp_get_activity_content_body', 'make_clickable', 9 );
@@ -70,6 +74,7 @@ add_filter( 'bp_get_activity_parent_content', 'make_clickable', 9 );
70
add_filter( 'bp_get_activity_latest_update', 'make_clickable', 9 );
71
add_filter( 'bp_get_activity_latest_update_excerpt', 'make_clickable', 9 );
72
add_filter( 'bp_get_activity_feed_item_description', 'make_clickable', 9 );
73
74
add_filter( 'bp_acomment_name', 'stripslashes_deep', 5 );
75
add_filter( 'bp_get_activity_action', 'stripslashes_deep', 5 );
@@ -94,6 +99,7 @@ add_filter( 'pre_comment_content', 'bp_activity_at_name_filter
94
add_filter( 'group_forum_topic_text_before_save', 'bp_activity_at_name_filter' );
95
add_filter( 'group_forum_post_text_before_save', 'bp_activity_at_name_filter' );
96
add_filter( 'the_content', 'bp_activity_at_name_filter' );
97
98
add_filter( 'bp_get_activity_parent_content', 'bp_create_excerpt' );
99
@@ -103,6 +109,8 @@ add_filter( 'bp_get_activity_content', 'bp_activity_truncate_entry', 5 );
103
add_filter( 'bp_get_total_favorite_count_for_user', 'bp_core_number_format' );
104
add_filter( 'bp_get_total_mention_count_for_user', 'bp_core_number_format' );
105
106
/* Actions *******************************************************************/
107
108
// At-name filter.
@@ -147,13 +155,19 @@ function bp_activity_get_moderated_activity_types() {
147
function bp_activity_check_moderation_keys( $activity ) {
148
149
// Only check specific types of activity updates.
150
- if ( !in_array( $activity->type, bp_activity_get_moderated_activity_types() ) )
151
return;
152
153
- // Unset the activity component so activity stream update fails
154
// @todo This is temporary until some kind of moderation is built.
155
- if ( !bp_core_check_for_moderation( $activity->user_id, '', $activity->content ) )
156
$activity->component = false;
157
}
158
159
/**
@@ -166,12 +180,19 @@ function bp_activity_check_moderation_keys( $activity ) {
166
function bp_activity_check_blacklist_keys( $activity ) {
167
168
// Only check specific types of activity updates.
169
- if ( ! in_array( $activity->type, bp_activity_get_moderated_activity_types() ) )
170
return;
171
172
- // Mark as spam.
173
- if ( ! bp_core_check_for_blacklist( $activity->user_id, '', $activity->content ) )
174
- bp_activity_mark_as_spam( $activity, 'by_blacklist' );
175
}
176
177
/**
@@ -179,9 +200,6 @@ function bp_activity_check_blacklist_keys( $activity ) {
179
*
180
* @since 1.1.0
181
*
182
- * @uses apply_filters() To call the 'bp_activity_allowed_tags' hook.
183
- * @uses wp_kses()
184
- *
185
* @param string $content The activity content.
186
* @return string $content Filtered activity content.
187
*/
@@ -282,8 +300,6 @@ function bp_activity_at_name_filter( $content, $activity_id = 0 ) {
282
*
283
* @since 1.5.0
284
*
285
- * @uses bp_activity_find_mentions()
286
- *
287
* @param BP_Activity_Activity $activity Activity Object.
288
*/
289
function bp_activity_at_name_filter_updates( $activity ) {
@@ -319,9 +335,6 @@ function bp_activity_at_name_filter_updates( $activity ) {
319
*
320
* @since 1.7.0
321
*
322
- * @uses bp_activity_at_message_notification()
323
- * @uses bp_activity_update_mention_count_for_user()
324
- *
325
* @param BP_Activity_Activity $activity The BP_Activity_Activity object.
326
*/
327
function bp_activity_at_name_send_emails( $activity ) {
@@ -395,19 +408,16 @@ function bp_activity_make_nofollow_filter( $text ) {
395
* This method can only be used inside the Activity loop.
396
*
397
* @since 1.5.0
398
- *
399
- * @uses bp_is_single_activity()
400
- * @uses apply_filters() To call the 'bp_activity_excerpt_append_text' hook.
401
- * @uses apply_filters() To call the 'bp_activity_excerpt_length' hook.
402
- * @uses bp_create_excerpt()
403
- * @uses bp_get_activity_id()
404
- * @uses bp_get_activity_thread_permalink()
405
- * @uses apply_filters() To call the 'bp_activity_truncate_entry' hook.
406
*
407
* @param string $text The original activity entry text.
408
* @return string $excerpt The truncated text.
409
*/
410
- function bp_activity_truncate_entry( $text ) {
411
global $activities_template;
412
413
/**
@@ -423,7 +433,7 @@ function bp_activity_truncate_entry( $text ) {
423
);
424
425
// The full text of the activity update should always show on the single activity screen.
426
- if ( ! $maybe_truncate_text || bp_is_single_activity() ) {
427
return $text;
428
}
429
@@ -445,15 +455,17 @@ function bp_activity_truncate_entry( $text ) {
445
*/
446
$excerpt_length = apply_filters( 'bp_activity_excerpt_length', 358 );
447
448
// Run the text through the excerpt function. If it's too short, the original text will be returned.
449
- $excerpt = bp_create_excerpt( $text, $excerpt_length, array( 'ending' => __( '&hellip;', 'buddypress' ) ) );
450
451
/*
452
* If the text returned by bp_create_excerpt() is different from the original text (ie it's
453
* been truncated), add the "Read More" link. Note that bp_create_excerpt() is stripping
454
* shortcodes, so we have strip them from the $text before the comparison.
455
*/
456
- if ( $excerpt != strip_shortcodes( $text ) ) {
457
$id = !empty( $activities_template->activity->current_comment->id ) ? 'acomment-read-more-' . $activities_template->activity->current_comment->id : 'activity-read-more-' . bp_get_activity_id();
458
459
$excerpt = sprintf( '%1$s<span class="activity-read-more" id="%2$s"><a href="%3$s" rel="nofollow">%4$s</a></span>', $excerpt, $id, bp_get_activity_thread_permalink(), $append_text );
@@ -476,8 +488,6 @@ function bp_activity_truncate_entry( $text ) {
476
*
477
* @since 2.0.0
478
*
479
- * @uses bp_activity_do_heartbeat() to check if heartbeat is required.
480
- *
481
* @param array $js_handles The original dependencies.
482
* @return array $js_handles The new dependencies.
483
*/
@@ -543,8 +553,6 @@ add_filter( 'bp_get_activity_css_class', 'bp_activity_timestamp_class', 9, 1 );
543
*
544
* @since 2.0.0
545
*
546
- * @uses bp_activity_get_last_updated() to get the recorded date of the last activity.
547
- *
548
* @param array $response Array containing Heartbeat API response.
549
* @param array $data Array containing data for Heartbeat API response.
550
* @return array $response
43
add_filter( 'bp_get_activity_parent_content', 'wptexturize' );
44
add_filter( 'bp_get_activity_latest_update', 'wptexturize' );
45
add_filter( 'bp_get_activity_latest_update_excerpt', 'wptexturize' );
46
+ add_filter( 'bp_activity_get_embed_excerpt', 'wptexturize' );
47
48
add_filter( 'bp_get_activity_action', 'convert_smilies' );
49
add_filter( 'bp_get_activity_content_body', 'convert_smilies' );
51
add_filter( 'bp_get_activity_parent_content', 'convert_smilies' );
52
add_filter( 'bp_get_activity_latest_update', 'convert_smilies' );
53
add_filter( 'bp_get_activity_latest_update_excerpt', 'convert_smilies' );
54
+ add_filter( 'bp_activity_get_embed_excerpt', 'convert_smilies' );
55
56
add_filter( 'bp_get_activity_action', 'convert_chars' );
57
add_filter( 'bp_get_activity_content_body', 'convert_chars' );
59
add_filter( 'bp_get_activity_parent_content', 'convert_chars' );
60
add_filter( 'bp_get_activity_latest_update', 'convert_chars' );
61
add_filter( 'bp_get_activity_latest_update_excerpt', 'convert_chars' );
62
+ add_filter( 'bp_activity_get_embed_excerpt', 'convert_chars' );
63
64
add_filter( 'bp_get_activity_action', 'wpautop' );
65
add_filter( 'bp_get_activity_content_body', 'wpautop' );
66
add_filter( 'bp_get_activity_content', 'wpautop' );
67
add_filter( 'bp_get_activity_feed_item_description', 'wpautop' );
68
+ add_filter( 'bp_activity_get_embed_excerpt', 'wpautop' );
69
70
add_filter( 'bp_get_activity_action', 'make_clickable', 9 );
71
add_filter( 'bp_get_activity_content_body', 'make_clickable', 9 );
74
add_filter( 'bp_get_activity_latest_update', 'make_clickable', 9 );
75
add_filter( 'bp_get_activity_latest_update_excerpt', 'make_clickable', 9 );
76
add_filter( 'bp_get_activity_feed_item_description', 'make_clickable', 9 );
77
+ add_filter( 'bp_activity_get_embed_excerpt', 'make_clickable', 9 );
78
79
add_filter( 'bp_acomment_name', 'stripslashes_deep', 5 );
80
add_filter( 'bp_get_activity_action', 'stripslashes_deep', 5 );
99
add_filter( 'group_forum_topic_text_before_save', 'bp_activity_at_name_filter' );
100
add_filter( 'group_forum_post_text_before_save', 'bp_activity_at_name_filter' );
101
add_filter( 'the_content', 'bp_activity_at_name_filter' );
102
+ add_filter( 'bp_activity_get_embed_excerpt', 'bp_activity_at_name_filter' );
103
104
add_filter( 'bp_get_activity_parent_content', 'bp_create_excerpt' );
105
109
add_filter( 'bp_get_total_favorite_count_for_user', 'bp_core_number_format' );
110
add_filter( 'bp_get_total_mention_count_for_user', 'bp_core_number_format' );
111
112
+ add_filter( 'bp_activity_get_embed_excerpt', 'bp_activity_embed_excerpt_onclick_location_filter', 9 );
113
+
114
/* Actions *******************************************************************/
115
116
// At-name filter.
155
function bp_activity_check_moderation_keys( $activity ) {
156
157
// Only check specific types of activity updates.
158
+ if ( ! in_array( $activity->type, bp_activity_get_moderated_activity_types() ) ) {
159
return;
160
+ }
161
162
+ // Send back the error so activity update fails.
163
// @todo This is temporary until some kind of moderation is built.
164
+ $moderate = bp_core_check_for_moderation( $activity->user_id, '', $activity->content, 'wp_error' );
165
+ if ( is_wp_error( $moderate ) ) {
166
+ $activity->errors = $moderate;
167
+
168
+ // Backpat.
169
$activity->component = false;
170
+ }
171
}
172
173
/**
180
function bp_activity_check_blacklist_keys( $activity ) {
181
182
// Only check specific types of activity updates.
183
+ if ( ! in_array( $activity->type, bp_activity_get_moderated_activity_types() ) ) {
184
return;
185
+ }
186
+
187
+ // Send back the error so activity update fails.
188
+ // @todo This is temporary until some kind of trash status is built.
189
+ $blacklist = bp_core_check_for_blacklist( $activity->user_id, '', $activity->content, 'wp_error' );
190
+ if ( is_wp_error( $blacklist ) ) {
191
+ $activity->errors = $blacklist;
192
193
+ // Backpat.
194
+ $activity->component = false;
195
+ }
196
}
197
198
/**
200
*
201
* @since 1.1.0
202
*
203
* @param string $content The activity content.
204
* @return string $content Filtered activity content.
205
*/
300
*
301
* @since 1.5.0
302
*
303
* @param BP_Activity_Activity $activity Activity Object.
304
*/
305
function bp_activity_at_name_filter_updates( $activity ) {
335
*
336
* @since 1.7.0
337
*
338
* @param BP_Activity_Activity $activity The BP_Activity_Activity object.
339
*/
340
function bp_activity_at_name_send_emails( $activity ) {
408
* This method can only be used inside the Activity loop.
409
*
410
* @since 1.5.0
411
+ * @since 2.6.0 Added $args parameter.
412
*
413
* @param string $text The original activity entry text.
414
+ * @param array $args {
415
+ * Optional parameters. See $options argument of {@link bp_create_excerpt()}
416
+ * for all available parameters.
417
+ * }
418
* @return string $excerpt The truncated text.
419
*/
420
+ function bp_activity_truncate_entry( $text, $args = array() ) {
421
global $activities_template;
422
423
/**
433
);
434
435
// The full text of the activity update should always show on the single activity screen.
436
+ if ( empty( $args['force_truncate'] ) && ( ! $maybe_truncate_text || bp_is_single_activity() ) ) {
437
return $text;
438
}
439
455
*/
456
$excerpt_length = apply_filters( 'bp_activity_excerpt_length', 358 );
457
458
+ $args = wp_parse_args( $args, array( 'ending' => __( '&hellip;', 'buddypress' ) ) );
459
+
460
// Run the text through the excerpt function. If it's too short, the original text will be returned.
461
+ $excerpt = bp_create_excerpt( $text, $excerpt_length, $args );
462
463
/*
464
* If the text returned by bp_create_excerpt() is different from the original text (ie it's
465
* been truncated), add the "Read More" link. Note that bp_create_excerpt() is stripping
466
* shortcodes, so we have strip them from the $text before the comparison.
467
*/
468
+ if ( strlen( $excerpt ) < strlen( strip_shortcodes( $text ) ) ) {
469
$id = !empty( $activities_template->activity->current_comment->id ) ? 'acomment-read-more-' . $activities_template->activity->current_comment->id : 'activity-read-more-' . bp_get_activity_id();
470
471
$excerpt = sprintf( '%1$s<span class="activity-read-more" id="%2$s"><a href="%3$s" rel="nofollow">%4$s</a></span>', $excerpt, $id, bp_get_activity_thread_permalink(), $append_text );
488
*
489
* @since 2.0.0
490
*
491
* @param array $js_handles The original dependencies.
492
* @return array $js_handles The new dependencies.
493
*/
553
*
554
* @since 2.0.0
555
*
556
* @param array $response Array containing Heartbeat API response.
557
* @param array $data Array containing data for Heartbeat API response.
558
* @return array $response
bp-activity/bp-activity-functions.php CHANGED
@@ -40,8 +40,6 @@ function bp_activity_has_directory() {
40
*
41
* @since 1.8.0
42
*
43
- * @uses apply_filters() To call 'bp_activity_do_mentions' hook.
44
- *
45
* @return bool $retval True to enable mentions, false to disable.
46
*/
47
function bp_activity_do_mentions() {
@@ -133,8 +131,6 @@ function bp_activity_find_mentions( $content ) {
133
*
134
* @since 1.5.0
135
*
136
- * @uses bp_delete_user_meta()
137
- *
138
* @param int $user_id The id of the user whose unread mentions are being reset.
139
*/
140
function bp_activity_clear_new_mentions( $user_id ) {
@@ -161,9 +157,6 @@ function bp_activity_clear_new_mentions( $user_id ) {
161
*
162
* @since 1.5.0
163
*
164
- * @uses bp_activity_find_mentions()
165
- * @uses bp_activity_update_mention_count_for_user()
166
- *
167
* @param int $activity_id The unique id for the activity item.
168
* @param string $action Can be 'delete' or 'add'. Defaults to 'add'.
169
* @return bool
@@ -176,7 +169,7 @@ function bp_activity_adjust_mention_count( $activity_id = 0, $action = 'add' ) {
176
}
177
178
// Get activity object.
179
- $activity = new BP_Activity_Activity( (int) $activity_id );
180
181
// Try to find mentions.
182
$usernames = bp_activity_find_mentions( strip_tags( $activity->content ) );
@@ -200,9 +193,6 @@ function bp_activity_adjust_mention_count( $activity_id = 0, $action = 'add' ) {
200
*
201
* @since 1.7.0
202
*
203
- * @uses bp_get_user_meta()
204
- * @uses bp_update_user_meta()
205
- *
206
* @param int $user_id The user ID.
207
* @param int $activity_id The unique ID for the activity item.
208
* @param string $action 'delete' or 'add'. Default: 'add'.
@@ -787,8 +777,6 @@ function bp_activity_get_actions() {
787
*
788
* @since 1.1.0
789
*
790
- * @uses apply_filters() To call the 'bp_activity_get_action' hook.
791
- *
792
* @param string $component_id The unique string ID of the component.
793
* @param string $key The action key.
794
* @return string|bool Action value if found, otherwise false.
@@ -858,9 +846,6 @@ function bp_activity_get_types() {
858
*
859
* @since 1.2.0
860
*
861
- * @uses bp_get_user_meta()
862
- * @uses apply_filters() To call the 'bp_activity_get_user_favorites' hook.
863
- *
864
* @param int $user_id ID of the user whose favorites are being queried.
865
* @return array IDs of the user's favorite activity items.
866
*/
@@ -889,14 +874,6 @@ function bp_activity_get_user_favorites( $user_id = 0 ) {
889
*
890
* @since 1.2.0
891
*
892
- * @uses is_user_logged_in()
893
- * @uses bp_get_user_meta()
894
- * @uses bp_activity_get_meta()
895
- * @uses bp_update_user_meta()
896
- * @uses bp_activity_update_meta()
897
- * @uses do_action() To call the 'bp_activity_add_user_favorite' hook.
898
- * @uses do_action() To call the 'bp_activity_add_user_favorite_fail' hook.
899
- *
900
* @param int $activity_id ID of the activity item being favorited.
901
* @param int $user_id ID of the user favoriting the activity item.
902
* @return bool True on success, false on failure.
@@ -971,13 +948,6 @@ function bp_activity_add_user_favorite( $activity_id, $user_id = 0 ) {
971
*
972
* @since 1.2.0
973
*
974
- * @uses is_user_logged_in()
975
- * @uses bp_get_user_meta()
976
- * @uses bp_activity_get_meta()
977
- * @uses bp_activity_update_meta()
978
- * @uses bp_update_user_meta()
979
- * @uses do_action() To call the 'bp_activity_remove_user_favorite' hook.
980
- *
981
* @param int $activity_id ID of the activity item being unfavorited.
982
* @param int $user_id ID of the user unfavoriting the activity item.
983
* @return bool True on success, false on failure.
@@ -1050,9 +1020,6 @@ function bp_activity_remove_user_favorite( $activity_id, $user_id = 0 ) {
1050
*
1051
* @since 1.1.0
1052
*
1053
- * @uses BP_Activity_Activity::check_exists_by_content() {@link BP_Activity_Activity}
1054
- * @uses apply_filters() To call the 'bp_activity_check_exists_by_content' hook.
1055
- *
1056
* @param string $content The content to filter by.
1057
* @return int|null The ID of the located activity item. Null if none is found.
1058
*/
@@ -1063,7 +1030,7 @@ function bp_activity_check_exists_by_content( $content ) {
1063
*
1064
* @since 1.1.0
1065
*
1066
- * @param BP_Activity_Activity $content_exists ID of the activity if found, else null.
1067
*/
1068
return apply_filters( 'bp_activity_check_exists_by_content', BP_Activity_Activity::check_exists_by_content( $content ) );
1069
}
@@ -1073,9 +1040,6 @@ function bp_activity_check_exists_by_content( $content ) {
1073
*
1074
* @since 1.0.0
1075
*
1076
- * @uses BP_Activity_Activity::get_last_updated() {@link BP_Activity_Activity}
1077
- * @uses apply_filters() To call the 'bp_activity_get_last_updated' hook.
1078
- *
1079
* @return string Date last updated.
1080
*/
1081
function bp_activity_get_last_updated() {
@@ -1095,8 +1059,6 @@ function bp_activity_get_last_updated() {
1095
*
1096
* @since 1.2.0
1097
*
1098
- * @uses BP_Activity_Activity::total_favorite_count() {@link BP_Activity_Activity}
1099
- *
1100
* @param int $user_id ID of the user whose favorite count is being requested.
1101
* @return int Total favorite count for the user.
1102
*/
@@ -1160,8 +1122,6 @@ function bp_activity_delete_meta( $activity_id, $meta_key = '', $meta_value = ''
1160
*
1161
* @since 1.2.0
1162
*
1163
- * @uses apply_filters() To call the 'bp_activity_get_meta' hook.
1164
- *
1165
* @param int $activity_id ID of the activity item whose metadata is being requested.
1166
* @param string $meta_key Optional. If present, only the metadata matching
1167
* that meta key will be returned. Otherwise, all metadata for the
@@ -1239,12 +1199,6 @@ function bp_activity_add_meta( $activity_id, $meta_key, $meta_value, $unique = f
1239
*
1240
* @since 1.5.0
1241
*
1242
- * @uses is_user_logged_in()
1243
- * @uses bp_activity_delete()
1244
- * @uses bp_delete_user_meta()
1245
- * @uses do_action() To call the 'bp_activity_remove_data' hook.
1246
- * @uses do_action() To call the 'bp_activity_remove_all_user_data' hook.
1247
- *
1248
* @param int $user_id ID of the user whose activity is being deleted.
1249
* @return bool
1250
*/
@@ -1671,11 +1625,6 @@ function bp_activity_format_activity_action_custom_post_type_comment( $action, $
1671
*
1672
* @see BP_Activity_Activity::get() For more information on accepted arguments
1673
* and the format of the returned value.
1674
- * @uses wp_parse_args()
1675
- * @uses wp_cache_get()
1676
- * @uses wp_cache_set()
1677
- * @uses BP_Activity_Activity::get() {@link BP_Activity_Activity}
1678
- * @uses apply_filters_ref_array() To call the 'bp_activity_get' hook.
1679
*
1680
* @param array|string $args See BP_Activity_Activity::get() for description.
1681
* @return array $activity See BP_Activity_Activity::get() for description.
@@ -1782,9 +1731,6 @@ function bp_activity_get( $args = '' ) {
1782
* @since 1.2.0
1783
*
1784
* @see BP_Activity_Activity::get() For more information on accepted arguments.
1785
- * @uses wp_parse_args()
1786
- * @uses apply_filters() To call the 'bp_activity_get_specific' hook.
1787
- * @uses BP_Activity_Activity::get() {@link BP_Activity_Activity}
1788
*
1789
* @param array|string $args {
1790
* All arguments and defaults are shared with BP_Activity_Activity::get(),
@@ -1836,12 +1782,7 @@ function bp_activity_get_specific( $args = '' ) {
1836
* Add an activity item.
1837
*
1838
* @since 1.1.0
1839
- *
1840
- * @uses wp_parse_args()
1841
- * @uses BP_Activity_Activity::save() {@link BP_Activity_Activity}
1842
- * @uses BP_Activity_Activity::rebuild_activity_comment_tree() {@link BP_Activity_Activity}
1843
- * @uses wp_cache_delete()
1844
- * @uses do_action() To call the 'bp_activity_add' hook.
1845
*
1846
* @param array|string $args {
1847
* An array of arguments.
@@ -1873,6 +1814,7 @@ function bp_activity_get_specific( $args = '' ) {
1873
* @type bool $hide_sitewide Should the item be hidden on sitewide streams?
1874
* Default: false.
1875
* @type bool $is_spam Should the item be marked as spam? Default: false.
1876
* }
1877
* @return int|bool The ID of the activity on success. False on error.
1878
*/
@@ -1891,6 +1833,7 @@ function bp_activity_add( $args = '' ) {
1891
'recorded_time' => bp_core_current_time(), // The GMT time that this activity was recorded.
1892
'hide_sitewide' => false, // Should this be hidden on the sitewide activity stream?
1893
'is_spam' => false, // Is this activity item to be marked as spam?
1894
), 'activity_add' );
1895
1896
// Make sure we are backwards compatible.
@@ -1914,11 +1857,16 @@ function bp_activity_add( $args = '' ) {
1914
$activity->date_recorded = $r['recorded_time'];
1915
$activity->hide_sitewide = $r['hide_sitewide'];
1916
$activity->is_spam = $r['is_spam'];
1917
$activity->action = ! empty( $r['action'] )
1918
- ? $r['action']
1919
- : bp_activity_generate_action_string( $activity );
1920
1921
- if ( ! $activity->save() ) {
1922
return false;
1923
}
1924
@@ -1949,17 +1897,6 @@ function bp_activity_add( $args = '' ) {
1949
*
1950
* @since 1.2.0
1951
*
1952
- * @uses wp_parse_args()
1953
- * @uses bp_is_user_inactive()
1954
- * @uses bp_core_get_userlink()
1955
- * @uses bp_activity_add()
1956
- * @uses apply_filters() To call the 'bp_activity_new_update_action' hook.
1957
- * @uses apply_filters() To call the 'bp_activity_new_update_content' hook.
1958
- * @uses apply_filters() To call the 'bp_activity_new_update_primary_link' hook.
1959
- * @uses bp_update_user_meta()
1960
- * @uses wp_filter_kses()
1961
- * @uses do_action() To call the 'bp_activity_posted_update' hook.
1962
- *
1963
* @param array|string $args {
1964
* @type string $content The content of the activity update.
1965
* @type int $user_id Optional. Defaults to the logged-in user.
@@ -1969,8 +1906,9 @@ function bp_activity_add( $args = '' ) {
1969
function bp_activity_post_update( $args = '' ) {
1970
1971
$r = wp_parse_args( $args, array(
1972
- 'content' => false,
1973
- 'user_id' => bp_loggedin_user_id()
1974
) );
1975
1976
if ( empty( $r['content'] ) || !strlen( trim( $r['content'] ) ) ) {
@@ -2010,8 +1948,14 @@ function bp_activity_post_update( $args = '' ) {
2010
'primary_link' => $add_primary_link,
2011
'component' => buddypress()->activity->id,
2012
'type' => 'activity_update',
2013
) );
2014
2015
/**
2016
* Filters the latest update content for the activity item.
2017
*
@@ -2304,10 +2248,9 @@ function bp_activity_post_type_unpublish( $post_id = 0, $post = null ) {
2304
*
2305
* @since 2.5.0
2306
*
2307
- * @param int $comment_id ID of the comment.
2308
- * @param bool $is_approved Whether the comment is approved or not.
2309
- * @param object $activity_post_object the post type tracking args object.
2310
- *
2311
* @return int|bool The ID of the activity on success. False on error.
2312
*/
2313
function bp_activity_post_type_comment( $comment_id = 0, $is_approved = true, $activity_post_object = null ) {
@@ -2497,9 +2440,8 @@ add_action( 'edit_comment', 'bp_activity_post_type_comment', 10 );
2497
*
2498
* @since 2.5.0
2499
*
2500
- * @param int $comment_id ID of the comment.
2501
- * @param object $activity_post_object The post type tracking args object.
2502
- *
2503
* @return bool True on success. False on error.
2504
*/
2505
function bp_activity_post_type_remove_comment( $comment_id = 0, $activity_post_object = null ) {
@@ -2564,15 +2506,10 @@ add_action( 'delete_comment', 'bp_activity_post_type_remove_comment', 10, 1 );
2564
* @since 1.2.0
2565
* @since 2.5.0 Add a new possible parameter $skip_notification for the array of arguments.
2566
* Add the $primary_link parameter for the array of arguments.
2567
- *
2568
- * @uses wp_parse_args()
2569
- * @uses bp_activity_add()
2570
- * @uses apply_filters() To call the 'bp_activity_comment_action' hook.
2571
- * @uses apply_filters() To call the 'bp_activity_comment_content' hook.
2572
- * @uses wp_cache_delete()
2573
- * @uses do_action() To call the 'bp_activity_comment_posted' hook.
2574
*
2575
* @param array|string $args {
2576
* @type int $id Optional. Pass an ID to update an existing comment.
2577
* @type string $content The content of the comment.
2578
* @type int $user_id Optional. The ID of the user making the comment.
@@ -2586,17 +2523,12 @@ add_action( 'delete_comment', 'bp_activity_post_type_remove_comment', 10, 1 );
2586
* Defaults to an empty string.
2587
* @type bool $skip_notification Optional. false to send a comment notification, false otherwise.
2588
* Defaults to false.
2589
* }
2590
* @return int|bool The ID of the comment on success, otherwise false.
2591
*/
2592
function bp_activity_new_comment( $args = '' ) {
2593
- $bp = buddypress();
2594
- $errors = new WP_Error();
2595
- $feedback = __( 'There was an error posting your reply. Please try again.', 'buddypress' );
2596
-
2597
- if ( empty( $bp->activity->errors ) ) {
2598
- $bp->activity->errors = array();
2599
- }
2600
2601
$r = wp_parse_args( $args, array(
2602
'id' => false,
@@ -2606,14 +2538,31 @@ function bp_activity_new_comment( $args = '' ) {
2606
'parent_id' => false, // ID of a parent comment (optional).
2607
'primary_link' => '',
2608
'skip_notification' => false,
2609
) );
2610
2611
// Bail if missing necessary data.
2612
if ( empty( $r['content'] ) || empty( $r['user_id'] ) || empty( $r['activity_id'] ) ) {
2613
- $errors->add( 'missing_data', $feedback );
2614
- $bp->activity->errors['new_comment'] = $errors;
2615
2616
- return false;
2617
}
2618
2619
// Maybe set current activity ID as the parent.
@@ -2628,14 +2577,21 @@ function bp_activity_new_comment( $args = '' ) {
2628
2629
// Bail if the parent activity does not exist.
2630
if ( empty( $activity->date_recorded ) ) {
2631
- $errors->add( 'missing_activity', __( 'Sorry, the item you are replying to no longer exists.', 'buddypress' ) );
2632
- $bp->activity->errors['new_comment'] = $errors;
2633
2634
- return false;
2635
}
2636
2637
// Check to see if the parent activity is hidden, and if so, hide this comment publicly.
2638
- $is_hidden = ( (int) $activity->hide_sitewide ) ? 1 : 0;
2639
2640
/**
2641
* Filters the content of a new comment.
@@ -2656,9 +2612,15 @@ function bp_activity_new_comment( $args = '' ) {
2656
'user_id' => $r['user_id'],
2657
'item_id' => $activity_id,
2658
'secondary_item_id' => $r['parent_id'],
2659
- 'hide_sitewide' => $is_hidden
2660
) );
2661
2662
// Comment caches are stored only with the top-level item.
2663
wp_cache_delete( $activity_id, 'bp_activity_comments' );
2664
@@ -2698,8 +2660,15 @@ function bp_activity_new_comment( $args = '' ) {
2698
}
2699
2700
if ( empty( $comment_id ) ) {
2701
- $errors->add( 'comment_failed', $feedback );
2702
- $bp->activity->errors['new_comment'] = $errors;
2703
}
2704
2705
return $comment_id;
@@ -2711,9 +2680,6 @@ function bp_activity_new_comment( $args = '' ) {
2711
* @since 1.2.0
2712
*
2713
* @see BP_Activity_Activity::get() For more information on accepted arguments.
2714
- * @uses wp_parse_args()
2715
- * @uses apply_filters() To call the 'bp_activity_get_activity_id' hook.
2716
- * @uses BP_Activity_Activity::save() {@link BP_Activity_Activity}
2717
*
2718
* @param array|string $args See BP_Activity_Activity::get() for description.
2719
* @return int $activity_id The ID of the activity item found.
@@ -2769,15 +2735,6 @@ function bp_activity_get_activity_id( $args = '' ) {
2769
* @since 1.0.0
2770
*
2771
* @see BP_Activity_Activity::get() For more information on accepted arguments.
2772
- * @uses wp_parse_args()
2773
- * @uses bp_activity_adjust_mention_count()
2774
- * @uses BP_Activity_Activity::delete() {@link BP_Activity_Activity}
2775
- * @uses do_action() To call the 'bp_before_activity_delete' hook.
2776
- * @uses bp_get_user_meta()
2777
- * @uses bp_delete_user_meta()
2778
- * @uses do_action() To call the 'bp_activity_delete' hook.
2779
- * @uses do_action() To call the 'bp_activity_deleted_activities' hook.
2780
- * @uses wp_cache_delete()
2781
*
2782
* @param array|string $args To delete specific activity items, use
2783
* $args = array( 'id' => $ids ); Otherwise, to use
@@ -2863,8 +2820,6 @@ function bp_activity_delete( $args = '' ) {
2863
* @since 1.1.0
2864
* @deprecated 1.2.0
2865
*
2866
- * @uses wp_parse_args()
2867
- * @uses bp_activity_delete()
2868
*
2869
* @param array|string $args See BP_Activity_Activity::get for a
2870
* description of accepted arguments.
@@ -2888,7 +2843,6 @@ function bp_activity_delete( $args = '' ) {
2888
*
2889
* @since 1.1.0
2890
*
2891
- * @uses bp_activity_delete()
2892
*
2893
* @param int $activity_id ID of the activity item to be deleted.
2894
* @return bool True on success, false on failure.
@@ -2905,7 +2859,6 @@ function bp_activity_delete( $args = '' ) {
2905
* @since 1.1.0
2906
* @deprecated 1.2.0
2907
*
2908
- * @uses bp_activity_delete()
2909
*
2910
* @param int $user_id The user id.
2911
* @param string $content The activity id.
@@ -2930,7 +2883,6 @@ function bp_activity_delete( $args = '' ) {
2930
* @since 1.1.0
2931
* @deprecated 1.2.0
2932
*
2933
- * @uses bp_activity_delete()
2934
*
2935
* @param int $user_id The user id.
2936
* @param string $component The activity component.
@@ -2948,11 +2900,6 @@ function bp_activity_delete( $args = '' ) {
2948
*
2949
* @since 1.2.0
2950
*
2951
- * @uses apply_filters() To call the 'bp_activity_delete_comment_pre' hook.
2952
- * @uses bp_activity_delete_children()
2953
- * @uses bp_activity_delete()
2954
- * @uses BP_Activity_Activity::rebuild_activity_comment_tree() {@link BP_Activity_Activity}
2955
- * @uses do_action() To call the 'bp_activity_delete_comment' hook.
2956
* @todo Why is an activity id required? We could look this up.
2957
* @todo Why do we encourage users to call this function directly? We could just
2958
* as easily examine the activity type in bp_activity_delete() and then
@@ -3018,9 +2965,6 @@ function bp_activity_delete_comment( $activity_id, $comment_id ) {
3018
*
3019
* @since 1.2.0
3020
*
3021
- * @uses BP_Activity_Activity::get_child_comments() {@link BP_Activity_Activity}
3022
- * @uses bp_activity_delete_children()
3023
- * @uses bp_activity_delete()
3024
*
3025
* @param int $activity_id The ID of the "root" activity, ie the
3026
* comment's oldest ancestor.
@@ -3056,10 +3000,6 @@ function bp_activity_delete_comment( $activity_id, $comment_id ) {
3056
*
3057
* @since 1.2.0
3058
*
3059
- * @uses bp_get_root_domain()
3060
- * @uses bp_get_activity_root_slug()
3061
- * @uses apply_filters_ref_array() To call the 'bp_activity_get_permalink' hook.
3062
- *
3063
* @param int $activity_id The unique id of the activity object.
3064
* @param object|bool $activity_obj Optional. The activity object.
3065
* @return string $link Permalink for the activity item.
@@ -3111,8 +3051,6 @@ function bp_activity_get_permalink( $activity_id, $activity_obj = false ) {
3111
*
3112
* @since 1.2.0
3113
*
3114
- * @uses BP_Activity_Activity::hide_all_for_user() {@link BP_Activity_Activity}
3115
- *
3116
* @param int $user_id The ID of the user whose activity is being hidden.
3117
* @return bool True on success, false on failure.
3118
*/
@@ -3134,9 +3072,6 @@ function bp_activity_hide_user_activity( $user_id ) {
3134
*
3135
* @since 1.2.0
3136
*
3137
- * @uses esc_attr()
3138
- * @uses apply_filters() To call the 'bp_activity_thumbnail_content_images' hook.
3139
- *
3140
* @param string $content The content of the activity item.
3141
* @param string|bool $link Optional. The unescaped URL that the image should link
3142
* to. If absent, the image will not be a link.
@@ -3339,8 +3274,12 @@ function bp_activity_create_summary( $content, $activity ) {
3339
}
3340
3341
// Generate a text excerpt for this activity item (and remove any oEmbeds URLs).
3342
- $summary = strip_shortcodes( html_entity_decode( strip_tags( $content ) ) );
3343
- $summary = bp_create_excerpt( preg_replace( '#^\s*(https?://[^\s"]+)\s*$#im', '', $summary ) );
3344
3345
if ( $use_media_type === 'embeds' ) {
3346
$summary .= PHP_EOL . PHP_EOL . $extracted_media['url'];
@@ -3387,6 +3326,8 @@ function bp_activity_user_can_mark_spam() {
3387
*
3388
* @since 1.6.0
3389
*
3390
* @param BP_Activity_Activity $activity The activity item to be spammed.
3391
* @param string $source Optional. Default is "by_a_person" (ie, a person has
3392
* manually marked the activity as spam). BP core also
@@ -3495,17 +3436,31 @@ function bp_activity_mark_as_ham( &$activity, $source = 'by_a_person' ) {
3495
* @see bp_embed_activity_cache()
3496
* @see bp_embed_activity_save_cache()
3497
*
3498
- * @uses add_filter() To attach 'bp_get_activity_id' to 'embed_post_id'.
3499
- * @uses add_filter() To attach 'bp_embed_activity_cache' to 'bp_embed_get_cache'.
3500
- * @uses add_action() To attach 'bp_embed_activity_save_cache' to 'bp_embed_update_cache'.
3501
*/
3502
function bp_activity_embed() {
3503
add_filter( 'embed_post_id', 'bp_get_activity_id' );
3504
add_filter( 'bp_embed_get_cache', 'bp_embed_activity_cache', 10, 3 );
3505
add_action( 'bp_embed_update_cache', 'bp_embed_activity_save_cache', 10, 3 );
3506
}
3507
add_action( 'activity_loop_start', 'bp_activity_embed' );
3508
3509
/**
3510
* Set up activity oEmbed cache while recursing through activity comments.
3511
*
@@ -3520,9 +3475,6 @@ add_action( 'activity_loop_start', 'bp_activity_embed' );
3520
* @see bp_embed_activity_cache()
3521
* @see bp_embed_activity_save_cache()
3522
*
3523
- * @uses add_filter() To attach 'bp_get_activity_comment_id' to 'embed_post_id'.
3524
- * @uses add_filter() To attach 'bp_embed_activity_cache' to 'bp_embed_get_cache'.
3525
- * @uses add_action() To attach 'bp_embed_activity_save_cache' to 'bp_embed_update_cache'.
3526
*/
3527
function bp_activity_comment_embed() {
3528
add_filter( 'embed_post_id', 'bp_get_activity_comment_id' );
@@ -3537,9 +3489,6 @@ add_action( 'bp_before_activity_comment', 'bp_activity_comment_embed' );
3537
* @since 1.5.0
3538
*
3539
* @see BP_Embed
3540
- * @uses add_filter() To attach create_function() to 'embed_post_id'.
3541
- * @uses add_filter() To attach 'bp_embed_activity_cache' to 'bp_embed_get_cache'.
3542
- * @uses add_action() To attach 'bp_embed_activity_save_cache' to 'bp_embed_update_cache'.
3543
*
3544
* @param object $activity The activity that is being expanded.
3545
*/
@@ -3562,7 +3511,6 @@ add_action( 'bp_legacy_theme_get_single_activity_content', 'bp_dtheme_embed_read
3562
* @since 1.5.0
3563
*
3564
* @see bp_activity_comment_embed()
3565
- * @uses remove_filter() To remove 'bp_get_activity_comment_id' from 'embed_post_id'.
3566
*/
3567
function bp_activity_comment_embed_after_recurse() {
3568
remove_filter( 'embed_post_id', 'bp_get_activity_comment_id' );
@@ -3577,7 +3525,6 @@ add_action( 'bp_after_activity_comment', 'bp_activity_comment_embed_after_recurs
3577
* @since 1.5.0
3578
*
3579
* @see BP_Embed::parse_oembed()
3580
- * @uses bp_activity_get_meta()
3581
*
3582
* @param string $cache An empty string passed by BP_Embed::parse_oembed() for
3583
* functions like this one to filter.
@@ -3597,7 +3544,6 @@ function bp_embed_activity_cache( $cache, $id, $cachekey ) {
3597
* @since 1.5.0
3598
*
3599
* @see BP_Embed::parse_oembed()
3600
- * @uses bp_activity_update_meta()
3601
*
3602
* @param string $cache An empty string passed by BP_Embed::parse_oembed() for
3603
* functions like this one to filter.
@@ -3606,6 +3552,12 @@ function bp_embed_activity_cache( $cache, $id, $cachekey ) {
3606
*/
3607
function bp_embed_activity_save_cache( $cache, $cachekey, $id ) {
3608
bp_activity_update_meta( $id, $cachekey, $cache );
3609
}
3610
3611
/**
@@ -3613,10 +3565,7 @@ function bp_embed_activity_save_cache( $cache, $cachekey, $id ) {
3613
*
3614
* @since 2.0.0
3615
*
3616
- * @uses bp_is_activity_heartbeat_active() to check if heartbeat setting is on.
3617
- * @uses bp_is_activity_directory() to check if the current page is the activity
3618
* directory.
3619
- * @uses bp_is_group_activity() to check if on a single group, the current page
3620
* is the group activities.
3621
*
3622
* @return bool True if activity heartbeat is enabled, otherwise false.
40
*
41
* @since 1.8.0
42
*
43
* @return bool $retval True to enable mentions, false to disable.
44
*/
45
function bp_activity_do_mentions() {
131
*
132
* @since 1.5.0
133
*
134
* @param int $user_id The id of the user whose unread mentions are being reset.
135
*/
136
function bp_activity_clear_new_mentions( $user_id ) {
157
*
158
* @since 1.5.0
159
*
160
* @param int $activity_id The unique id for the activity item.
161
* @param string $action Can be 'delete' or 'add'. Defaults to 'add'.
162
* @return bool
169
}
170
171
// Get activity object.
172
+ $activity = new BP_Activity_Activity( $activity_id );
173
174
// Try to find mentions.
175
$usernames = bp_activity_find_mentions( strip_tags( $activity->content ) );
193
*
194
* @since 1.7.0
195
*
196
* @param int $user_id The user ID.
197
* @param int $activity_id The unique ID for the activity item.
198
* @param string $action 'delete' or 'add'. Default: 'add'.
777
*
778
* @since 1.1.0
779
*
780
* @param string $component_id The unique string ID of the component.
781
* @param string $key The action key.
782
* @return string|bool Action value if found, otherwise false.
846
*
847
* @since 1.2.0
848
*
849
* @param int $user_id ID of the user whose favorites are being queried.
850
* @return array IDs of the user's favorite activity items.
851
*/
874
*
875
* @since 1.2.0
876
*
877
* @param int $activity_id ID of the activity item being favorited.
878
* @param int $user_id ID of the user favoriting the activity item.
879
* @return bool True on success, false on failure.
948
*
949
* @since 1.2.0
950
*
951
* @param int $activity_id ID of the activity item being unfavorited.
952
* @param int $user_id ID of the user unfavoriting the activity item.
953
* @return bool True on success, false on failure.
1020
*
1021
* @since 1.1.0
1022
*
1023
* @param string $content The content to filter by.
1024
* @return int|null The ID of the located activity item. Null if none is found.
1025
*/
1030
*
1031
* @since 1.1.0
1032
*
1033
+ * @param BP_Activity_Activity $value ID of the activity if found, else null.
1034
*/
1035
return apply_filters( 'bp_activity_check_exists_by_content', BP_Activity_Activity::check_exists_by_content( $content ) );
1036
}
1040
*
1041
* @since 1.0.0
1042
*
1043
* @return string Date last updated.
1044
*/
1045
function bp_activity_get_last_updated() {
1059
*
1060
* @since 1.2.0
1061
*
1062
* @param int $user_id ID of the user whose favorite count is being requested.
1063
* @return int Total favorite count for the user.
1064
*/
1122
*
1123
* @since 1.2.0
1124
*
1125
* @param int $activity_id ID of the activity item whose metadata is being requested.
1126
* @param string $meta_key Optional. If present, only the metadata matching
1127
* that meta key will be returned. Otherwise, all metadata for the
1199
*
1200
* @since 1.5.0
1201
*
1202
* @param int $user_id ID of the user whose activity is being deleted.
1203
* @return bool
1204
*/
1625
*
1626
* @see BP_Activity_Activity::get() For more information on accepted arguments
1627
* and the format of the returned value.
1628
*
1629
* @param array|string $args See BP_Activity_Activity::get() for description.
1630
* @return array $activity See BP_Activity_Activity::get() for description.
1731
* @since 1.2.0
1732
*
1733
* @see BP_Activity_Activity::get() For more information on accepted arguments.
1734
*
1735
* @param array|string $args {
1736
* All arguments and defaults are shared with BP_Activity_Activity::get(),
1782
* Add an activity item.
1783
*
1784
* @since 1.1.0
1785
+ * @since 2.6.0 Added 'error_type' parameter to $args.
1786
*
1787
* @param array|string $args {
1788
* An array of arguments.
1814
* @type bool $hide_sitewide Should the item be hidden on sitewide streams?
1815
* Default: false.
1816
* @type bool $is_spam Should the item be marked as spam? Default: false.
1817
+ * @type string $error_type Optional. Error type. Either 'bool' or 'wp_error'. Default: 'bool'.
1818
* }
1819
* @return int|bool The ID of the activity on success. False on error.
1820
*/
1833
'recorded_time' => bp_core_current_time(), // The GMT time that this activity was recorded.
1834
'hide_sitewide' => false, // Should this be hidden on the sitewide activity stream?
1835
'is_spam' => false, // Is this activity item to be marked as spam?
1836
+ 'error_type' => 'bool'
1837
), 'activity_add' );
1838
1839
// Make sure we are backwards compatible.
1857
$activity->date_recorded = $r['recorded_time'];
1858
$activity->hide_sitewide = $r['hide_sitewide'];
1859
$activity->is_spam = $r['is_spam'];
1860
+ $activity->error_type = $r['error_type'];
1861
$activity->action = ! empty( $r['action'] )
1862
+ ? $r['action']
1863
+ : bp_activity_generate_action_string( $activity );
1864
1865
+ $save = $activity->save();
1866
+
1867
+ if ( 'wp_error' === $r['error_type'] && is_wp_error( $save ) ) {
1868
+ return $save;
1869
+ } elseif ('bool' === $r['error_type'] && false === $save ) {
1870
return false;
1871
}
1872
1897
*
1898
* @since 1.2.0
1899
*
1900
* @param array|string $args {
1901
* @type string $content The content of the activity update.
1902
* @type int $user_id Optional. Defaults to the logged-in user.
1906
function bp_activity_post_update( $args = '' ) {
1907
1908
$r = wp_parse_args( $args, array(
1909
+ 'content' => false,
1910
+ 'user_id' => bp_loggedin_user_id(),
1911
+ 'error_type' => 'bool',
1912
) );
1913
1914
if ( empty( $r['content'] ) || !strlen( trim( $r['content'] ) ) ) {
1948
'primary_link' => $add_primary_link,
1949
'component' => buddypress()->activity->id,
1950
'type' => 'activity_update',
1951
+ 'error_type' => $r['error_type']
1952
) );
1953
1954
+ // Bail on failure.
1955
+ if ( false === $activity_id || is_wp_error( $activity_id ) ) {
1956
+ return $activity_id;
1957
+ }
1958
+
1959
/**
1960
* Filters the latest update content for the activity item.
1961
*
2248
*
2249
* @since 2.5.0
2250
*
2251
+ * @param int $comment_id ID of the comment.
2252
+ * @param bool $is_approved Whether the comment is approved or not.
2253
+ * @param object|null $activity_post_object The post type tracking args object.
2254
* @return int|bool The ID of the activity on success. False on error.
2255
*/
2256
function bp_activity_post_type_comment( $comment_id = 0, $is_approved = true, $activity_post_object = null ) {
2440
*
2441
* @since 2.5.0
2442
*
2443
+ * @param int $comment_id ID of the comment.
2444
+ * @param object|null $activity_post_object The post type tracking args object.
2445
* @return bool True on success. False on error.
2446
*/
2447
function bp_activity_post_type_remove_comment( $comment_id = 0, $activity_post_object = null ) {
2506
* @since 1.2.0
2507
* @since 2.5.0 Add a new possible parameter $skip_notification for the array of arguments.
2508
* Add the $primary_link parameter for the array of arguments.
2509
+ * @since 2.6.0 Added 'error_type' parameter to $args.
2510
*
2511
* @param array|string $args {
2512
+ * An array of arguments.
2513
* @type int $id Optional. Pass an ID to update an existing comment.
2514
* @type string $content The content of the comment.
2515
* @type int $user_id Optional. The ID of the user making the comment.
2523
* Defaults to an empty string.
2524
* @type bool $skip_notification Optional. false to send a comment notification, false otherwise.
2525
* Defaults to false.
2526
+ * @type string $error_type Optional. Error type. Either 'bool' or 'wp_error'. Default: 'bool'.
2527
* }
2528
* @return int|bool The ID of the comment on success, otherwise false.
2529
*/
2530
function bp_activity_new_comment( $args = '' ) {
2531
+ $bp = buddypress();
2532
2533
$r = wp_parse_args( $args, array(
2534
'id' => false,
2538
'parent_id' => false, // ID of a parent comment (optional).
2539
'primary_link' => '',
2540
'skip_notification' => false,
2541
+ 'error_type' => 'bool'
2542
) );
2543
2544
+ // Error type is boolean; need to initialize some variables for backpat.
2545
+ if ( 'bool' === $r['error_type'] ) {
2546
+ if ( empty( $bp->activity->errors ) ) {
2547
+ $bp->activity->errors = array();
2548
+ }
2549