BuddyPress - Version 2.4.4

Version Description

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

Download this release

Release Info

Developer DJPaul
Plugin Icon 128x128 BuddyPress
Version 2.4.4
Comparing to
See all releases

Code changes from version 2.3.6 to 2.4.4

Files changed (358) hide show
  1. bp-activity/admin/js/admin.js +7 -7
  2. bp-activity/admin/js/admin.min.js +1 -1
  3. bp-activity/bp-activity-actions.php +82 -85
  4. bp-activity/bp-activity-admin.php +289 -237
  5. bp-activity/bp-activity-akismet.php +75 -79
  6. bp-activity/bp-activity-cache.php +8 -7
  7. bp-activity/bp-activity-classes.php +3 -3
  8. bp-activity/bp-activity-cssjs.php +5 -7
  9. bp-activity/bp-activity-filters.php +76 -89
  10. bp-activity/bp-activity-functions.php +277 -328
  11. bp-activity/bp-activity-loader.php +64 -62
  12. bp-activity/bp-activity-notifications.php +46 -50
  13. bp-activity/bp-activity-screens.php +57 -60
  14. bp-activity/bp-activity-template.php +438 -441
  15. bp-activity/classes/class-bp-activity-activity.php +214 -221
  16. bp-activity/classes/class-bp-activity-feed.php +61 -60
  17. bp-activity/classes/class-bp-activity-query.php +18 -30
  18. bp-activity/js/mentions.js +10 -10
  19. bp-activity/js/mentions.min.js +2 -2
  20. bp-blogs/bp-blogs-actions.php +1 -2
  21. bp-blogs/bp-blogs-activity.php +121 -85
  22. bp-blogs/bp-blogs-cache.php +6 -7
  23. bp-blogs/bp-blogs-classes.php +1 -2
  24. bp-blogs/bp-blogs-filters.php +12 -10
  25. bp-blogs/bp-blogs-functions.php +134 -102
  26. bp-blogs/bp-blogs-loader.php +51 -38
  27. bp-blogs/bp-blogs-screens.php +21 -22
  28. bp-blogs/bp-blogs-template.php +175 -162
  29. bp-blogs/bp-blogs-widgets.php +12 -8
  30. bp-blogs/classes/class-bp-blogs-blog.php +69 -58
  31. bp-core/admin/bp-core-admin-actions.php +23 -24
  32. bp-core/admin/bp-core-admin-components.php +17 -17
  33. bp-core/admin/bp-core-admin-functions.php +72 -60
  34. bp-core/admin/bp-core-admin-schema.php +25 -26
  35. bp-core/admin/bp-core-admin-settings.php +85 -57
  36. bp-core/admin/bp-core-admin-slugs.php +64 -43
  37. bp-core/admin/bp-core-admin-tools.php +26 -20
  38. bp-core/admin/css/common-rtl.css +30 -277
  39. bp-core/admin/css/common-rtl.min.css +1 -1
  40. bp-core/admin/css/common.css +30 -277
  41. bp-core/admin/css/common.min.css +1 -1
  42. bp-core/admin/images/accessibility.gif +0 -0
  43. bp-core/admin/images/avatar-ui.gif +0 -0
  44. bp-core/admin/images/group-cover-image.png +0 -0
  45. bp-core/admin/images/group-home-page.png +0 -0
  46. bp-core/admin/images/icons32.png +0 -0
  47. bp-core/admin/images/icons64.png +0 -0
  48. bp-core/admin/images/member-type-field.png +0 -0
  49. bp-core/admin/images/menu-2x.png +0 -0
  50. bp-core/admin/images/menu-wp.png +0 -0
  51. bp-core/admin/images/menu.png +0 -0
  52. bp-core/admin/images/theme-stylesheets.png +0 -0
  53. bp-core/bp-core-actions.php +12 -13
  54. bp-core/bp-core-admin.php +125 -100
  55. bp-core/bp-core-adminbar.php +7 -8
  56. bp-core/bp-core-attachments.php +1026 -36
  57. bp-core/bp-core-avatars.php +371 -282
  58. bp-core/bp-core-buddybar.php +369 -139
  59. bp-core/bp-core-cache.php +29 -22
  60. bp-core/bp-core-caps.php +93 -54
  61. bp-core/bp-core-catchuri.php +69 -47
  62. bp-core/bp-core-classes.php +2 -1
  63. bp-core/bp-core-component.php +93 -77
  64. bp-core/bp-core-cssjs.php +134 -15
  65. bp-core/bp-core-dependency.php +68 -59
  66. bp-core/bp-core-filters.php +181 -193
  67. bp-core/bp-core-functions.php +231 -169
  68. bp-core/bp-core-loader.php +25 -70
  69. bp-core/bp-core-moderation.php +20 -17
  70. bp-core/bp-core-options.php +164 -88
  71. bp-core/bp-core-taxonomy.php +15 -7
  72. bp-core/bp-core-template-loader.php +76 -58
  73. bp-core/bp-core-template.php +417 -204
  74. bp-core/bp-core-theme-compatibility.php +248 -69
  75. bp-core/bp-core-update.php +388 -385
  76. bp-core/bp-core-widgets.php +37 -26
  77. bp-core/bp-core-wpabstraction.php +16 -9
  78. bp-core/classes/class-bp-attachment-avatar.php +102 -72
  79. bp-core/classes/class-bp-attachment-cover-image.php +284 -0
  80. bp-core/classes/class-bp-attachment.php +229 -73
  81. bp-core/classes/class-bp-button.php +33 -33
  82. bp-core/classes/class-bp-core-notification.php +55 -29
  83. bp-core/classes/class-bp-core-user.php +68 -60
  84. bp-core/classes/class-bp-date-query.php +8 -4
  85. bp-core/classes/class-bp-embed.php +18 -16
  86. bp-core/classes/class-bp-media-extractor.php +168 -131
  87. bp-core/classes/class-bp-members-suggestions.php +15 -13
  88. bp-core/classes/class-bp-recursive-query.php +16 -21
  89. bp-core/classes/class-bp-suggestions.php +16 -14
  90. bp-core/classes/class-bp-user-query.php +171 -126
  91. bp-core/classes/class-bp-walker-nav-menu-checklist.php +15 -15
  92. bp-core/classes/class-bp-walker-nav-menu.php +23 -22
  93. bp-core/css/avatar-rtl.css +15 -7
  94. bp-core/css/avatar-rtl.min.css +1 -1
  95. bp-core/css/avatar.css +15 -7
  96. bp-core/css/avatar.min.css +1 -1
  97. bp-core/deprecated/1.2.php +2 -2
  98. bp-core/deprecated/1.5.php +84 -73
  99. bp-core/deprecated/1.6.php +20 -21
  100. bp-core/deprecated/1.7.php +12 -12
  101. bp-core/deprecated/1.9.php +9 -10
  102. bp-core/deprecated/2.0.php +3 -3
  103. bp-core/deprecated/2.1.php +27 -27
  104. bp-core/deprecated/2.2.php +12 -12
  105. bp-core/deprecated/2.3.php +1 -1
  106. bp-core/deprecated/2.4.php +25 -0
  107. bp-core/deprecated/js/autocomplete/jquery.autocomplete.min.js +1 -1
  108. bp-core/deprecated/js/autocomplete/jquery.autocompletefb.min.js +1 -1
  109. bp-core/deprecated/js/autocomplete/jquery.bgiframe.min.js +1 -1
  110. bp-core/deprecated/js/autocomplete/jquery.dimensions.min.js +1 -1
  111. bp-core/js/avatar.js +35 -4
  112. bp-core/js/avatar.min.js +2 -2
  113. bp-core/js/bp-plupload.js +34 -12
  114. bp-core/js/bp-plupload.min.js +2 -2
  115. bp-core/js/confirm.min.js +1 -1
  116. bp-core/js/cover-image.js +277 -0
  117. bp-core/js/cover-image.min.js +2 -0
  118. bp-core/js/jquery-cookie.min.js +1 -1
  119. bp-core/js/jquery-query.min.js +1 -1
  120. bp-core/js/jquery-scroll-to.min.js +1 -1
  121. bp-core/js/jquery.atwho.min.js +2 -2
  122. bp-core/js/jquery.caret.min.js +2 -2
  123. bp-core/js/webcam.js +1 -1
  124. bp-core/js/webcam.min.js +2 -2
  125. bp-core/js/widget-members.min.js +1 -1
  126. bp-forums/bb-config.php +4 -1
  127. bp-forums/bp-forums-actions.php +2 -2
  128. bp-forums/bp-forums-bbpress-sa.php +57 -54
  129. bp-forums/bp-forums-bbpress.php +5 -2
  130. bp-forums/bp-forums-filters.php +14 -14
  131. bp-forums/bp-forums-functions.php +180 -171
  132. bp-forums/bp-forums-loader.php +61 -54
  133. bp-forums/bp-forums-screens.php +26 -26
  134. bp-forums/bp-forums-template.php +256 -282
  135. bp-forums/deprecated/1.6.php +17 -18
  136. bp-forums/deprecated/1.7.php +13 -14
  137. bp-friends/bp-friends-actions.php +2 -3
  138. bp-friends/bp-friends-activity.php +47 -46
  139. bp-friends/bp-friends-cache.php +15 -15
  140. bp-friends/bp-friends-classes.php +2 -2
  141. bp-friends/bp-friends-filters.php +28 -9
  142. bp-friends/bp-friends-functions.php +123 -129
  143. bp-friends/bp-friends-loader.php +56 -52
  144. bp-friends/bp-friends-notifications.php +75 -71
  145. bp-friends/bp-friends-screens.php +14 -15
  146. bp-friends/bp-friends-template.php +44 -44
  147. bp-friends/bp-friends-widgets.php +29 -29
  148. bp-friends/classes/class-bp-friends-friendship.php +77 -77
  149. bp-friends/js/widget-friends.min.js +1 -1
  150. bp-groups/admin/js/admin.min.js +1 -1
  151. bp-groups/bp-groups-actions.php +22 -24
  152. bp-groups/bp-groups-activity.php +15 -16
  153. bp-groups/bp-groups-admin.php +84 -84
  154. bp-groups/bp-groups-adminbar.php +3 -4
  155. bp-groups/bp-groups-cache.php +10 -11
  156. bp-groups/bp-groups-classes.php +1 -1
  157. bp-groups/bp-groups-filters.php +7 -9
  158. bp-groups/bp-groups-forums.php +35 -36
  159. bp-groups/bp-groups-functions.php +46 -54
  160. bp-groups/bp-groups-loader.php +170 -112
  161. bp-groups/bp-groups-notifications.php +82 -60
  162. bp-groups/bp-groups-screens.php +141 -79
  163. bp-groups/bp-groups-template.php +663 -375
  164. bp-groups/bp-groups-widgets.php +22 -13
  165. bp-groups/classes/class-bp-group-extension.php +126 -129
  166. bp-groups/classes/class-bp-group-member-query.php +9 -10
  167. bp-groups/classes/class-bp-groups-group.php +205 -208
  168. bp-groups/classes/class-bp-groups-member-suggestions.php +9 -10
  169. bp-groups/classes/class-bp-groups-member.php +144 -97
  170. bp-groups/js/widget-groups.min.js +1 -1
  171. bp-loader.php +56 -41
  172. bp-members/admin/bp-members-admin-classes.php +65 -72
  173. bp-members/admin/css/admin-rtl.css +3 -2
  174. bp-members/admin/css/admin-rtl.min.css +1 -1
  175. bp-members/admin/css/admin.css +3 -2
  176. bp-members/admin/css/admin.min.css +1 -1
  177. bp-members/admin/js/admin.js +1 -1
  178. bp-members/admin/js/admin.min.js +1 -1
  179. bp-members/bp-members-actions.php +21 -16
  180. bp-members/bp-members-activity.php +7 -10
  181. bp-members/bp-members-admin.php +193 -221
  182. bp-members/bp-members-adminbar.php +34 -23
  183. bp-members/bp-members-cache.php +8 -3
  184. bp-members/bp-members-classes.php +1 -1
  185. bp-members/bp-members-filters.php +13 -16
  186. bp-members/bp-members-functions.php +286 -306
  187. bp-members/bp-members-loader.php +61 -46
  188. bp-members/bp-members-screens.php +96 -93
  189. bp-members/bp-members-template.php +266 -207
  190. bp-members/bp-members-widgets.php +73 -72
  191. bp-members/classes/class-bp-signup.php +72 -78
  192. bp-messages/bp-messages-actions.php +206 -13
  193. bp-messages/bp-messages-cache.php +15 -15
  194. bp-messages/bp-messages-classes.php +2 -2
  195. bp-messages/bp-messages-cssjs.php +2 -3
  196. bp-messages/bp-messages-filters.php +5 -5
  197. bp-messages/bp-messages-functions.php +65 -51
  198. bp-messages/bp-messages-loader.php +62 -64
  199. bp-messages/bp-messages-notifications.php +27 -29
  200. bp-messages/bp-messages-screens.php +39 -102
  201. bp-messages/bp-messages-star.php +59 -53
  202. bp-messages/bp-messages-template.php +162 -170
  203. bp-messages/bp-messages-widgets.php +9 -9
  204. bp-messages/classes/class-bp-messages-message.php +11 -16
  205. bp-messages/classes/class-bp-messages-notice.php +19 -18
  206. bp-messages/classes/class-bp-messages-thread.php +140 -130
  207. bp-notifications/bp-notifications-actions.php +23 -24
  208. bp-notifications/bp-notifications-adminbar.php +5 -4
  209. bp-notifications/bp-notifications-cache.php +19 -15
  210. bp-notifications/bp-notifications-classes.php +3 -4
  211. bp-notifications/bp-notifications-functions.php +138 -132
  212. bp-notifications/bp-notifications-loader.php +61 -56
  213. bp-notifications/bp-notifications-screens.php +8 -9
  214. bp-notifications/bp-notifications-template.php +161 -176
  215. bp-notifications/classes/class-bp-notifications-notification.php +221 -216
  216. bp-settings/bp-settings-actions.php +12 -13
  217. bp-settings/bp-settings-functions.php +1 -2
  218. bp-settings/bp-settings-loader.php +41 -36
  219. bp-settings/bp-settings-screens.php +14 -15
  220. bp-settings/bp-settings-template.php +20 -15
  221. bp-templates/bp-legacy/buddypress-functions.php +418 -250
  222. bp-templates/bp-legacy/buddypress/activity/activity-loop.php +8 -2
  223. bp-templates/bp-legacy/buddypress/activity/comment.php +3 -8
  224. bp-templates/bp-legacy/buddypress/activity/entry.php +9 -13
  225. bp-templates/bp-legacy/buddypress/activity/index.php +27 -19
  226. bp-templates/bp-legacy/buddypress/activity/post-form.php +6 -5
  227. bp-templates/bp-legacy/buddypress/activity/single/home.php +9 -0
  228. bp-templates/bp-legacy/buddypress/assets/_attachments/avatars/camera.php +4 -3
  229. bp-templates/bp-legacy/buddypress/assets/_attachments/avatars/crop.php +4 -3
  230. bp-templates/bp-legacy/buddypress/assets/_attachments/avatars/index.php +4 -4
  231. bp-templates/bp-legacy/buddypress/assets/_attachments/cover-images/index.php +36 -0
  232. bp-templates/bp-legacy/buddypress/assets/_attachments/uploader.php +5 -4
  233. bp-templates/bp-legacy/buddypress/blogs/blogs-loop.php +7 -12
  234. bp-templates/bp-legacy/buddypress/blogs/create.php +10 -4
  235. bp-templates/bp-legacy/buddypress/blogs/index.php +20 -14
  236. bp-templates/bp-legacy/buddypress/forums/forums-loop.php +8 -9
  237. bp-templates/bp-legacy/buddypress/forums/index.php +28 -19
  238. bp-templates/bp-legacy/buddypress/groups/create.php +76 -47
  239. bp-templates/bp-legacy/buddypress/groups/groups-loop.php +7 -8
  240. bp-templates/bp-legacy/buddypress/groups/index.php +18 -12
  241. bp-templates/bp-legacy/buddypress/groups/single/activity.php +15 -6
  242. bp-templates/bp-legacy/buddypress/groups/single/admin.php +86 -58
  243. bp-templates/bp-legacy/buddypress/groups/single/cover-image-header.php +123 -0
  244. bp-templates/bp-legacy/buddypress/groups/single/forum.php +13 -7
  245. bp-templates/bp-legacy/buddypress/groups/single/forum/edit.php +15 -8
  246. bp-templates/bp-legacy/buddypress/groups/single/forum/topic.php +15 -8
  247. bp-templates/bp-legacy/buddypress/groups/single/group-header.php +14 -8
  248. bp-templates/bp-legacy/buddypress/groups/single/home.php +28 -19
  249. bp-templates/bp-legacy/buddypress/groups/single/invites-loop.php +12 -4
  250. bp-templates/bp-legacy/buddypress/groups/single/members.php +16 -6
  251. bp-templates/bp-legacy/buddypress/groups/single/plugins.php +9 -3
  252. bp-templates/bp-legacy/buddypress/groups/single/request-membership.php +9 -3
  253. bp-templates/bp-legacy/buddypress/groups/single/requests-loop.php +12 -2
  254. bp-templates/bp-legacy/buddypress/groups/single/send-invites.php +8 -2
  255. bp-templates/bp-legacy/buddypress/members/activate.php +14 -4
  256. bp-templates/bp-legacy/buddypress/members/index.php +19 -13
  257. bp-templates/bp-legacy/buddypress/members/members-loop.php +6 -11
  258. bp-templates/bp-legacy/buddypress/members/register.php +53 -32
  259. bp-templates/bp-legacy/buddypress/members/single/activity.php +5 -6
  260. bp-templates/bp-legacy/buddypress/members/single/blogs.php +3 -4
  261. bp-templates/bp-legacy/buddypress/members/single/cover-image-header.php +103 -0
  262. bp-templates/bp-legacy/buddypress/members/single/forums.php +3 -4
  263. bp-templates/bp-legacy/buddypress/members/single/forums/topics.php +4 -3
  264. bp-templates/bp-legacy/buddypress/members/single/friends.php +3 -4
  265. bp-templates/bp-legacy/buddypress/members/single/friends/requests.php +19 -13
  266. bp-templates/bp-legacy/buddypress/members/single/groups.php +3 -4
  267. bp-templates/bp-legacy/buddypress/members/single/groups/invites.php +10 -4
  268. bp-templates/bp-legacy/buddypress/members/single/home.php +25 -6
  269. bp-templates/bp-legacy/buddypress/members/single/member-header.php +5 -6
  270. bp-templates/bp-legacy/buddypress/members/single/messages.php +4 -5
  271. bp-templates/bp-legacy/buddypress/members/single/messages/compose.php +13 -4
  272. bp-templates/bp-legacy/buddypress/members/single/messages/message.php +86 -0
  273. bp-templates/bp-legacy/buddypress/members/single/messages/messages-loop.php +16 -10
  274. bp-templates/bp-legacy/buddypress/members/single/messages/notices-loop.php +12 -6
  275. bp-templates/bp-legacy/buddypress/members/single/messages/single.php +19 -65
  276. bp-templates/bp-legacy/buddypress/members/single/notifications.php +1 -4
  277. bp-templates/bp-legacy/buddypress/members/single/notifications/feedback-no-notifications.php +11 -2
  278. bp-templates/bp-legacy/buddypress/members/single/notifications/notifications-loop.php +11 -2
  279. bp-templates/bp-legacy/buddypress/members/single/notifications/read.php +11 -1
  280. bp-templates/bp-legacy/buddypress/members/single/notifications/unread.php +11 -1
  281. bp-templates/bp-legacy/buddypress/members/single/plugins.php +9 -9
  282. bp-templates/bp-legacy/buddypress/members/single/profile.php +7 -3
  283. bp-templates/bp-legacy/buddypress/members/single/profile/change-avatar.php +16 -5
  284. bp-templates/bp-legacy/buddypress/members/single/profile/change-cover-image.php +33 -0
  285. bp-templates/bp-legacy/buddypress/members/single/profile/edit.php +23 -6
  286. bp-templates/bp-legacy/buddypress/members/single/profile/profile-loop.php +7 -1
  287. bp-templates/bp-legacy/buddypress/members/single/profile/profile-wp.php +11 -5
  288. bp-templates/bp-legacy/buddypress/members/single/settings.php +0 -1
  289. bp-templates/bp-legacy/buddypress/members/single/settings/capabilities.php +9 -3
  290. bp-templates/bp-legacy/buddypress/members/single/settings/delete-account.php +9 -3
  291. bp-templates/bp-legacy/buddypress/members/single/settings/general.php +9 -2
  292. bp-templates/bp-legacy/buddypress/members/single/settings/notifications.php +9 -3
  293. bp-templates/bp-legacy/buddypress/members/single/settings/profile.php +10 -4
  294. bp-templates/bp-legacy/css/buddypress-rtl.css +86 -11
  295. bp-templates/bp-legacy/css/buddypress-rtl.min.css +1 -1
  296. bp-templates/bp-legacy/css/buddypress.css +86 -11
  297. bp-templates/bp-legacy/css/buddypress.min.css +1 -1
  298. bp-templates/bp-legacy/css/twentyfifteen-rtl.css +194 -196
  299. bp-templates/bp-legacy/css/twentyfifteen-rtl.min.css +1 -1
  300. bp-templates/bp-legacy/css/twentyfifteen.css +194 -196
  301. bp-templates/bp-legacy/css/twentyfifteen.min.css +1 -1
  302. bp-templates/bp-legacy/css/twentyfifteen.scss +2307 -2297
  303. bp-templates/bp-legacy/css/twentyfourteen-rtl.css +1 -12
  304. bp-templates/bp-legacy/css/twentyfourteen-rtl.min.css +1 -1
  305. bp-templates/bp-legacy/css/twentyfourteen.css +1 -12
  306. bp-templates/bp-legacy/css/twentyfourteen.min.css +1 -1
  307. bp-templates/bp-legacy/css/twentyfourteen.scss +0 -12
  308. bp-templates/bp-legacy/css/twentysixteen-rtl.css +1861 -0
  309. bp-templates/bp-legacy/css/twentysixteen-rtl.min.css +1 -0
  310. bp-templates/bp-legacy/css/twentysixteen.css +1861 -0
  311. bp-templates/bp-legacy/css/twentysixteen.min.css +1 -0
  312. bp-templates/bp-legacy/css/twentysixteen.scss +2352 -0
  313. bp-templates/bp-legacy/css/twentythirteen-rtl.css +1936 -0
  314. bp-templates/bp-legacy/css/twentythirteen-rtl.min.css +1 -0
  315. bp-templates/bp-legacy/css/twentythirteen.css +1936 -0
  316. bp-templates/bp-legacy/css/twentythirteen.min.css +1 -0
  317. bp-templates/bp-legacy/css/twentythirteen.scss +2375 -0
  318. bp-templates/bp-legacy/js/buddypress.js +99 -50
  319. bp-templates/bp-legacy/js/buddypress.min.js +3 -4
  320. bp-templates/bp-legacy/js/password-verify.min.js +1 -1
  321. bp-xprofile/admin/css/admin-rtl.css +10 -0
  322. bp-xprofile/admin/css/admin-rtl.min.css +1 -1
  323. bp-xprofile/admin/css/admin.css +10 -0
  324. bp-xprofile/admin/css/admin.min.css +1 -1
  325. bp-xprofile/admin/js/admin.js +34 -0
  326. bp-xprofile/admin/js/admin.min.js +2 -2
  327. bp-xprofile/bp-xprofile-actions.php +22 -21
  328. bp-xprofile/bp-xprofile-activity.php +73 -70
  329. bp-xprofile/bp-xprofile-admin.php +180 -136
  330. bp-xprofile/bp-xprofile-cache.php +88 -49
  331. bp-xprofile/bp-xprofile-caps.php +21 -20
  332. bp-xprofile/bp-xprofile-classes.php +2 -2
  333. bp-xprofile/bp-xprofile-cssjs.php +7 -8
  334. bp-xprofile/bp-xprofile-filters.php +139 -80
  335. bp-xprofile/bp-xprofile-functions.php +250 -178
  336. bp-xprofile/bp-xprofile-loader.php +97 -67
  337. bp-xprofile/bp-xprofile-notifications.php +49 -0
  338. bp-xprofile/bp-xprofile-screens.php +91 -61
  339. bp-xprofile/bp-xprofile-settings.php +18 -10
  340. bp-xprofile/bp-xprofile-template.php +256 -214
  341. bp-xprofile/classes/class-bp-xprofile-field-type-checkbox.php +28 -23
  342. bp-xprofile/classes/class-bp-xprofile-field-type-datebox.php +44 -27
  343. bp-xprofile/classes/class-bp-xprofile-field-type-multiselectbox.php +33 -21
  344. bp-xprofile/classes/class-bp-xprofile-field-type-number.php +21 -16
  345. bp-xprofile/classes/class-bp-xprofile-field-type-placeholder.php +15 -9
  346. bp-xprofile/classes/class-bp-xprofile-field-type-radiobutton.php +25 -20
  347. bp-xprofile/classes/class-bp-xprofile-field-type-selectbox.php +28 -22
  348. bp-xprofile/classes/class-bp-xprofile-field-type-textarea.php +94 -31
  349. bp-xprofile/classes/class-bp-xprofile-field-type-textbox.php +21 -17
  350. bp-xprofile/classes/class-bp-xprofile-field-type-url.php +29 -21
  351. bp-xprofile/classes/class-bp-xprofile-field-type.php +96 -58
  352. bp-xprofile/classes/class-bp-xprofile-field.php +678 -195
  353. bp-xprofile/classes/class-bp-xprofile-group.php +207 -150
  354. bp-xprofile/classes/class-bp-xprofile-meta-query.php +16 -19
  355. bp-xprofile/classes/class-bp-xprofile-profiledata.php +40 -36
  356. bp-xprofile/classes/class-bp-xprofile-query.php +30 -35
  357. buddypress.pot +2419 -2173
  358. readme.txt +32 -8
bp-activity/admin/js/admin.js CHANGED
@@ -4,14 +4,14 @@
4
/**
5
* Activity reply object for the activity index screen
6
*
7
- * @since BuddyPress (1.6)
8
*/
9
var activityReply = {
10
11
/**
12
* Attach event handler functions to the relevant elements.
13
*
14
- * @since BuddyPress (1.6)
15
*/
16
init : function() {
17
$(document).on( 'click', '.row-actions a.reply', activityReply.open );
@@ -29,7 +29,7 @@ var activityReply = {
29
/**
30
* Reveals the entire row when "reply" is pressed.
31
*
32
- * @since BuddyPress (1.6)
33
*/
34
open : function() {
35
// Hide the container row, and move it to the new location
@@ -46,7 +46,7 @@ var activityReply = {
46
/**
47
* Hide and reset the entire row when "cancel", or escape, are pressed.
48
*
49
- * @since BuddyPress (1.6)
50
*/
51
close : function() {
52
// Hide the container row
@@ -66,7 +66,7 @@ var activityReply = {
66
/**
67
* Submits "form" via AJAX back to WordPress.
68
*
69
- * @since BuddyPress (1.6)
70
*/
71
send : function() {
72
// Hide any existing error message, and show the loading spinner
@@ -100,7 +100,7 @@ var activityReply = {
100
/**
101
* send() error message handler
102
*
103
- * @since BuddyPress (1.6)
104
*/
105
error : function( r ) {
106
var er = r.statusText;
@@ -118,7 +118,7 @@ var activityReply = {
118
/**
119
* send() success handler
120
*
121
- * @since BuddyPress (1.6)
122
*/
123
show : function ( xml ) {
124
var bg, id, response;
4
/**
5
* Activity reply object for the activity index screen
6
*
7
+ * @since 1.6.0
8
*/
9
var activityReply = {
10
11
/**
12
* Attach event handler functions to the relevant elements.
13
*
14
+ * @since 1.6.0
15
*/
16
init : function() {
17
$(document).on( 'click', '.row-actions a.reply', activityReply.open );
29
/**
30
* Reveals the entire row when "reply" is pressed.
31
*
32
+ * @since 1.6.0
33
*/
34
open : function() {
35
// Hide the container row, and move it to the new location
46
/**
47
* Hide and reset the entire row when "cancel", or escape, are pressed.
48
*
49
+ * @since 1.6.0
50
*/
51
close : function() {
52
// Hide the container row
66
/**
67
* Submits "form" via AJAX back to WordPress.
68
*
69
+ * @since 1.6.0
70
*/
71
send : function() {
72
// Hide any existing error message, and show the loading spinner
100
/**
101
* send() error message handler
102
*
103
+ * @since 1.6.0
104
*/
105
error : function( r ) {
106
var er = r.statusText;
118
/**
119
* send() success handler
120
*
121
+ * @since 1.6.0
122
*/
123
show : function ( xml ) {
124
var bg, id, response;
bp-activity/admin/js/admin.min.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! buddypress - v2.3.5 - 2015-11-11 5:23:00 AM 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
+ /*! buddypress - v2.4.3 - 2015-12-14 7:03:28 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);
bp-activity/bp-activity-actions.php CHANGED
@@ -1,5 +1,4 @@
1
<?php
2
-
3
/**
4
* Action functions are exactly the same as screen functions, however they do
5
* not have a template screen associated with them. Usually they will send the
@@ -9,13 +8,13 @@
9
* @subpackage ActivityActions
10
*/
11
12
- // Exit if accessed directly
13
defined( 'ABSPATH' ) || exit;
14
15
/**
16
* Allow core components and dependent plugins to register activity actions.
17
*
18
- * @since BuddyPress (1.2.0)
19
*
20
* @uses do_action() To call 'bp_register_activity_actions' hook.
21
*/
@@ -24,7 +23,7 @@ function bp_register_activity_actions() {
24
/**
25
* Fires on bp_init to allow core components and dependent plugins to register activity actions.
26
*
27
- * @since BuddyPress (1.2.0)
28
*/
29
do_action( 'bp_register_activity_actions' );
30
}
@@ -33,7 +32,7 @@ add_action( 'bp_init', 'bp_register_activity_actions', 8 );
33
/**
34
* Catch and route requests for single activity item permalinks.
35
*
36
- * @since BuddyPress (1.2.0)
37
*
38
* @uses bp_is_activity_component()
39
* @uses bp_is_current_action()
@@ -51,15 +50,15 @@ add_action( 'bp_init', 'bp_register_activity_actions', 8 );
51
*/
52
function bp_activity_action_permalink_router() {
53
54
- // Not viewing activity
55
if ( ! bp_is_activity_component() || ! bp_is_current_action( 'p' ) )
56
return false;
57
58
- // No activity to display
59
if ( ! bp_action_variable( 0 ) || ! is_numeric( bp_action_variable( 0 ) ) )
60
return false;
61
62
- // Get the activity details
63
$activity = bp_activity_get_specific( array( 'activity_ids' => bp_action_variable( 0 ), 'show_hidden' => true ) );
64
65
// 404 if activity does not exist
@@ -70,31 +69,31 @@ function bp_activity_action_permalink_router() {
70
$activity = $activity['activities'][0];
71
}
72
73
- // Do not redirect at default
74
$redirect = false;
75
76
- // Redirect based on the type of activity
77
if ( bp_is_active( 'groups' ) && $activity->component == buddypress()->groups->id ) {
78
79
- // Activity is a user update
80
if ( ! empty( $activity->user_id ) ) {
81
$redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id . '/';
82
83
- // Activity is something else
84
} else {
85
86
- // Set redirect to group activity stream
87
if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) ) {
88
$redirect = bp_get_group_permalink( $group ) . bp_get_activity_slug() . '/' . $activity->id . '/';
89
}
90
}
91
92
- // Set redirect to users' activity stream
93
} elseif ( ! empty( $activity->user_id ) ) {
94
$redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id . '/';
95
}
96
97
- // If set, add the original query string back onto the redirect URL
98
if ( ! empty( $_SERVER['QUERY_STRING'] ) ) {
99
$query_frags = array();
100
wp_parse_str( $_SERVER['QUERY_STRING'], $query_frags );
@@ -104,7 +103,7 @@ function bp_activity_action_permalink_router() {
104
/**
105
* Filter the intended redirect url before the redirect occurs for the single activity item.
106
*
107
- * @since BuddyPress (1.2.2)
108
*
109
* @param array Array with url to redirect to and activity related to the redirect.
110
*/
@@ -112,7 +111,7 @@ function bp_activity_action_permalink_router() {
112
bp_core_redirect( bp_get_root_domain() );
113
}
114
115
- // Redirect to the actual activity permalink page
116
bp_core_redirect( $redirect );
117
}
118
add_action( 'bp_actions', 'bp_activity_action_permalink_router' );
@@ -120,9 +119,7 @@ add_action( 'bp_actions', 'bp_activity_action_permalink_router' );
120
/**
121
* Delete specific activity item and redirect to previous page.
122
*
123
- * @since BuddyPress (1.1.0)
124
- *
125
- * @param int $activity_id Activity id to be deleted. Defaults to 0.
126
*
127
* @uses bp_is_activity_component()
128
* @uses bp_is_current_action()
@@ -135,42 +132,43 @@ add_action( 'bp_actions', 'bp_activity_action_permalink_router' );
135
* @uses do_action() Calls 'bp_activity_action_delete_activity' hook to allow actions to be taken after the activity is deleted.
136
* @uses bp_core_redirect()
137
*
138
* @return bool False on failure.
139
*/
140
function bp_activity_action_delete_activity( $activity_id = 0 ) {
141
142
- // Not viewing activity or action is not delete
143
if ( !bp_is_activity_component() || !bp_is_current_action( 'delete' ) )
144
return false;
145
146
if ( empty( $activity_id ) && bp_action_variable( 0 ) )
147
$activity_id = (int) bp_action_variable( 0 );
148
149
- // Not viewing a specific activity item
150
if ( empty( $activity_id ) )
151
return false;
152
153
- // Check the nonce
154
check_admin_referer( 'bp_activity_delete_link' );
155
156
- // Load up the activity item
157
$activity = new BP_Activity_Activity( $activity_id );
158
159
- // Check access
160
if ( ! bp_activity_user_can_delete( $activity ) )
161
return false;
162
163
/**
164
* Fires before the deletion so plugins can still fetch information about it.
165
*
166
- * @since BuddyPress (1.5.0)
167
*
168
* @param int $activity_id The activity ID.
169
* @param int $user_id The user associated with the activity.
170
*/
171
do_action( 'bp_activity_before_action_delete_activity', $activity_id, $activity->user_id );
172
173
- // Delete the activity item and provide user feedback
174
if ( bp_activity_delete( array( 'id' => $activity_id, 'user_id' => $activity->user_id ) ) )
175
bp_core_add_message( __( 'Activity deleted successfully', 'buddypress' ) );
176
else
@@ -179,14 +177,14 @@ function bp_activity_action_delete_activity( $activity_id = 0 ) {
179
/**
180
* Fires after the deletion so plugins can act afterwards based on the activity.
181
*
182
- * @since BuddyPress (1.1.0)
183
*
184
* @param int $activity_id The activity ID.
185
* @param int $user_id The user associated with the activity.
186
*/
187
do_action( 'bp_activity_action_delete_activity', $activity_id, $activity->user_id );
188
189
- // Check for the redirect query arg, otherwise let WP handle things
190
if ( !empty( $_GET['redirect_to'] ) )
191
bp_core_redirect( esc_url( $_GET['redirect_to'] ) );
192
else
@@ -197,23 +195,22 @@ add_action( 'bp_actions', 'bp_activity_action_delete_activity' );
197
/**
198
* Mark specific activity item as spam and redirect to previous page.
199
*
200
- * @since BuddyPress (1.6.0)
201
*
202
* @param int $activity_id Activity id to be deleted. Defaults to 0.
203
- *
204
* @return bool False on failure.
205
*/
206
function bp_activity_action_spam_activity( $activity_id = 0 ) {
207
$bp = buddypress();
208
209
- // Not viewing activity, or action is not spam, or Akismet isn't present
210
if ( !bp_is_activity_component() || !bp_is_current_action( 'spam' ) || empty( $bp->activity->akismet ) )
211
return false;
212
213
if ( empty( $activity_id ) && bp_action_variable( 0 ) )
214
$activity_id = (int) bp_action_variable( 0 );
215
216
- // Not viewing a specific activity item
217
if ( empty( $activity_id ) )
218
return false;
219
@@ -221,42 +218,42 @@ function bp_activity_action_spam_activity( $activity_id = 0 ) {
221
if ( !bp_activity_user_can_mark_spam() )
222
return false;
223
224
- // Load up the activity item
225
$activity = new BP_Activity_Activity( $activity_id );
226
if ( empty( $activity->id ) )
227
return false;
228
229
- // Check nonce
230
check_admin_referer( 'bp_activity_akismet_spam_' . $activity->id );
231
232
/**
233
* Fires before the marking activity as spam so plugins can modify things if they want to.
234
*
235
- * @since BuddyPress (1.6.0)
236
*
237
* @param int $activity_id Activity ID to be marked as spam.
238
* @param object $activity Activity object for the ID to be marked as spam.
239
*/
240
do_action( 'bp_activity_before_action_spam_activity', $activity->id, $activity );
241
242
- // Mark as spam
243
bp_activity_mark_as_spam( $activity );
244
$activity->save();
245
246
- // Tell the user the spamming has been successful
247
bp_core_add_message( __( 'The activity item has been marked as spam and is no longer visible.', 'buddypress' ) );
248
249
/**
250
* Fires after the marking activity as spam so plugins can act afterwards based on the activity.
251
*
252
- * @since BuddyPress (1.6.0)
253
*
254
* @param int $activity_id Activity ID that was marked as spam.
255
* @param int $user_id User ID associated with activity.
256
*/
257
do_action( 'bp_activity_action_spam_activity', $activity_id, $activity->user_id );
258
259
- // Check for the redirect query arg, otherwise let WP handle things
260
if ( !empty( $_GET['redirect_to'] ) )
261
bp_core_redirect( esc_url( $_GET['redirect_to'] ) );
262
else
@@ -267,7 +264,7 @@ add_action( 'bp_actions', 'bp_activity_action_spam_activity' );
267
/**
268
* Post user/group activity update.
269
*
270
- * @since BuddyPress (1.2.0)
271
*
272
* @uses is_user_logged_in()
273
* @uses bp_is_activity_component()
@@ -287,17 +284,17 @@ add_action( 'bp_actions', 'bp_activity_action_spam_activity' );
287
*/
288
function bp_activity_action_post_update() {
289
290
- // Do not proceed if user is not logged in, not viewing activity, or not posting
291
if ( !is_user_logged_in() || !bp_is_activity_component() || !bp_is_current_action( 'post' ) )
292
return false;
293
294
- // Check the nonce
295
check_admin_referer( 'post_update', '_wpnonce_post_update' );
296
297
/**
298
* Filters the content provided in the activity input field.
299
*
300
- * @since BuddyPress (1.2.0)
301
*
302
* @param string $value Activity message being posted.
303
*/
@@ -308,7 +305,7 @@ function bp_activity_action_post_update() {
308
/**
309
* Filters the item type that the activity update should be associated with.
310
*
311
- * @since BuddyPress (1.2.0)
312
*
313
* @param string $value Item type to associate with.
314
*/
@@ -320,24 +317,24 @@ function bp_activity_action_post_update() {
320
/**
321
* Filters what component the activity is being to.
322
*
323
- * @since BuddyPress (1.2.0)
324
*
325
* @param string $value Chosen component to post activity to.
326
*/
327
$item_id = apply_filters( 'bp_activity_post_update_item_id', $_POST['whats-new-post-in'] );
328
}
329
330
- // No activity content so provide feedback and redirect
331
if ( empty( $content ) ) {
332
bp_core_add_message( __( 'Please enter some content to post.', 'buddypress' ), 'error' );
333
bp_core_redirect( wp_get_referer() );
334
}
335
336
- // No existing item_id
337
if ( empty( $item_id ) ) {
338
$activity_id = bp_activity_post_update( array( 'content' => $content ) );
339
340
- // Post to groups object
341
} elseif ( 'groups' == $object && bp_is_active( 'groups' ) ) {
342
if ( (int) $item_id ) {
343
$activity_id = groups_post_update( array( 'content' => $content, 'group_id' => $item_id ) );
@@ -348,7 +345,7 @@ function bp_activity_action_post_update() {
348
/**
349
* Filters activity object for BuddyPress core and plugin authors before posting activity update.
350
*
351
- * @since BuddyPress (1.2.0)
352
*
353
* @param string $object Activity item being associated to.
354
* @param string $item_id Component ID being posted to.
@@ -357,13 +354,13 @@ function bp_activity_action_post_update() {
357
$activity_id = apply_filters( 'bp_activity_custom_update', $object, $item_id, $content );
358
}
359
360
- // Provide user feedback
361
if ( !empty( $activity_id ) )
362
bp_core_add_message( __( 'Update Posted!', 'buddypress' ) );
363
else
364
bp_core_add_message( __( 'There was an error when posting your update. Please try again.', 'buddypress' ), 'error' );
365
366
- // Redirect
367
bp_core_redirect( wp_get_referer() );
368
}
369
add_action( 'bp_actions', 'bp_activity_action_post_update' );
@@ -371,7 +368,7 @@ add_action( 'bp_actions', 'bp_activity_action_post_update' );
371
/**
372
* Post new activity comment.
373
*
374
- * @since BuddyPress (1.2.0)
375
*
376
* @uses is_user_logged_in()
377
* @uses bp_is_activity_component()
@@ -391,13 +388,13 @@ function bp_activity_action_post_comment() {
391
if ( !is_user_logged_in() || !bp_is_activity_component() || !bp_is_current_action( 'reply' ) )
392
return false;
393
394
- // Check the nonce
395
check_admin_referer( 'new_activity_comment', '_wpnonce_new_activity_comment' );
396
397
/**
398
* Filters the activity ID a comment will be in reply to.
399
*
400
- * @since BuddyPress (1.2.0)
401
*
402
* @param string $value ID of the activity being replied to.
403
*/
@@ -406,7 +403,7 @@ function bp_activity_action_post_comment() {
406
/**
407
* Filters the comment content for a comment reply.
408
*
409
- * @since BuddyPress (1.2.0)
410
*
411
* @param string $value Comment content being posted.
412
*/
@@ -435,7 +432,7 @@ add_action( 'bp_actions', 'bp_activity_action_post_comment' );
435
/**
436
* Mark activity as favorite.
437
*
438
- * @since BuddyPress (1.2.0)
439
*
440
* @uses is_user_logged_in()
441
* @uses bp_is_activity_component()
@@ -454,7 +451,7 @@ function bp_activity_action_mark_favorite() {
454
if ( !is_user_logged_in() || !bp_is_activity_component() || !bp_is_current_action( 'favorite' ) )
455
return false;
456
457
- // Check the nonce
458
check_admin_referer( 'mark_favorite' );
459
460
if ( bp_activity_add_user_favorite( bp_action_variable( 0 ) ) )
@@ -469,7 +466,7 @@ add_action( 'bp_actions', 'bp_activity_action_mark_favorite' );
469
/**
470
* Remove activity from favorites.
471
*
472
- * @since BuddyPress (1.2.0)
473
*
474
* @uses is_user_logged_in()
475
* @uses bp_is_activity_component()
@@ -488,7 +485,7 @@ function bp_activity_action_remove_favorite() {
488
if ( ! is_user_logged_in() || ! bp_is_activity_component() || ! bp_is_current_action( 'unfavorite' ) )
489
return false;
490
491
- // Check the nonce
492
check_admin_referer( 'unmark_favorite' );
493
494
if ( bp_activity_remove_user_favorite( bp_action_variable( 0 ) ) )
@@ -503,7 +500,7 @@ add_action( 'bp_actions', 'bp_activity_action_remove_favorite' );
503
/**
504
* Load the sitewide activity feed.
505
*
506
- * @since BuddyPress (1.0.0)
507
*
508
* @uses bp_is_activity_component()
509
* @uses bp_is_current_action()
@@ -518,7 +515,7 @@ function bp_activity_action_sitewide_feed() {
518
if ( ! bp_is_activity_component() || ! bp_is_current_action( 'feed' ) || bp_is_user() || ! empty( $bp->groups->current_group ) )
519
return false;
520
521
- // setup the feed
522
buddypress()->activity->feed = new BP_Activity_Feed( array(
523
'id' => 'sitewide',
524
@@ -535,7 +532,7 @@ add_action( 'bp_actions', 'bp_activity_action_sitewide_feed' );
535
/**
536
* Load a user's personal activity feed.
537
*
538
- * @since BuddyPress (1.0.0)
539
*
540
* @uses bp_is_user_activity()
541
* @uses bp_is_current_action()
@@ -548,7 +545,7 @@ function bp_activity_action_personal_feed() {
548
return false;
549
}
550
551
- // setup the feed
552
buddypress()->activity->feed = new BP_Activity_Feed( array(
553
'id' => 'personal',
554
@@ -565,7 +562,7 @@ add_action( 'bp_actions', 'bp_activity_action_personal_feed' );
565
/**
566
* Load a user's friends' activity feed.
567
*
568
- * @since BuddyPress (1.0.0)
569
*
570
* @uses bp_is_active()
571
* @uses bp_is_user_activity()
@@ -581,7 +578,7 @@ function bp_activity_action_friends_feed() {
581
return false;
582
}
583
584
- // setup the feed
585
buddypress()->activity->feed = new BP_Activity_Feed( array(
586
'id' => 'friends',
587
@@ -598,7 +595,7 @@ add_action( 'bp_actions', 'bp_activity_action_friends_feed' );
598
/**
599
* Load the activity feed for a user's groups.
600
*
601
- * @since BuddyPress (1.2.0)
602
*
603
* @uses bp_is_active()
604
* @uses bp_is_user_activity()
@@ -614,11 +611,11 @@ function bp_activity_action_my_groups_feed() {
614
return false;
615
}
616
617
- // get displayed user's group IDs
618
$groups = groups_get_user_groups();
619
$group_ids = implode( ',', $groups['groups'] );
620
621
- // setup the feed
622
buddypress()->activity->feed = new BP_Activity_Feed( array(
623
'id' => 'mygroups',
624
@@ -639,7 +636,7 @@ add_action( 'bp_actions', 'bp_activity_action_my_groups_feed' );
639
/**
640
* Load a user's @mentions feed.
641
*
642
- * @since BuddyPress (1.2.0)
643
*
644
* @uses bp_is_user_activity()
645
* @uses bp_is_current_action()
@@ -657,7 +654,7 @@ function bp_activity_action_mentions_feed() {
657
return false;
658
}
659
660
- // setup the feed
661
buddypress()->activity->feed = new BP_Activity_Feed( array(
662
'id' => 'mentions',
663
@@ -676,7 +673,7 @@ add_action( 'bp_actions', 'bp_activity_action_mentions_feed' );
676
/**
677
* Load a user's favorites feed.
678
*
679
- * @since BuddyPress (1.2.0)
680
*
681
* @uses bp_is_user_activity()
682
* @uses bp_is_current_action()
@@ -690,11 +687,11 @@ function bp_activity_action_favorites_feed() {
690
return false;
691
}
692
693
- // get displayed user's favorite activity IDs
694
$favs = bp_activity_get_user_favorites( bp_displayed_user_id() );
695
$fav_ids = implode( ',', (array) $favs );
696
697
- // setup the feed
698
buddypress()->activity->feed = new BP_Activity_Feed( array(
699
'id' => 'favorites',
700
@@ -711,23 +708,23 @@ add_action( 'bp_actions', 'bp_activity_action_favorites_feed' );
711
/**
712
* Loads Akismet filtering for activity.
713
*
714
- * @since BuddyPress (1.6.0)
715
- * @since BuddyPress (2.3.0) We only support Akismet 3+.
716
*/
717
function bp_activity_setup_akismet() {
718
$bp = buddypress();
719
720
- // Bail if Akismet is not active
721
if ( ! defined( 'AKISMET_VERSION' ) ) {
722
return;
723
}
724
725
- // Bail if older version of Akismet
726
if ( ! class_exists( 'Akismet' ) ) {
727
return;
728
}
729
730
- // Bail if no Akismet key is set
731
if ( ! bp_get_option( 'wordpress_api_key' ) && ! defined( 'WPCOM_API_KEY' ) ) {
732
return;
733
}
@@ -735,7 +732,7 @@ function bp_activity_setup_akismet() {
735
/**
736
* Filters if BuddyPress Activity Akismet support has been disabled by another plugin.
737
*
738
- * @since BuddyPress (1.6.0)
739
*
740
* @param bool $value Return value of bp_is_akismet_active boolean function.
741
*/
@@ -743,14 +740,14 @@ function bp_activity_setup_akismet() {
743
return;
744
}
745
746
- // Instantiate Akismet for BuddyPress
747
$bp->activity->akismet = new BP_Akismet();
748
}
749
750
/**
751
* AJAX endpoint for Suggestions API lookups.
752
*
753
- * @since BuddyPress (2.1.0)
754
*/
755
function bp_ajax_get_suggestions() {
756
if ( ! bp_is_user_active() || empty( $_GET['term'] ) || empty( $_GET['type'] ) ) {
@@ -782,7 +779,7 @@ add_action( 'wp_ajax_bp_get_suggestions', 'bp_ajax_get_suggestions' );
782
/**
783
* Detect a change in post type status, and initiate an activity update if necessary.
784
*
785
- * @since BuddyPress (2.2.0)
786
*
787
* @todo Support untrashing better.
788
*
@@ -816,7 +813,7 @@ function bp_activity_catch_transition_post_type_status( $new_status, $old_status
816
* This is a variable filter that is dependent on the post type
817
* being untrashed.
818
*
819
- * @since BuddyPress (2.2.0)
820
*
821
* @param WP_Post $post Post data.
822
*/
@@ -828,7 +825,7 @@ function bp_activity_catch_transition_post_type_status( $new_status, $old_status
828
829
// Unpublishing a previously published post.
830
} elseif ( 'publish' === $old_status ) {
831
- // Some form of pending status - only remove the activity entry
832
bp_activity_post_type_unpublish( $post->ID, $post );
833
}
834
}
1
<?php
2
/**
3
* Action functions are exactly the same as screen functions, however they do
4
* not have a template screen associated with them. Usually they will send the
8
* @subpackage ActivityActions
9
*/
10
11
+ // Exit if accessed directly.
12
defined( 'ABSPATH' ) || exit;
13
14
/**
15
* Allow core components and dependent plugins to register activity actions.
16
*
17
+ * @since 1.2.0
18
*
19
* @uses do_action() To call 'bp_register_activity_actions' hook.
20
*/
23
/**
24
* Fires on bp_init to allow core components and dependent plugins to register activity actions.
25
*
26
+ * @since 1.2.0
27
*/
28
do_action( 'bp_register_activity_actions' );
29
}
32
/**
33
* Catch and route requests for single activity item permalinks.
34
*
35
+ * @since 1.2.0
36
*
37
* @uses bp_is_activity_component()
38
* @uses bp_is_current_action()
50
*/
51
function bp_activity_action_permalink_router() {
52
53
+ // Not viewing activity.
54
if ( ! bp_is_activity_component() || ! bp_is_current_action( 'p' ) )
55
return false;
56
57
+ // No activity to display.
58
if ( ! bp_action_variable( 0 ) || ! is_numeric( bp_action_variable( 0 ) ) )
59
return false;
60
61
+ // Get the activity details.
62
$activity = bp_activity_get_specific( array( 'activity_ids' => bp_action_variable( 0 ), 'show_hidden' => true ) );
63
64
// 404 if activity does not exist
69
$activity = $activity['activities'][0];
70
}
71
72
+ // Do not redirect at default.
73
$redirect = false;
74
75
+ // Redirect based on the type of activity.
76
if ( bp_is_active( 'groups' ) && $activity->component == buddypress()->groups->id ) {
77
78
+ // Activity is a user update.
79
if ( ! empty( $activity->user_id ) ) {
80
$redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id . '/';
81
82
+ // Activity is something else.
83
} else {
84
85
+ // Set redirect to group activity stream.
86
if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) ) {
87
$redirect = bp_get_group_permalink( $group ) . bp_get_activity_slug() . '/' . $activity->id . '/';
88
}
89
}
90
91
+ // Set redirect to users' activity stream.
92
} elseif ( ! empty( $activity->user_id ) ) {
93
$redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id . '/';
94
}
95
96
+ // If set, add the original query string back onto the redirect URL.
97
if ( ! empty( $_SERVER['QUERY_STRING'] ) ) {
98
$query_frags = array();
99
wp_parse_str( $_SERVER['QUERY_STRING'], $query_frags );
103
/**
104
* Filter the intended redirect url before the redirect occurs for the single activity item.
105
*
106
+ * @since 1.2.2
107
*
108
* @param array Array with url to redirect to and activity related to the redirect.
109
*/
111
bp_core_redirect( bp_get_root_domain() );
112
}
113
114
+ // Redirect to the actual activity permalink page.
115
bp_core_redirect( $redirect );
116
}
117
add_action( 'bp_actions', 'bp_activity_action_permalink_router' );
119
/**
120
* Delete specific activity item and redirect to previous page.
121
*
122
+ * @since 1.1.0
123
*
124
* @uses bp_is_activity_component()
125
* @uses bp_is_current_action()
132
* @uses do_action() Calls 'bp_activity_action_delete_activity' hook to allow actions to be taken after the activity is deleted.
133
* @uses bp_core_redirect()
134
*
135
+ * @param int $activity_id Activity id to be deleted. Defaults to 0.
136
* @return bool False on failure.
137
*/
138
function bp_activity_action_delete_activity( $activity_id = 0 ) {
139
140
+ // Not viewing activity or action is not delete.
141
if ( !bp_is_activity_component() || !bp_is_current_action( 'delete' ) )
142
return false;
143
144
if ( empty( $activity_id ) && bp_action_variable( 0 ) )
145
$activity_id = (int) bp_action_variable( 0 );
146
147
+ // Not viewing a specific activity item.
148
if ( empty( $activity_id ) )
149
return false;
150
151
+ // Check the nonce.
152
check_admin_referer( 'bp_activity_delete_link' );
153
154
+ // Load up the activity item.
155
$activity = new BP_Activity_Activity( $activity_id );
156
157
+ // Check access.
158
if ( ! bp_activity_user_can_delete( $activity ) )
159
return false;
160
161
/**
162
* Fires before the deletion so plugins can still fetch information about it.
163
*
164
+ * @since 1.5.0
165
*
166
* @param int $activity_id The activity ID.
167
* @param int $user_id The user associated with the activity.
168
*/
169
do_action( 'bp_activity_before_action_delete_activity', $activity_id, $activity->user_id );
170
171
+ // Delete the activity item and provide user feedback.
172
if ( bp_activity_delete( array( 'id' => $activity_id, 'user_id' => $activity->user_id ) ) )
173
bp_core_add_message( __( 'Activity deleted successfully', 'buddypress' ) );
174
else
177
/**
178
* Fires after the deletion so plugins can act afterwards based on the activity.
179
*
180
+ * @since 1.1.0
181
*
182
* @param int $activity_id The activity ID.
183
* @param int $user_id The user associated with the activity.
184
*/
185
do_action( 'bp_activity_action_delete_activity', $activity_id, $activity->user_id );
186
187
+ // Check for the redirect query arg, otherwise let WP handle things.
188
if ( !empty( $_GET['redirect_to'] ) )
189
bp_core_redirect( esc_url( $_GET['redirect_to'] ) );
190
else
195
/**
196
* Mark specific activity item as spam and redirect to previous page.
197
*
198
+ * @since 1.6.0
199
*
200
* @param int $activity_id Activity id to be deleted. Defaults to 0.
201
* @return bool False on failure.
202
*/
203
function bp_activity_action_spam_activity( $activity_id = 0 ) {
204
$bp = buddypress();
205
206
+ // Not viewing activity, or action is not spam, or Akismet isn't present.
207
if ( !bp_is_activity_component() || !bp_is_current_action( 'spam' ) || empty( $bp->activity->akismet ) )
208
return false;
209
210
if ( empty( $activity_id ) && bp_action_variable( 0 ) )
211
$activity_id = (int) bp_action_variable( 0 );
212
213
+ // Not viewing a specific activity item.
214
if ( empty( $activity_id ) )
215
return false;
216
218
if ( !bp_activity_user_can_mark_spam() )
219
return false;
220
221
+ // Load up the activity item.
222
$activity = new BP_Activity_Activity( $activity_id );
223
if ( empty( $activity->id ) )
224
return false;
225
226
+ // Check nonce.
227
check_admin_referer( 'bp_activity_akismet_spam_' . $activity->id );
228
229
/**
230
* Fires before the marking activity as spam so plugins can modify things if they want to.
231
*
232
+ * @since 1.6.0
233
*
234
* @param int $activity_id Activity ID to be marked as spam.
235
* @param object $activity Activity object for the ID to be marked as spam.
236
*/
237
do_action( 'bp_activity_before_action_spam_activity', $activity->id, $activity );
238
239
+ // Mark as spam.
240
bp_activity_mark_as_spam( $activity );
241
$activity->save();
242
243
+ // Tell the user the spamming has been successful.
244
bp_core_add_message( __( 'The activity item has been marked as spam and is no longer visible.', 'buddypress' ) );
245
246
/**
247
* Fires after the marking activity as spam so plugins can act afterwards based on the activity.
248
*
249
+ * @since 1.6.0
250
*
251
* @param int $activity_id Activity ID that was marked as spam.
252
* @param int $user_id User ID associated with activity.
253
*/
254
do_action( 'bp_activity_action_spam_activity', $activity_id, $activity->user_id );
255
256
+ // Check for the redirect query arg, otherwise let WP handle things.
257
if ( !empty( $_GET['redirect_to'] ) )
258
bp_core_redirect( esc_url( $_GET['redirect_to'] ) );
259
else
264
/**
265
* Post user/group activity update.
266
*
267
+ * @since 1.2.0
268
*
269
* @uses is_user_logged_in()
270
* @uses bp_is_activity_component()
284
*/
285
function bp_activity_action_post_update() {
286
287
+ // Do not proceed if user is not logged in, not viewing activity, or not posting.
288
if ( !is_user_logged_in() || !bp_is_activity_component() || !bp_is_current_action( 'post' ) )
289
return false;
290
291
+ // Check the nonce.
292
check_admin_referer( 'post_update', '_wpnonce_post_update' );
293
294
/**
295
* Filters the content provided in the activity input field.
296
*
297
+ * @since 1.2.0
298
*
299
* @param string $value Activity message being posted.
300
*/
305
/**
306
* Filters the item type that the activity update should be associated with.
307
*
308
+ * @since 1.2.0
309
*
310
* @param string $value Item type to associate with.
311
*/
317
/**
318
* Filters what component the activity is being to.
319
*
320
+ * @since 1.2.0
321
*
322
* @param string $value Chosen component to post activity to.
323
*/
324
$item_id = apply_filters( 'bp_activity_post_update_item_id', $_POST['whats-new-post-in'] );
325
}
326
327
+ // No activity content so provide feedback and redirect.
328
if ( empty( $content ) ) {
329
bp_core_add_message( __( 'Please enter some content to post.', 'buddypress' ), 'error' );
330
bp_core_redirect( wp_get_referer() );
331
}
332
333
+ // No existing item_id.
334
if ( empty( $item_id ) ) {
335
$activity_id = bp_activity_post_update( array( 'content' => $content ) );
336
337
+ // Post to groups object.
338
} elseif ( 'groups' == $object && bp_is_active( 'groups' ) ) {
339
if ( (int) $item_id ) {
340
$activity_id = groups_post_update( array( 'content' => $content, 'group_id' => $item_id ) );
345
/**
346
* Filters activity object for BuddyPress core and plugin authors before posting activity update.
347
*
348
+ * @since 1.2.0
349
*
350
* @param string $object Activity item being associated to.
351
* @param string $item_id Component ID being posted to.
354
$activity_id = apply_filters( 'bp_activity_custom_update', $object, $item_id, $content );
355
}
356
357
+ // Provide user feedback.
358
if ( !empty( $activity_id ) )
359
bp_core_add_message( __( 'Update Posted!', 'buddypress' ) );
360
else
361
bp_core_add_message( __( 'There was an error when posting your update. Please try again.', 'buddypress' ), 'error' );
362
363
+ // Redirect.
364
bp_core_redirect( wp_get_referer() );
365
}
366
add_action( 'bp_actions', 'bp_activity_action_post_update' );
368
/**
369
* Post new activity comment.
370
*
371
+ * @since 1.2.0
372
*
373
* @uses is_user_logged_in()
374
* @uses bp_is_activity_component()
388
if ( !is_user_logged_in() || !bp_is_activity_component() || !bp_is_current_action( 'reply' ) )
389
return false;
390
391
+ // Check the nonce.
392
check_admin_referer( 'new_activity_comment', '_wpnonce_new_activity_comment' );
393
394
/**
395
* Filters the activity ID a comment will be in reply to.
396
*
397
+ * @since 1.2.0
398
*
399
* @param string $value ID of the activity being replied to.
400
*/
403
/**
404
* Filters the comment content for a comment reply.
405
*
406
+ * @since 1.2.0
407
*
408
* @param string $value Comment content being posted.
409
*/
432
/**
433
* Mark activity as favorite.
434
*
435
+ * @since 1.2.0
436
*
437
* @uses is_user_logged_in()
438
* @uses bp_is_activity_component()
451
if ( !is_user_logged_in() || !bp_is_activity_component() || !bp_is_current_action( 'favorite' ) )
452
return false;
453
454
+ // Check the nonce.
455
check_admin_referer( 'mark_favorite' );
456
457
if ( bp_activity_add_user_favorite( bp_action_variable( 0 ) ) )
466
/**
467
* Remove activity from favorites.
468
*
469
+ * @since 1.2.0
470
*
471
* @uses is_user_logged_in()
472
* @uses bp_is_activity_component()
485
if ( ! is_user_logged_in() || ! bp_is_activity_component() || ! bp_is_current_action( 'unfavorite' ) )
486
return false;
487
488
+ // Check the nonce.
489
check_admin_referer( 'unmark_favorite' );
490
491
if ( bp_activity_remove_user_favorite( bp_action_variable( 0 ) ) )
500
/**
501
* Load the sitewide activity feed.
502
*
503
+ * @since 1.0.0
504
*
505
* @uses bp_is_activity_component()
506
* @uses bp_is_current_action()
515
if ( ! bp_is_activity_component() || ! bp_is_current_action( 'feed' ) || bp_is_user() || ! empty( $bp->groups->current_group ) )
516
return false;
517
518
+ // Setup the feed.
519
buddypress()->activity->feed = new BP_Activity_Feed( array(
520
'id' => 'sitewide',
521
532
/**
533
* Load a user's personal activity feed.
534
*
535
+ * @since 1.0.0
536
*
537
* @uses bp_is_user_activity()
538
* @uses bp_is_current_action()
545
return false;
546
}
547
548
+ // Setup the feed.
549
buddypress()->activity->feed = new BP_Activity_Feed( array(
550
'id' => 'personal',
551
562
/**
563
* Load a user's friends' activity feed.
564
*
565
+ * @since 1.0.0
566
*
567
* @uses bp_is_active()
568
* @uses bp_is_user_activity()
578
return false;
579
}
580
581
+ // Setup the feed.
582
buddypress()->activity->feed = new BP_Activity_Feed( array(
583
'id' => 'friends',
584
595
/**
596
* Load the activity feed for a user's groups.
597
*
598
+ * @since 1.2.0
599
*
600
* @uses bp_is_active()
601
* @uses bp_is_user_activity()
611
return false;
612
}
613
614
+ // Get displayed user's group IDs.
615
$groups = groups_get_user_groups();
616
$group_ids = implode( ',', $groups['groups'] );
617
618
+ // Setup the feed.
619
buddypress()->activity->feed = new BP_Activity_Feed( array(
620
'id' => 'mygroups',
621
636
/**
637
* Load a user's @mentions feed.
638
*
639
+ * @since 1.2.0
640
*
641
* @uses bp_is_user_activity()
642
* @uses bp_is_current_action()
654
return false;
655
}
656
657
+ // Setup the feed.
658
buddypress()->activity->feed = new BP_Activity_Feed( array(
659
'id' => 'mentions',
660
673
/**
674
* Load a user's favorites feed.
675
*
676
+ * @since 1.2.0
677
*
678
* @uses bp_is_user_activity()
679
* @uses bp_is_current_action()
687
return false;
688
}
689
690
+ // Get displayed user's favorite activity IDs.
691
$favs = bp_activity_get_user_favorites( bp_displayed_user_id() );
692
$fav_ids = implode( ',', (array) $favs );
693
694
+ // Setup the feed.
695
buddypress()->activity->feed = new BP_Activity_Feed( array(
696
'id' => 'favorites',
697
708
/**
709
* Loads Akismet filtering for activity.
710
*
711
+ * @since 1.6.0
712
+ * @since 2.3.0 We only support Akismet 3+.
713
*/
714
function bp_activity_setup_akismet() {
715
$bp = buddypress();
716
717
+ // Bail if Akismet is not active.
718
if ( ! defined( 'AKISMET_VERSION' ) ) {
719
return;
720
}
721
722
+ // Bail if older version of Akismet.
723
if ( ! class_exists( 'Akismet' ) ) {
724
return;
725
}
726
727
+ // Bail if no Akismet key is set.
728
if ( ! bp_get_option( 'wordpress_api_key' ) && ! defined( 'WPCOM_API_KEY' ) ) {
729
return;
730
}
732
/**
733
* Filters if BuddyPress Activity Akismet support has been disabled by another plugin.
734
*
735
+ * @since 1.6.0
736
*
737
* @param bool $value Return value of bp_is_akismet_active boolean function.
738
*/
740
return;
741
}
742
743
+ // Instantiate Akismet for BuddyPress.
744
$bp->activity->akismet = new BP_Akismet();
745
}
746
747
/**
748
* AJAX endpoint for Suggestions API lookups.
749
*
750
+ * @since 2.1.0
751
*/
752
function bp_ajax_get_suggestions() {
753
if ( ! bp_is_user_active() || empty( $_GET['term'] ) || empty( $_GET['type'] ) ) {
779
/**
780
* Detect a change in post type status, and initiate an activity update if necessary.
781
*
782
+ * @since 2.2.0
783
*
784
* @todo Support untrashing better.
785
*
813
* This is a variable filter that is dependent on the post type
814
* being untrashed.
815
*
816
+ * @since 2.2.0
817
*
818
* @param WP_Post $post Post data.
819
*/
825
826
// Unpublishing a previously published post.
827
} elseif ( 'publish' === $old_status ) {
828
+ // Some form of pending status - only remove the activity entry.
829
bp_activity_post_type_unpublish( $post->ID, $post );
830
}
831
}
bp-activity/bp-activity-admin.php CHANGED
@@ -6,28 +6,28 @@
6
* help text, on which this implementation is heavily based.
7
*
8
* @package BuddyPress
9
- * @since BuddyPress (1.6.0)
10
- * @subpackage Activity
11
*/
12
13
- // Exit if accessed directly
14
defined( 'ABSPATH' ) || exit;
15
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
- // per_page screen option. Has to be hooked in extremely early.
20
if ( is_admin() && ! empty( $_REQUEST['page'] ) && 'bp-activity' == $_REQUEST['page'] )
21
add_filter( 'set-screen-option', 'bp_activity_admin_screen_options', 10, 3 );
22
23
/**
24
* Register the Activity component admin screen.
25
*
26
- * @since BuddyPress (1.6)
27
*/
28
function bp_activity_add_admin_menu() {
29
30
- // Add our screen
31
$hook = add_menu_page(
32
_x( 'Activity', 'Admin Dashbord SWA page title', 'buddypress' ),
33
_x( 'Activity', 'Admin Dashbord SWA menu', 'buddypress' ),
@@ -49,10 +49,9 @@ add_action( bp_core_admin_hook(), 'bp_activity_add_admin_menu' );
49
* which all appear together in the middle of the Dashboard menu. This function
50
* adds the Activity page to the array of these menu items.
51
*
52
- * @since BuddyPress (1.7.0)
53
*
54
* @param array $custom_menus The list of top-level BP menu items.
55
- *
56
* @return array $custom_menus List of top-level BP menu items, with Activity added.
57
*/
58
function bp_activity_admin_menu_order( $custom_menus = array() ) {
@@ -67,10 +66,10 @@ add_filter( 'bp_admin_menu_order', 'bp_activity_admin_menu_order' );
67
* Processes requests to add new activity comments, and echoes HTML for a new
68
* table row.
69
*
70
- * @since BuddyPress (1.6.0)
71
*/
72
function bp_activity_admin_reply() {
73
- // Check nonce
74
check_ajax_referer( 'bp-activity-admin-reply', '_ajax_nonce-bp-activity-admin-reply' );
75
76
$parent_id = ! empty( $_REQUEST['parent_id'] ) ? (int) $_REQUEST['parent_id'] : 0;
@@ -80,15 +79,15 @@ function bp_activity_admin_reply() {
80
if ( empty( $parent_id ) )
81
die( '-1' );
82
83
- // If $root_id not set (e.g. for root items), use $parent_id
84
if ( empty( $root_id ) )
85
$root_id = $parent_id;
86
87
- // Check that a reply has been entered
88
if ( empty( $_REQUEST['content'] ) )
89
die( __( 'ERROR: Please type a reply.', 'buddypress' ) );
90
91
- // Check parent activity exists
92
$parent_activity = new BP_Activity_Activity( $parent_id );
93
if ( empty( $parent_activity->component ) )
94
die( __( 'ERROR: The item you are trying to reply to cannot be found, or it has been deleted.', 'buddypress' ) );
@@ -98,25 +97,25 @@ function bp_activity_admin_reply() {
98
if ( ! current_user_can( 'bp_moderate' ) )
99
die( '-1' );
100
101
- // Add new activity comment
102
$new_activity_id = bp_activity_new_comment( array(
103
- 'activity_id' => $root_id, // ID of the root activity item
104
'content' => $_REQUEST['content'],
105
- 'parent_id' => $parent_id, // ID of a parent comment
106
) );
107
108
- // Fetch the new activity item, as we need it to create table markup to return
109
$new_activity = new BP_Activity_Activity( $new_activity_id );
110
111
- // This needs to be set for the BP_Activity_List_Table constructor to work
112
set_current_screen( 'toplevel_page_bp-activity' );
113
114
- // Set up an output buffer
115
ob_start();
116
$list_table = new BP_Activity_List_Table();
117
$list_table->single_row( (array) $new_activity );
118
119
- // Get table markup
120
$response = array(
121
'data' => ob_get_contents(),
122
'id' => $new_activity_id,
@@ -125,7 +124,7 @@ function bp_activity_admin_reply() {
125
);
126
ob_end_clean();
127
128
- // Send response
129
$r = new WP_Ajax_Response();
130
$r->add( $response );
131
$r->send();
@@ -137,19 +136,18 @@ add_action( 'wp_ajax_bp-activity-admin-reply', 'bp_activity_admin_reply' );
137
/**
138
* Handle save/update of screen options for the Activity component admin screen.
139
*
140
- * @since BuddyPress (1.6.0)
141
*
142
* @param string $value Will always be false unless another plugin filters it first.
143
* @param string $option Screen option name.
144
* @param string $new_value Screen option form value.
145
- *
146
* @return string Option value. False to abandon update.
147
*/
148
function bp_activity_admin_screen_options( $value, $option, $new_value ) {
149
if ( 'toplevel_page_bp_activity_per_page' != $option && 'toplevel_page_bp_activity_network_per_page' != $option )
150
return $value;
151
152
- // Per page
153
$new_value = (int) $new_value;
154
if ( $new_value < 1 || $new_value > 999 )
155
return $value;
@@ -160,24 +158,23 @@ function bp_activity_admin_screen_options( $value, $option, $new_value ) {
160
/**
161
* Hide the advanced edit meta boxes by default, so we don't clutter the screen.
162
*
163
- * @since BuddyPress (1.6.0)
164
*
165
* @param array $hidden Array of items to hide.
166
* @param WP_Screen $screen Screen identifier.
167
- *
168
* @return array Hidden Meta Boxes.
169
*/
170
function bp_activity_admin_edit_hidden_metaboxes( $hidden, $screen ) {
171
if ( empty( $screen->id ) || 'toplevel_page_bp-activity' != $screen->id && 'toplevel_page_bp-activity_network' != $screen->id )
172
return $hidden;
173
174
- // Hide the primary link meta box by default
175
$hidden = array_merge( (array) $hidden, array( 'bp_activity_itemids', 'bp_activity_link', 'bp_activity_type', 'bp_activity_userid', ) );
176
177
/**
178
* Filters default hidden metaboxes so plugins can alter list.
179
*
180
- * @since BuddyPress (1.6.0)
181
*
182
* @param array $hidden Default metaboxes to hide.
183
* @param WP_Screen $screen Screen identifier.
@@ -194,7 +191,7 @@ add_filter( 'default_hidden_meta_boxes', 'bp_activity_admin_edit_hidden_metaboxe
194
* - Enqueues scripts and styles.
195
* - Catches POST and GET requests related to Activity.
196
*
197
- * @since BuddyPress (1.6.0)
198
*
199
* @global object $bp BuddyPress global settings.
200
* @global BP_Activity_List_Table $bp_activity_list_table Activity screen list table.
@@ -204,7 +201,7 @@ function bp_activity_admin_load() {
204
205
$bp = buddypress();
206
207
- // Decide whether to load the dev version of the CSS and JavaScript
208
$min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : 'min.';
209
210
$doaction = bp_admin_list_table_current_bulk_action();
@@ -212,15 +209,15 @@ function bp_activity_admin_load() {
212
/**
213
* Fires at top of Activity admin page.
214
*
215
- * @since BuddyPress (1.6.0)
216
*
217
* @param string $doaction Current $_GET action being performed in admin screen.
218
*/
219
do_action( 'bp_activity_admin_load', $doaction );
220
221
- // Edit screen
222
if ( 'edit' == $doaction && ! empty( $_GET['aid'] ) ) {
223
- // columns screen option
224
add_screen_option( 'layout_columns', array( 'default' => 2, 'max' => 2, ) );
225
226
get_current_screen()->add_help_tab( array(
@@ -242,7 +239,7 @@ function bp_activity_admin_load() {
242
'<p>' . __( 'For information about when and how BuddyPress uses all of these settings, see the Managing Activity link in the panel to the side.', 'buddypress' ) . '</p>'
243
) );
244
245
- // Help panel - sidebar links
246
get_current_screen()->set_help_sidebar(
247
'<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
248
'<p>' . __( '<a href="https://codex.buddypress.org/administrator-guide/activity-stream-management-panels/">Managing Activity</a>', 'buddypress' ) . '</p>' .
@@ -256,20 +253,27 @@ function bp_activity_admin_load() {
256
add_meta_box( 'bp_activity_type', _x( 'Type', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_type', get_current_screen()->id, 'normal', 'core' );
257
add_meta_box( 'bp_activity_userid', _x( 'Author ID', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_userid', get_current_screen()->id, 'normal', 'core' );
258
259
- // Enqueue JavaScript files
260
wp_enqueue_script( 'postbox' );
261
wp_enqueue_script( 'dashboard' );
262
wp_enqueue_script( 'comment' );
263
264
- // Index screen
265
} else {
266
- // Create the Activity screen list table
267
$bp_activity_list_table = new BP_Activity_List_Table();
268
269
- // per_page screen option
270
add_screen_option( 'per_page', array( 'label' => _x( 'Activity', 'Activity items per page (screen options)', 'buddypress' )) );
271
272
- // Help panel - overview text
273
get_current_screen()->add_help_tab( array(
274
'id' => 'bp-activity-overview',
275
'title' => __( 'Overview', 'buddypress' ),
@@ -278,7 +282,7 @@ function bp_activity_admin_load() {
278
'<p>' . __( 'There are many different types of activities. Some are generated automatically by BuddyPress and other plugins, and some are entered directly by a user in the form of status update. To help manage the different activity types, use the filter dropdown box to switch between them.', 'buddypress' ) . '</p>'
279
) );
280
281
- // Help panel - moderation text
282
get_current_screen()->add_help_tab( array(
283
'id' => 'bp-activity-moderating',
284
'title' => __( 'Moderating Activity', 'buddypress' ),
@@ -287,14 +291,14 @@ function bp_activity_admin_load() {
287
'<p>' . __( "In the <strong>In Response To</strong> column, if the activity was in reply to another activity, it shows that activity's author's picture and name, and a link to that activity on your live site. If there is a small bubble, the number in it shows how many other activities are related to this one; these are usually comments. Clicking the bubble will filter the activity screen to show only related activity items.", 'buddypress' ) . '</p>'
288
) );
289
290
- // Help panel - sidebar links
291
get_current_screen()->set_help_sidebar(
292
'<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
293
'<p>' . __( '<a href="https://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
294
);
295
}
296
297
- // Enqueue CSS and JavaScript
298
wp_enqueue_script( 'bp_activity_admin_js', $bp->plugin_url . "bp-activity/admin/js/admin.{$min}js", array( 'jquery', 'wp-ajax-response' ), bp_get_version(), true );
299
wp_localize_script( 'bp_activity_admin_js', 'bp_activity_admin_vars', array(
300
'page' => get_current_screen()->id
@@ -306,21 +310,27 @@ function bp_activity_admin_load() {
306
wp_style_add_data( 'bp_activity_admin_css', 'suffix', $min );
307
}
308
309
310
- // Handle spam/un-spam/delete of activities
311
if ( !empty( $doaction ) && ! in_array( $doaction, array( '-1', 'edit', 'save', ) ) ) {
312
313
- // Build redirection URL
314
$redirect_to = remove_query_arg( array( 'aid', 'deleted', 'error', 'spammed', 'unspammed', ), wp_get_referer() );
315
$redirect_to = add_query_arg( 'paged', $bp_activity_list_table->get_pagenum(), $redirect_to );
316
317
- // Get activity IDs
318
$activity_ids = array_map( 'absint', (array) $_REQUEST['aid'] );
319
320
/**
321
* Filters list of IDs being spammed/un-spammed/deleted.
322
*
323
- * @since BuddyPress (1.6.0)
324
*
325
* @param array $activity_ids Activity IDs to spam/un-spam/delete.
326
*/
@@ -328,32 +338,32 @@ function bp_activity_admin_load() {
328
329
// Is this a bulk request?
330
if ( 'bulk_' == substr( $doaction, 0, 5 ) && ! empty( $_REQUEST['aid'] ) ) {
331
- // Check this is a valid form submission
332
check_admin_referer( 'bulk-activities' );
333
334
- // Trim 'bulk_' off the action name to avoid duplicating a ton of code
335
$doaction = substr( $doaction, 5 );
336
337
// This is a request to delete, spam, or un-spam, a single item.
338
} elseif ( !empty( $_REQUEST['aid'] ) ) {
339
340
- // Check this is a valid form submission
341
check_admin_referer( 'spam-activity_' . $activity_ids[0] );
342
}
343
344
- // Initialise counters for how many of each type of item we perform an action on
345
$deleted = $spammed = $unspammed = 0;
346
347
- // Store any errors that occurs when updating the database items
348
$errors = array();
349
350
// "We'd like to shoot the monster, could you move, please?"
351
foreach ( $activity_ids as $activity_id ) {
352
// @todo: Check the permissions on each
353
//if ( ! current_user_can( 'bp_edit_activity', $activity_id ) )
354
- // continue;
355
356
- // Get the activity from the database
357
$activity = new BP_Activity_Activity( $activity_id );
358
if ( empty( $activity->component ) ) {
359
$errors[] = $activity_id;
@@ -381,7 +391,7 @@ function bp_activity_admin_load() {
381
bp_activity_mark_as_ham( $activity );
382
$result = $activity->save();
383
384
- // Check for any error during activity save
385
if ( ! $result )
386
$errors[] = $activity->id;
387
else
@@ -392,7 +402,7 @@ function bp_activity_admin_load() {
392
bp_activity_mark_as_spam( $activity );
393
$result = $activity->save();
394
395
- // Check for any error during activity save
396
if ( ! $result )
397
$errors[] = $activity->id;
398
else
@@ -403,7 +413,7 @@ function bp_activity_admin_load() {
403
break;
404
}
405
406
- // Release memory
407
unset( $activity );
408
}
409
@@ -412,7 +422,7 @@ function bp_activity_admin_load() {
412
*
413
* Passes an activity array counts how many were spam, not spam, deleted, and IDs that were errors.
414
*
415
- * @since BuddyPress (1.6.0)
416
*
417
* @param array $value Array holding spam, not spam, deleted counts, error IDs.
418
* @param string $redirect_to URL to redirect to.
@@ -430,14 +440,14 @@ function bp_activity_admin_load() {
430
if ( $deleted )
431
$redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to );
432
433
- // If an error occurred, pass back the activity ID that failed
434
if ( ! empty( $errors ) )
435
$redirect_to = add_query_arg( 'error', implode ( ',', array_map( 'absint', $errors ) ), $redirect_to );
436
437
/**
438
* Filters redirect URL after activity spamming/un-spamming/deletion occurs.
439
*
440
- * @since BuddyPress (1.6.0)
441
*
442
* @param string $redirect_to URL to redirect to.
443
*/
@@ -445,73 +455,72 @@ function bp_activity_admin_load() {
445
exit;
446
447
448
- // Save the edit
449
} elseif ( $doaction && 'save' == $doaction ) {
450
- // Build redirection URL
451
$redirect_to = remove_query_arg( array( 'action', 'aid', 'deleted', 'error', 'spammed', 'unspammed', ), $_SERVER['REQUEST_URI'] );
452
453
- // Get activity ID
454
$activity_id = (int) $_REQUEST['aid'];
455
456
- // Check this is a valid form submission
457
check_admin_referer( 'edit-activity_' . $activity_id );
458
459
- // Get the activity from the database
460
$activity = new BP_Activity_Activity( $activity_id );
461
462
- // If the activity doesn't exist, just redirect back to the index
463
if ( empty( $activity->component ) ) {
464
wp_redirect( $redirect_to );
465
exit;
466
}
467
468
- // Check the form for the updated properties
469
-
470
- // Store any error that occurs when updating the database item
471
$error = 0;
472
473
- // Activity spam status
474
$prev_spam_status = $new_spam_status = false;
475
if ( ! empty( $_POST['activity_status'] ) ) {
476
$prev_spam_status = $activity->is_spam;
477
$new_spam_status = ( 'spam' == $_POST['activity_status'] ) ? true : false;
478
}
479
480
- // Activity action
481
if ( isset( $_POST['bp-activities-action'] ) )
482
$activity->action = $_POST['bp-activities-action'];
483
484
- // Activity content
485
if ( isset( $_POST['bp-activities-content'] ) )
486
$activity->content = $_POST['bp-activities-content'];
487
488
- // Activity primary link
489
if ( ! empty( $_POST['bp-activities-link'] ) )
490
$activity->primary_link = $_POST['bp-activities-link'];
491
492
- // Activity user ID
493
if ( ! empty( $_POST['bp-activities-userid'] ) )
494
$activity->user_id = (int) $_POST['bp-activities-userid'];
495
496
- // Activity item primary ID
497
if ( isset( $_POST['bp-activities-primaryid'] ) )
498
$activity->item_id = (int) $_POST['bp-activities-primaryid'];
499
500
- // Activity item secondary ID
501
if ( isset( $_POST['bp-activities-secondaryid'] ) )
502
$activity->secondary_item_id = (int) $_POST['bp-activities-secondaryid'];
503
504
- // Activity type
505
if ( ! empty( $_POST['bp-activities-type'] ) ) {
506
$actions = bp_activity_admin_get_activity_actions();
507
508
- // Check that the new type is a registered activity type
509
if ( in_array( $_POST['bp-activities-type'], $actions ) ) {
510
$activity->type = $_POST['bp-activities-type'];
511
}
512
}
513
514
- // Activity timestamp
515
if ( ! empty( $_POST['aa'] ) && ! empty( $_POST['mm'] ) && ! empty( $_POST['jj'] ) && ! empty( $_POST['hh'] ) && ! empty( $_POST['mn'] ) && ! empty( $_POST['ss'] ) ) {
516
$aa = $_POST['aa'];
517
$mm = $_POST['mm'];
@@ -527,7 +536,7 @@ function bp_activity_admin_load() {
527
$mn = ( $mn > 59 ) ? $mn -60 : $mn;
528
$ss = ( $ss > 59 ) ? $ss -60 : $ss;
529
530
- // Reconstruct the date into a timestamp
531
$gmt_date = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss );
532
533
$activity->date_recorded = $gmt_date;
@@ -541,26 +550,26 @@ function bp_activity_admin_load() {
541
bp_activity_mark_as_ham( $activity );
542
}
543
544
- // Save
545
$result = $activity->save();
546
547
- // Clear the activity stream first page cache, in case this activity's timestamp was changed
548
wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
549
550
- // Check for any error during activity save
551
if ( false === $result )
552
$error = $activity->id;
553
554
/**
555
* Fires before redirect so plugins can do something first on save action.
556
*
557
- * @since BuddyPress (1.6.0)
558
*
559
* @param array Array holding activity object and ID that holds error.
560
*/
561
do_action_ref_array( 'bp_activity_admin_edit_after', array( &$activity, $error ) );
562
563
- // If an error occurred, pass back the activity ID that failed
564
if ( $error )
565
$redirect_to = add_query_arg( 'error', (int) $error, $redirect_to );
566
else
@@ -569,7 +578,7 @@ function bp_activity_admin_load() {
569
/**
570
* Filters URL to redirect to after saving.
571
*
572
- * @since BuddyPress (1.6.0)
573
*
574
* @param string $redirect_to URL to redirect to.
575
*/
@@ -587,17 +596,17 @@ function bp_activity_admin_load() {
587
/**
588
* Output the Activity component admin screens.
589
*
590
- * @since BuddyPress (1.6.0)
591
*/
592
function bp_activity_admin() {
593
- // Decide whether to load the index or edit screen
594
$doaction = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
595
596
- // Display the single activity edit screen
597
if ( 'edit' == $doaction && ! empty( $_GET['aid'] ) )
598
bp_activity_admin_edit();
599
600
- // Otherwise, display the Activity index screen
601
else
602
bp_activity_admin_index();
603
}
@@ -605,7 +614,7 @@ function bp_activity_admin() {
605
/**
606
* Display the single activity edit screen.
607
*
608
- * @since BuddyPress (1.6.0)
609
*/
610
function bp_activity_admin_edit() {
611
@@ -614,7 +623,7 @@ function bp_activity_admin_edit() {
614
if ( ! is_super_admin() )
615
die( '-1' );
616
617
- // Get the activity from the database
618
$activity = bp_activity_get( array(
619
'in' => ! empty( $_REQUEST['aid'] ) ? (int) $_REQUEST['aid'] : 0,
620
'max' => 1,
@@ -626,28 +635,27 @@ function bp_activity_admin_edit() {
626
if ( ! empty( $activity['activities'][0] ) ) {
627
$activity = $activity['activities'][0];
628
629
- // Workaround to use WP's touch_time() without duplicating that function
630
$GLOBALS['comment'] = new stdClass;
631
$GLOBALS['comment']->comment_date = $activity->date_recorded;
632
} else {
633
$activity = '';
634
}
635
636
- // Construct URL for form
637
$form_url = remove_query_arg( array( 'action', 'deleted', 'error', 'spammed', 'unspammed', ), $_SERVER['REQUEST_URI'] );
638
$form_url = add_query_arg( 'action', 'save', $form_url );
639
640
/**
641
* Fires before activity edit form is displays so plugins can modify the activity.
642
*
643
- * @since BuddyPress (1.6.0)
644
*
645
* @param array $value Array holding single activity object that was passed by reference.
646
*/
647
do_action_ref_array( 'bp_activity_admin_edit', array( &$activity ) ); ?>
648
649
<div class="wrap">
650
- <?php screen_icon( 'buddypress-activity' ); ?>
651
<h2><?php printf( __( 'Editing Activity (ID #%s)', 'buddypress' ), number_format_i18n( (int) $_REQUEST['aid'] ) ); ?></h2>
652
653
<?php if ( ! empty( $activity ) ) : ?>
@@ -691,7 +699,10 @@ function bp_activity_admin_edit() {
691
</form>
692
693
<?php else : ?>
694
- <p><?php printf( __( 'No activity found with this ID. <a href="%s">Go back and try again</a>.', 'buddypress' ), esc_url( bp_get_admin_url( 'admin.php?page=bp-activity' ) ) ); ?></p>
695
<?php endif; ?>
696
697
</div><!-- .wrap -->
@@ -702,7 +713,7 @@ function bp_activity_admin_edit() {
702
/**
703
* Status metabox for the Activity admin edit screen.
704
*
705
- * @since BuddyPress (1.6.0)
706
*
707
* @param object $item Activity item.
708
*/
@@ -722,17 +733,17 @@ function bp_activity_admin_edit_metabox_status( $item ) {
722
723
<div id="misc-publishing-actions">
724
<div class="misc-pub-section" id="comment-status-radio">
725
- <label class="approved"><input type="radio" name="activity_status" value="ham" <?php checked( $item->is_spam, 0 ); ?>><?php _e( 'Approved', 'buddypress' ); ?></label><br />
726
- <label class="spam"><input type="radio" name="activity_status" value="spam" <?php checked( $item->is_spam, 1 ); ?>><?php _e( 'Spam', 'buddypress' ); ?></label>
727
</div>
728
729
<div class="misc-pub-section curtime misc-pub-section-last">
730
<?php
731
- // translators: Publish box date format, see http://php.net/date
732
$datef = __( 'M j, Y @ G:i', 'buddypress' );
733
$date = date_i18n( $datef, strtotime( $item->date_recorded ) );
734
?>
735
- <span id="timestamp"><?php printf( __( 'Submitted on: <strong>%1$s</strong>', 'buddypress' ), $date ); ?></span>&nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e( 'Edit', 'buddypress' ); ?></a>
736
737
<div id='timestampdiv' class='hide-if-js'>
738
<?php touch_time( 1, 0, 5 ); ?>
@@ -745,7 +756,7 @@ function bp_activity_admin_edit_metabox_status( $item ) {
745
746
<div id="major-publishing-actions">
747
<div id="publishing-action">
748
- <?php submit_button( __( 'Update', 'buddypress' ), 'primary', 'save', false, array( 'tabindex' => '4' ) ); ?>
749
</div>
750
<div class="clear"></div>
751
</div><!-- #major-publishing-actions -->
@@ -758,7 +769,7 @@ function bp_activity_admin_edit_metabox_status( $item ) {
758
/**
759
* Primary link metabox for the Activity admin edit screen.
760
*
761
- * @since BuddyPress (1.6.0)
762
*
763
* @param object $item Activity item.
764
*/
@@ -766,8 +777,8 @@ function bp_activity_admin_edit_metabox_link( $item ) {
766
?>
767
768
<label class="screen-reader-text" for="bp-activities-link"><?php _e( 'Link', 'buddypress' ); ?></label>
769
- <input type="url" name="bp-activities-link" value="<?php echo esc_url( $item->primary_link ); ?>" />
770
- <p><?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>
771
772
<?php
773
}
@@ -775,7 +786,7 @@ function bp_activity_admin_edit_metabox_link( $item ) {
775
/**
776
* User ID metabox for the Activity admin edit screen.
777
*
778
- * @since BuddyPress (1.6.0)
779
*
780
* @param object $item Activity item.
781
*/
@@ -783,7 +794,7 @@ function bp_activity_admin_edit_metabox_userid( $item ) {
783
?>
784
785
<label class="screen-reader-text" for="bp-activities-userid"><?php _e( 'Author ID', 'buddypress' ); ?></label>
786
- <input type="number" name="bp-activities-userid" value="<?php echo esc_attr( $item->user_id ); ?>" min="1" />
787
788
<?php
789
}
@@ -793,9 +804,9 @@ function bp_activity_admin_edit_metabox_userid( $item ) {
793
*
794
* Format is [activity_type] => Pretty name for activity type.
795
*
796
- * @since BuddyPress (2.0.0)
797
*
798
- * @return array
799
*/
800
function bp_activity_admin_get_activity_actions() {
801
$actions = array();
@@ -809,10 +820,10 @@ function bp_activity_admin_get_activity_actions() {
809
}
810
}
811
812
- // This was a mis-named activity type from before BP 1.6
813
unset( $actions['friends_register_activity_action'] );
814
815
- // Sort array by the human-readable value
816
natsort( $actions );
817
818
return $actions;
@@ -821,7 +832,7 @@ function bp_activity_admin_get_activity_actions() {
821
/**
822
* Activity type metabox for the Activity admin edit screen.
823
*
824
- * @since BuddyPress (1.6.0)
825
*
826
* @param object $item Activity item.
827
*/
@@ -839,15 +850,17 @@ function bp_activity_admin_edit_metabox_type( $item ) {
839
$actions[ $action[$i]['key'] ] = $action[$i]['value'];
840
}
841
842
- // This was a mis-named activity type from before BP 1.6
843
unset( $actions['friends_register_activity_action'] );
844
845
- // Sort array by the human-readable value
846
natsort( $actions );
847
848
- // If the activity type is not registered properly (eg, a plugin has
849
- // not called bp_activity_set_action()), add the raw type to the end
850
- // of the list
851
if ( ! isset( $actions[ $selected ] ) ) {
852
_doing_it_wrong( __FUNCTION__, sprintf( __( 'This activity item has a type (%s) that is not registered using bp_activity_set_action(), so no label is available.', 'buddypress' ), $selected ), '2.0.0' );
853
$actions[ $selected ] = $selected;
@@ -855,7 +868,8 @@ function bp_activity_admin_edit_metabox_type( $item ) {
855
856
?>
857
858
- <select name="bp-activities-type">
859
<?php foreach ( $actions as $k => $v ) : ?>
860
<option value="<?php echo esc_attr( $k ); ?>" <?php selected( $k, $selected ); ?>><?php echo esc_html( $v ); ?></option>
861
<?php endforeach; ?>
@@ -867,7 +881,7 @@ function bp_activity_admin_edit_metabox_type( $item ) {
867
/**
868
* Primary item ID/Secondary item ID metabox for the Activity admin edit screen.
869
*
870
- * @since BuddyPress (1.6.0)
871
*
872
* @param object $item Activity item.
873
*/
@@ -889,7 +903,7 @@ function bp_activity_admin_edit_metabox_itemids( $item ) {
889
/**
890
* Display the Activity admin index screen, which contains a list of all the activities.
891
*
892
- * @since BuddyPress (1.6.0)
893
*
894
* @global BP_Activity_List_Table $bp_activity_list_table Activity screen list table.
895
* @global string $plugin_page The current plugin page.
@@ -899,7 +913,7 @@ function bp_activity_admin_index() {
899
900
$messages = array();
901
902
- // If the user has just made a change to an activity item, build status messages
903
if ( ! empty( $_REQUEST['deleted'] ) || ! empty( $_REQUEST['spammed'] ) || ! empty( $_REQUEST['unspammed'] ) || ! empty( $_REQUEST['error'] ) || ! empty( $_REQUEST['updated'] ) ) {
904
$deleted = ! empty( $_REQUEST['deleted'] ) ? (int) $_REQUEST['deleted'] : 0;
905
$errors = ! empty( $_REQUEST['error'] ) ? $_REQUEST['error'] : '';
@@ -909,14 +923,14 @@ function bp_activity_admin_index() {
909
910
$errors = array_map( 'absint', explode( ',', $errors ) );
911
912
- // Make sure we don't get any empty values in $errors
913
for ( $i = 0, $errors_count = count( $errors ); $i < $errors_count; $i++ ) {
914
if ( 0 === $errors[$i] ) {
915
unset( $errors[$i] );
916
}
917
}
918
919
- // Reindex array
920
$errors = array_values( $errors );
921
922
if ( $deleted > 0 )
@@ -930,9 +944,9 @@ function bp_activity_admin_index() {
930
$error_msg = __( 'Errors occurred when trying to update these activity items:', 'buddypress' );
931
$error_msg .= '<ul class="activity-errors">';
932
933
- // Display each error as a list item
934
foreach ( $errors as $error ) {
935
- // Translators: This is a bulleted list of item IDs
936
$error_msg .= '<li>' . sprintf( __( '#%s', 'buddypress' ), number_format_i18n( $error ) ) . '</li>';
937
}
938
@@ -951,20 +965,19 @@ function bp_activity_admin_index() {
951
$messages[] = __( 'The activity item has been updated successfully.', 'buddypress' );
952
}
953
954
- // Prepare the activity items for display
955
$bp_activity_list_table->prepare_items();
956
957
/**
958
* Fires before edit form is displayed so plugins can modify the activity messages.
959
*
960
- * @since BuddyPress (1.6.0)
961
*
962
* @param array $messages Array of messages to display at top of page.
963
*/
964
do_action( 'bp_activity_admin_index', $messages ); ?>
965
966
<div class="wrap">
967
- <?php screen_icon( 'buddypress-activity' ); ?>
968
<h2>
969
<?php if ( !empty( $_REQUEST['aid'] ) ) : ?>
970
<?php printf( __( 'Activity related to ID #%s', 'buddypress' ), number_format_i18n( (int) $_REQUEST['aid'] ) ); ?>
@@ -977,12 +990,12 @@ function bp_activity_admin_index() {
977
<?php endif; ?>
978
</h2>
979
980
- <?php // If the user has just made a change to an activity item, display the status messages ?>
981
<?php if ( !empty( $messages ) ) : ?>
982
<div id="moderated" class="<?php echo ( ! empty( $_REQUEST['error'] ) ) ? 'error' : 'updated'; ?>"><p><?php echo implode( "<br/>\n", $messages ); ?></p></div>
983
<?php endif; ?>
984
985
- <?php // Display each activity on its own row ?>
986
<?php $bp_activity_list_table->views(); ?>
987
988
<form id="bp-activities-form" action="" method="get">
@@ -991,7 +1004,7 @@ function bp_activity_admin_index() {
991
<?php $bp_activity_list_table->display(); ?>
992
</form>
993
994
- <?php // This markup is used for the reply form ?>
995
<table style="display: none;">
996
<tr id="bp-activities-container" style="display: none;">
997
<td colspan="4">
@@ -1023,55 +1036,54 @@ function bp_activity_admin_index() {
1023
/**
1024
* List table class for the Activity component admin page.
1025
*
1026
- * @since BuddyPress (1.6.0)
1027
*/
1028
class BP_Activity_List_Table extends WP_List_Table {
1029
1030
/**
1031
* What type of view is being displayed?
1032
*
1033
- * e.g. "all", "pending", "approved", "spam"...
1034
*
1035
- * @since BuddyPress (1.6.0)
1036
- * @var string
1037
*/
1038
public $view = 'all';
1039
1040
/**
1041
* How many activity items have been marked as spam.
1042
*
1043
- * @since BuddyPress (1.6.0)
1044
- * @var int
1045
*/
1046
public $spam_count = 0;
1047
1048
/**
1049
* Store activity-to-user-ID mappings for use in the In Response To column.
1050
*
1051
- * @since BuddyPress (1.6.0)
1052
- * @var array
1053
*/
1054
protected $activity_user_id = array();
1055
1056
/**
1057
* If users can comment on blog & forum activity items.
1058
*
1059
- * @since BuddyPress (2.2.2)
1060
- *
1061
* @link https://buddypress.trac.wordpress.org/ticket/6277
1062
*
1063
- * @var bool
1064
*/
1065
public $disable_blogforum_comments = false;
1066
1067
/**
1068
* Constructor.
1069
*
1070
- * @since BuddyPress (1.6.0)
1071
*/
1072
public function __construct() {
1073
1074
- // See if activity commenting is enabled for blog / forum activity items
1075
$this->disable_blogforum_comments = bp_disable_blogforum_comments();
1076
1077
// Define singular and plural labels, as well as whether we support AJAX.
@@ -1086,38 +1098,38 @@ class BP_Activity_List_Table extends WP_List_Table {
1086
/**
1087
* Handle filtering of data, sorting, pagination, and any other data manipulation prior to rendering.
1088
*
1089
- * @since BuddyPress (1.6.0)
1090
*/
1091
function prepare_items() {
1092
1093
- // Option defaults
1094
$filter = array();
1095
$include_id = false;
1096
$search_terms = false;
1097
$sort = 'DESC';
1098
$spam = 'ham_only';
1099
1100
- // Set current page
1101
$page = $this->get_pagenum();
1102
1103
- // Set per page from the screen options
1104
$per_page = $this->get_items_per_page( str_replace( '-', '_', "{$this->screen->id}_per_page" ) );
1105
1106
- // Check if we're on the "Spam" view
1107
if ( !empty( $_REQUEST['activity_status'] ) && 'spam' == $_REQUEST['activity_status'] ) {
1108
$spam = 'spam_only';
1109
$this->view = 'spam';
1110
}
1111
1112
- // Sort order
1113
if ( !empty( $_REQUEST['order'] ) && 'desc' != $_REQUEST['order'] )
1114
$sort = 'ASC';
1115
1116
- // Order by
1117
/*if ( !empty( $_REQUEST['orderby'] ) ) {
1118
}*/
1119
1120
- // Filter
1121
if ( !empty( $_REQUEST['activity_type'] ) )
1122
$filter = array( 'action' => $_REQUEST['activity_type'] );
1123
@@ -1129,7 +1141,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1129
if ( !empty( $_REQUEST['aid'] ) )
1130
$include_id = (int) $_REQUEST['aid'];
1131
1132
- // Get the spam total (ignoring any search query or filter)
1133
$spams = bp_activity_get( array(
1134
'display_comments' => 'stream',
1135
'show_hidden' => true,
@@ -1139,7 +1151,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1139
$this->spam_count = $spams['total'];
1140
unset( $spams );
1141
1142
- // Get the activities from the database
1143
$activities = bp_activity_get( array(
1144
'display_comments' => 'stream',
1145
'filter' => $filter,
@@ -1148,7 +1160,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1148
'per_page' => $per_page,
1149
'search_terms' => $search_terms,
1150
'show_hidden' => true,
1151
- //'sort' => $sort,
1152
'spam' => $spam,
1153
'count_total' => 'count_query',
1154
) );
@@ -1158,23 +1170,23 @@ class BP_Activity_List_Table extends WP_List_Table {
1158
$activities['activities'] = BP_Activity_List_Table::flatten_activity_array( $activities['activities'] );
1159
$activities['total'] = count( $activities['activities'] );
1160
1161
- // Sort the array by the activity object's date_recorded value
1162
usort( $activities['activities'], create_function( '$a, $b', 'return $a->date_recorded > $b->date_recorded;' ) );
1163
}
1164
1165
- // bp_activity_get returns an array of objects; cast these to arrays for WP_List_Table.
1166
$new_activities = array();
1167
foreach ( $activities['activities'] as $activity_item ) {
1168
$new_activities[] = (array) $activity_item;
1169
1170
- // Build an array of activity-to-user ID mappings for better efficiency in the In Response To column
1171
$this->activity_user_id[$activity_item->id] = $activity_item->user_id;
1172
}
1173
1174
- // Set raw data to display
1175
$this->items = $new_activities;
1176
1177
- // Store information needed for handling table pagination
1178
$this->set_pagination_args( array(
1179
'per_page' => $per_page,
1180
'total_items' => $activities['total'],
@@ -1188,7 +1200,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1188
/**
1189
* Get an array of all the columns on the page.
1190
*
1191
- * @since BuddyPress (1.6.0)
1192
*
1193
* @return array Column headers.
1194
*/
@@ -1203,10 +1215,21 @@ class BP_Activity_List_Table extends WP_List_Table {
1203
return $this->_column_headers;
1204
}
1205
1206
/**
1207
* Display a message on screen when no items are found (e.g. no search matches).
1208
*
1209
- * @since BuddyPress (1.6.0)
1210
*/
1211
function no_items() {
1212
_e( 'No activities found.', 'buddypress' );
@@ -1215,8 +1238,8 @@ class BP_Activity_List_Table extends WP_List_Table {
1215
/**
1216
* Output the Activity data table.
1217
*
1218
- * @since BuddyPress (1.6.0)
1219
- */
1220
function display() {
1221
$this->display_tablenav( 'top' ); ?>
1222
@@ -1245,7 +1268,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1245
/**
1246
* Generate content for a single row of the table.
1247
*
1248
- * @since BuddyPress (1.6.0)
1249
*
1250
* @param object $item The current item.
1251
*/
@@ -1274,7 +1297,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1274
/**
1275
* Get the list of views available on this table (e.g. "all", "spam").
1276
*
1277
- * @since BuddyPress (1.6.0)
1278
*/
1279
function get_views() {
1280
$url_base = add_query_arg( array( 'page' => 'bp-activity' ), bp_get_admin_url( 'admin.php' ) ); ?>
@@ -1288,7 +1311,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1288
/**
1289
* Fires inside listing of views so plugins can add their own.
1290
*
1291
- * @since BuddyPress (1.6.0)
1292
*
1293
* @param string $url_base Current URL base for view.
1294
* @param string $view Current view being displayed.
@@ -1301,7 +1324,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1301
/**
1302
* Get bulk actions.
1303
*
1304
- * @since BuddyPress (1.6.0)
1305
*
1306
* @return array Key/value pairs for the bulk actions dropdown.
1307
*/
@@ -1314,7 +1337,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1314
/**
1315
* Filters the default bulk actions so plugins can add custom actions.
1316
*
1317
- * @since BuddyPress (1.6.0)
1318
*
1319
* @param array $actions Default available actions for bulk operations.
1320
*/
@@ -1324,20 +1347,27 @@ class BP_Activity_List_Table extends WP_List_Table {
1324
/**
1325
* Get the table column titles.
1326
*
1327
- * @since BuddyPress (1.6.0)
1328
*
1329
* @see WP_List_Table::single_row_columns()
1330
*
1331
* @return array The columns to appear in the Activity list table.
1332
*/
1333
function get_columns() {
1334
- return array(
1335
'cb' => '<input name type="checkbox" />',
1336
'author' => _x('Author', 'Admin SWA column header', 'buddypress' ),
1337
'comment' => _x( 'Activity', 'Admin SWA column header', 'buddypress' ),
1338
'action' => _x( 'Action', 'Admin SWA column header', 'buddypress' ),
1339
'response' => _x( 'In Response To', 'Admin SWA column header', 'buddypress' ),
1340
- );
1341
}
1342
1343
/**
@@ -1345,7 +1375,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1345
*
1346
* Currently, returns an empty array (no columns are sortable).
1347
*
1348
- * @since BuddyPress (1.6.0)
1349
* @todo For this to work, BP_Activity_Activity::get() needs updating
1350
* to support ordering by specific fields.
1351
*
@@ -1362,13 +1392,13 @@ class BP_Activity_List_Table extends WP_List_Table {
1362
/**
1363
* Markup for the "filter" part of the form (i.e. which activity type to display).
1364
*
1365
- * @since BuddyPress (1.6.0)
1366
*
1367
* @param string $which 'top' or 'bottom'.
1368
*/
1369
function extra_tablenav( $which ) {
1370
1371
- // Bail on bottom table nav
1372
if ( 'bottom' === $which ) {
1373
return;
1374
}
@@ -1376,11 +1406,12 @@ class BP_Activity_List_Table extends WP_List_Table {
1376
// Is any filter currently selected?
1377
$selected = ( ! empty( $_REQUEST['activity_type'] ) ) ? $_REQUEST['activity_type'] : '';
1378
1379
- // Get the actions
1380
$activity_actions = bp_activity_get_actions(); ?>
1381
1382
<div class="alignleft actions">
1383
- <select name="activity_type">
1384
<option value="" <?php selected( ! $selected ); ?>><?php _e( 'View all actions', 'buddypress' ); ?></option>
1385
1386
<?php foreach ( $activity_actions as $component => $actions ) : ?>
@@ -1391,7 +1422,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1391
1392
<?php
1393
1394
- // Skip the incorrectly named pre-1.6 action
1395
if ( 'friends_register_activity_action' !== $action_key ) : ?>
1396
1397
<option value="<?php echo esc_attr( $action_key ); ?>" <?php selected( $action_key, $selected ); ?>><?php echo esc_html( $action_values[ 'value' ] ); ?></option>
@@ -1421,8 +1452,8 @@ class BP_Activity_List_Table extends WP_List_Table {
1421
* @since 2.3.3
1422
* @since 2.3.4 Visibility set to public for compatibility with WP < 4.0.0.
1423
*
1424
- * @param array $actions The list of actions
1425
- * @param bool $always_visible Whether the actions should be always visible
1426
* @return string
1427
*/
1428
public function row_actions( $actions, $always_visible = false ) {
@@ -1446,7 +1477,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1446
/**
1447
* Checkbox column markup.
1448
*
1449
- * @since BuddyPress (1.6.0)
1450
*
1451
* @see WP_List_Table::single_row_columns()
1452
*
@@ -1459,7 +1490,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1459
/**
1460
* Author column markup.
1461
*
1462
- * @since BuddyPress (1.6.0)
1463
*
1464
* @see WP_List_Table::single_row_columns()
1465
*
@@ -1472,7 +1503,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1472
/**
1473
* Action column markup.
1474
*
1475
- * @since BuddyPress (2.0.0)
1476
*
1477
* @see WP_List_Table::single_row_columns()
1478
*
@@ -1493,20 +1524,20 @@ class BP_Activity_List_Table extends WP_List_Table {
1493
*
1494
* Called "comment" in the CSS so we can re-use some WP core CSS.
1495
*
1496
- * @since BuddyPress (1.6.0)
1497
*
1498
* @see WP_List_Table::single_row_columns()
1499
*
1500
* @param array $item A singular item (one full row).
1501
*/
1502
function column_comment( $item ) {
1503
- // Determine what type of item (row) we're dealing with
1504
if ( $item['is_spam'] )
1505
$item_status = 'spam';
1506
else
1507
$item_status = 'all';
1508
1509
- // Preorder items: Reply | Edit | Spam | Delete Permanently
1510
$actions = array(
1511
'reply' => '',
1512
'edit' => '',
@@ -1514,7 +1545,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1514
'delete' => '',
1515
);
1516
1517
- // Build actions URLs
1518
$base_url = bp_get_admin_url( 'admin.php?page=bp-activity&amp;aid=' . $item['id'] );
1519
$spam_nonce = esc_html( '_wpnonce=' . wp_create_nonce( 'spam-activity_' . $item['id'] ) );
1520
@@ -1523,8 +1554,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1523
$ham_url = $base_url . "&amp;action=ham&amp;$spam_nonce";
1524
$spam_url = $base_url . "&amp;action=spam&amp;$spam_nonce";
1525
1526
- // Rollover actions
1527
-
1528
// Reply - JavaScript only; implemented by AJAX.
1529
if ( 'spam' != $item_status ) {
1530
if ( $this->can_comment( $item ) ) {
@@ -1533,26 +1563,26 @@ class BP_Activity_List_Table extends WP_List_Table {
1533
$actions['reply'] = sprintf( '<span class="form-input-tip" title="%s">%s</span>', __( 'Replies are disabled for this activity item', 'buddypress' ), __( 'Replies disabled', 'buddypress' ) );
1534
}
1535
1536
- // Edit
1537
$actions['edit'] = sprintf( '<a href="%s">%s</a>', $edit_url, __( 'Edit', 'buddypress' ) );
1538
}
1539
1540
- // Spam/unspam
1541
if ( 'spam' == $item_status )
1542
$actions['unspam'] = sprintf( '<a href="%s">%s</a>', $ham_url, __( 'Not Spam', 'buddypress' ) );
1543
else
1544
$actions['spam'] = sprintf( '<a href="%s">%s</a>', $spam_url, __( 'Spam', 'buddypress' ) );
1545
1546
- // Delete
1547
$actions['delete'] = sprintf( '<a href="%s" onclick="%s">%s</a>', $delete_url, "javascript:return confirm('" . esc_js( __( 'Are you sure?', 'buddypress' ) ) . "'); ", __( 'Delete Permanently', 'buddypress' ) );
1548
1549
- // Start timestamp
1550
echo '<div class="submitted-on">';
1551
1552
/**
1553
* Filters available actions for plugins to alter.
1554
*
1555
- * @since BuddyPress (1.6.0)
1556
*
1557
* @param array $actions Array of available actions user could use.
1558
* @param array $item Current item being added to page.
@@ -1560,18 +1590,23 @@ class BP_Activity_List_Table extends WP_List_Table {
1560
$actions = apply_filters( 'bp_activity_admin_comment_row_actions', array_filter( $actions ), $item );
1561
1562
/* translators: 2: activity admin ui date/time */
1563
- printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>', 'buddypress' ), bp_activity_get_permalink( $item['id'] ), get_date_from_gmt( $item['date_recorded'], get_option( 'date_format' ) ), get_date_from_gmt( $item['date_recorded'], get_option( 'time_format' ) ) );
1564
1565
- // End timestamp
1566
echo '</div>';
1567
1568
- // Get activity content - if not set, use the action
1569
if ( ! empty( $item['content'] ) ) {
1570
1571
/**
1572
* Filters current activity item content.
1573
*
1574
- * @since BuddyPress (1.2.0)
1575
*
1576
* @param array $item Array index holding current activity item content.
1577
*/
@@ -1580,26 +1615,35 @@ class BP_Activity_List_Table extends WP_List_Table {
1580
/**
1581
* Filters current activity item action.
1582
*
1583
- * @since BuddyPress (1.2.0)
1584
*
1585
* @var array $item Array index holding current activity item action.
1586
*/
1587
$content = apply_filters_ref_array( 'bp_get_activity_action', array( $item['action'] ) );
1588
}
1589
1590
- echo $content . ' ' . $this->row_actions( $actions );
1591
}
1592
1593
/**
1594
* "In response to" column markup.
1595
*
1596
- * @since BuddyPress (1.6.0)
1597
*
1598
* @see WP_List_Table::single_row_columns()
1599
*
1600
* @param array $item A singular item (one full row).
1601
*/
1602
function column_response( $item ) {
1603
// Is $item is a root activity?
1604
?>
1605
@@ -1609,13 +1653,13 @@ class BP_Activity_List_Table extends WP_List_Table {
1609
// Activity permalink
1610
$activity_permalink = '';
1611
if ( ! $item['is_spam'] ) {
1612
- $activity_permalink = sprintf( __( '<a href="%1$s" class="comments-view-item-link">View Activity</a>', 'buddypress' ), bp_activity_get_permalink( $item['id'], (object) $item ) );
1613