BuddyPress - Version 2.0.4

Version Description

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

Download this release

Release Info

Developer boonebgorges
Plugin Icon 128x128 BuddyPress
Version 2.0.4
Comparing to
See all releases

Code changes from version 2.4.0-rc1 to 2.0.4

Files changed (518) hide show
  1. .travis.yml +48 -0
  2. bp-activity/admin/css/admin-rtl.css +0 -87
  3. bp-activity/admin/css/admin-rtl.min.css +0 -1
  4. bp-activity/admin/css/admin.css +0 -7
  5. bp-activity/admin/css/admin.min.css +1 -1
  6. bp-activity/admin/js/admin.js +17 -20
  7. bp-activity/admin/js/admin.min.js +1 -2
  8. bp-activity/bp-activity-actions.php +91 -274
  9. bp-activity/bp-activity-admin.php +258 -523
  10. bp-activity/bp-activity-akismet.php +103 -162
  11. bp-activity/bp-activity-cache.php +10 -12
  12. bp-activity/bp-activity-classes.php +1675 -7
  13. bp-activity/bp-activity-cssjs.php +0 -75
  14. bp-activity/bp-activity-filters.php +73 -323
  15. bp-activity/bp-activity-functions.php +567 -1708
  16. bp-activity/bp-activity-loader.php +90 -115
  17. bp-activity/bp-activity-notifications.php +59 -219
  18. bp-activity/bp-activity-screens.php +64 -194
  19. bp-activity/bp-activity-template.php +847 -2007
  20. bp-activity/classes/class-bp-activity-activity.php +0 -1793
  21. bp-activity/classes/class-bp-activity-feed.php +0 -447
  22. bp-activity/classes/class-bp-activity-query.php +0 -246
  23. bp-activity/css/mentions-rtl.css +0 -93
  24. bp-activity/css/mentions-rtl.min.css +0 -1
  25. bp-activity/css/mentions.css +0 -93
  26. bp-activity/css/mentions.min.css +0 -1
  27. bp-activity/js/mentions.js +0 -255
  28. bp-activity/js/mentions.min.js +0 -2
  29. bp-blogs/bp-blogs-actions.php +3 -2
  30. bp-blogs/bp-blogs-activity.php +107 -305
  31. bp-blogs/bp-blogs-buddybar.php +78 -0
  32. bp-blogs/bp-blogs-cache.php +23 -14
  33. bp-blogs/bp-blogs-classes.php +518 -3
  34. bp-blogs/bp-blogs-filters.php +5 -93
  35. bp-blogs/bp-blogs-functions.php +298 -523
  36. bp-blogs/bp-blogs-loader.php +42 -143
  37. bp-blogs/bp-blogs-screens.php +28 -60
  38. bp-blogs/bp-blogs-template.php +251 -645
  39. bp-blogs/bp-blogs-widgets.php +34 -63
  40. bp-blogs/classes/class-bp-blogs-blog.php +0 -619
  41. bp-core/admin/{bp-core-admin-actions.php → bp-core-actions.php} +36 -98
  42. bp-core/admin/{bp-core-admin-components.php → bp-core-components.php} +25 -45
  43. bp-core/admin/{bp-core-admin-functions.php → bp-core-functions.php} +146 -214
  44. bp-core/admin/{bp-core-admin-schema.php → bp-core-schema.php} +134 -244
  45. bp-core/admin/{bp-core-admin-settings.php → bp-core-settings.php} +91 -117
  46. bp-core/admin/{bp-core-admin-slugs.php → bp-core-slugs.php} +19 -41
  47. bp-core/admin/{bp-core-admin-tools.php → bp-core-tools.php} +22 -87
  48. bp-core/admin/css/common-rtl.css +0 -258
  49. bp-core/admin/css/common-rtl.min.css +0 -1
  50. bp-core/admin/css/common.css +290 -115
  51. bp-core/admin/css/common.min.css +1 -1
  52. bp-core/admin/images/accessibility.gif +0 -0
  53. bp-core/admin/images/avatar-ui.gif +0 -0
  54. bp-core/admin/images/group-cover-image.png +0 -0
  55. bp-core/admin/images/group-home-page.png +0 -0
  56. bp-core/admin/images/icons32.png +0 -0
  57. bp-core/admin/images/icons64.png +0 -0
  58. bp-core/admin/images/member-type-field.png +0 -0
  59. bp-core/admin/images/menu-2x.png +0 -0
  60. bp-core/admin/images/menu-wp.png +0 -0
  61. bp-core/admin/images/menu.png +0 -0
  62. bp-core/admin/images/theme-stylesheets.png +0 -0
  63. bp-core/bp-core-actions.php +14 -17
  64. bp-core/bp-core-admin.php +260 -404
  65. bp-core/bp-core-adminbar.php +18 -36
  66. bp-core/bp-core-attachments.php +0 -1373
  67. bp-core/bp-core-avatars.php +430 -1244
  68. bp-core/bp-core-buddybar.php +374 -499
  69. bp-core/bp-core-cache.php +33 -36
  70. bp-core/bp-core-caps.php +47 -170
  71. bp-core/bp-core-catchuri.php +95 -239
  72. bp-core/bp-core-classes.php +2406 -18
  73. bp-core/bp-core-component.php +119 -337
  74. bp-core/bp-core-cssjs.php +23 -326
  75. bp-core/bp-core-dependency.php +41 -341
  76. bp-core/bp-core-filters.php +85 -642
  77. bp-core/bp-core-functions.php +215 -916
  78. bp-core/bp-core-loader.php +65 -91
  79. bp-core/bp-core-moderation.php +73 -137
  80. bp-core/bp-core-options.php +83 -377
  81. bp-core/bp-core-taxonomy.php +0 -117
  82. bp-core/bp-core-template-loader.php +73 -186
  83. bp-core/bp-core-template.php +651 -1343
  84. bp-core/bp-core-theme-compatibility.php +82 -333
  85. bp-core/bp-core-update.php +278 -438
  86. bp-core/bp-core-widgets.php +454 -65
  87. bp-core/bp-core-wpabstraction.php +13 -20
  88. bp-core/classes/class-bp-attachment-avatar.php +0 -445
  89. bp-core/classes/class-bp-attachment-cover-image.php +0 -284
  90. bp-core/classes/class-bp-attachment.php +0 -674
  91. bp-core/classes/class-bp-button.php +0 -270
  92. bp-core/classes/class-bp-core-notification.php +0 -284
  93. bp-core/classes/class-bp-core-user.php +0 -966
  94. bp-core/classes/class-bp-date-query.php +0 -69
  95. bp-core/classes/class-bp-embed.php +0 -250
  96. bp-core/classes/class-bp-media-extractor.php +0 -938
  97. bp-core/classes/class-bp-members-suggestions.php +0 -137
  98. bp-core/classes/class-bp-recursive-query.php +0 -229
  99. bp-core/classes/class-bp-suggestions.php +0 -142
  100. bp-core/classes/class-bp-user-query.php +0 -822
  101. bp-core/classes/class-bp-walker-nav-menu-checklist.php +0 -117
  102. bp-core/classes/class-bp-walker-nav-menu.php +0 -215
  103. bp-core/css/admin-bar-rtl.css +18 -49
  104. bp-core/css/admin-bar-rtl.min.css +1 -1
  105. bp-core/css/admin-bar.css +1 -1
  106. bp-core/css/admin-bar.min.css +1 -1
  107. bp-core/css/avatar-rtl.css +0 -397
  108. bp-core/css/avatar-rtl.min.css +0 -1
  109. bp-core/css/avatar.css +0 -397
  110. bp-core/css/avatar.min.css +0 -1
  111. bp-core/css/buddybar-rtl.css +15 -141
  112. bp-core/css/buddybar-rtl.min.css +1 -1
  113. bp-core/css/buddybar.css +4 -4
  114. bp-core/css/buddybar.min.css +1 -1
  115. bp-core/deprecated/1.2.php +2 -2
  116. bp-core/deprecated/1.5.php +77 -88
  117. bp-core/deprecated/1.6.php +22 -21
  118. bp-core/deprecated/1.7.php +13 -13
  119. bp-core/deprecated/2.0.php +4 -4
  120. bp-core/deprecated/2.1.php +0 -648
  121. bp-core/deprecated/2.2.php +0 -116
  122. bp-core/deprecated/2.3.php +0 -24
  123. bp-core/deprecated/2.4.php +0 -25
  124. bp-core/deprecated/css/autocomplete/jquery.autocompletefb-rtl.css +0 -80
  125. bp-core/deprecated/css/autocomplete/jquery.autocompletefb-rtl.min.css +0 -1
  126. bp-core/deprecated/css/autocomplete/jquery.autocompletefb.min.css +0 -1
  127. bp-core/deprecated/js/autocomplete/jquery.autocomplete.min.js +0 -2
  128. bp-core/deprecated/js/autocomplete/jquery.autocompletefb.min.js +0 -2
  129. bp-core/deprecated/js/autocomplete/jquery.bgiframe.min.js +0 -2
  130. bp-core/deprecated/js/autocomplete/jquery.dimensions.min.js +0 -2
  131. bp-core/images/60pc_black.png +0 -0
  132. bp-core/images/Jcrop.gif +0 -0
  133. bp-core/images/admin-menu-arrow.gif +0 -0
  134. bp-core/images/bp20/admin-xprofile.jpg +0 -0
  135. bp-core/images/bp20/load-newest.jpg +0 -0
  136. bp-core/images/bp20/performance.png +0 -0
  137. bp-core/images/bp20/tools-buddypress.jpg +0 -0
  138. bp-core/images/bp20/user-mark-spam.jpg +0 -0
  139. bp-core/images/bp20/users-pending.jpg +0 -0
  140. bp-core/images/mystery-man-50.jpg +0 -0
  141. bp-core/images/mystery-man.jpg +0 -0
  142. bp-core/js/avatar.js +0 -672
  143. bp-core/js/avatar.min.js +0 -2
  144. bp-core/js/bp-plupload.js +0 -414
  145. bp-core/js/bp-plupload.min.js +0 -2
  146. bp-core/js/confirm.js +3 -8
  147. bp-core/js/confirm.min.js +1 -2
  148. bp-core/js/cover-image.js +0 -277
  149. bp-core/js/cover-image.min.js +0 -2
  150. bp-core/js/jquery-cookie.js +0 -120
  151. bp-core/js/jquery-cookie.min.js +0 -2
  152. bp-core/js/jquery-query.js +0 -6
  153. bp-core/js/jquery-query.min.js +0 -2
  154. bp-core/js/jquery-scroll-to.js +0 -208
  155. bp-core/js/jquery-scroll-to.min.js +0 -2
  156. bp-core/js/jquery.atwho.js +0 -875
  157. bp-core/js/jquery.atwho.min.js +0 -2
  158. bp-core/js/jquery.atwho.txt +0 -22
  159. bp-core/js/jquery.caret.js +0 -405
  160. bp-core/js/jquery.caret.min.js +0 -2
  161. bp-core/js/jquery.caret.txt +0 -22
  162. bp-core/js/webcam.js +0 -307
  163. bp-core/js/webcam.min.js +0 -2
  164. bp-core/js/widget-members.js +13 -13
  165. bp-core/js/widget-members.min.js +1 -2
  166. bp-forums/bb-config.php +1 -4
  167. bp-forums/bp-forums-actions.php +3 -3
  168. bp-forums/bp-forums-bbpress-sa.php +54 -79
  169. bp-forums/bp-forums-bbpress.php +3 -6
  170. bp-forums/bp-forums-filters.php +28 -32
  171. bp-forums/bp-forums-functions.php +146 -268
  172. bp-forums/bp-forums-loader.php +56 -64
  173. bp-forums/bp-forums-screens.php +18 -98
  174. bp-forums/bp-forums-template.php +298 -832
  175. bp-forums/deprecated/1.6.php +27 -26
  176. bp-forums/deprecated/1.7.php +15 -14
  177. bp-friends/bp-friends-actions.php +6 -5
  178. bp-friends/bp-friends-activity.php +38 -183
  179. bp-friends/bp-friends-cache.php +13 -14
  180. bp-friends/bp-friends-classes.php +615 -4
  181. bp-friends/bp-friends-filters.php +9 -36
  182. bp-friends/bp-friends-functions.php +87 -304
  183. bp-friends/bp-friends-loader.php +45 -61
  184. bp-friends/bp-friends-notifications.php +40 -158
  185. bp-friends/bp-friends-screens.php +12 -42
  186. bp-friends/bp-friends-template.php +38 -139
  187. bp-friends/bp-friends-widgets.php +29 -48
  188. bp-friends/classes/class-bp-friends-friendship.php +0 -688
  189. bp-friends/js/widget-friends.js +14 -14
  190. bp-friends/js/widget-friends.min.js +1 -2
  191. bp-groups/admin/css/admin-rtl.css +0 -86
  192. bp-groups/admin/css/admin-rtl.min.css +0 -1
  193. bp-groups/admin/css/admin.css +3 -33
  194. bp-groups/admin/css/admin.min.css +1 -1
  195. bp-groups/admin/js/admin.js +12 -24
  196. bp-groups/admin/js/admin.min.js +1 -2
  197. bp-groups/bp-groups-actions.php +29 -169
  198. bp-groups/bp-groups-activity.php +31 -296
  199. bp-groups/bp-groups-admin.php +209 -464
  200. bp-groups/bp-groups-adminbar.php +64 -41
  201. bp-groups/bp-groups-buddybar.php +67 -0
  202. bp-groups/bp-groups-cache.php +21 -54
  203. bp-groups/bp-groups-classes.php +3999 -7
  204. bp-groups/bp-groups-filters.php +40 -137
  205. bp-groups/bp-groups-forums.php +204 -457
  206. bp-groups/bp-groups-functions.php +172 -804
  207. bp-groups/bp-groups-loader.php +179 -363
  208. bp-groups/bp-groups-notifications.php +132 -796
  209. bp-groups/bp-groups-screens.php +107 -597
  210. bp-groups/bp-groups-template.php +859 -3449
  211. bp-groups/bp-groups-widgets.php +18 -54
  212. bp-groups/classes/class-bp-group-extension.php +0 -1696
  213. bp-groups/classes/class-bp-group-member-query.php +0 -377
  214. bp-groups/classes/class-bp-groups-group.php +0 -1584
  215. bp-groups/classes/class-bp-groups-member-suggestions.php +0 -176
  216. bp-groups/classes/class-bp-groups-member.php +0 -1154
  217. bp-groups/js/widget-groups.js +13 -13
  218. bp-groups/js/widget-groups.min.js +1 -2
  219. bp-languages/buddypress.pot +7212 -0
  220. bp-loader.php +106 -164
  221. bp-members/admin/{bp-members-admin-classes.php → bp-members-classes.php} +104 -221
  222. bp-members/admin/css/admin-rtl.css +0 -166
  223. bp-members/admin/css/admin-rtl.min.css +0 -1
  224. bp-members/admin/css/admin.css +42 -29
  225. bp-members/admin/css/admin.min.css +1 -1
  226. bp-members/admin/js/admin.js +2 -4
  227. bp-members/admin/js/admin.min.js +1 -2
  228. bp-members/bp-members-actions.php +14 -13
  229. bp-members/bp-members-activity.php +0 -98
  230. bp-members/bp-members-admin.php +341 -895
  231. bp-members/bp-members-adminbar.php +18 -30
  232. bp-members/bp-members-buddybar.php +116 -0
  233. bp-members/bp-members-cache.php +0 -64
  234. bp-members/bp-members-classes.php +654 -5
  235. bp-members/bp-members-filters.php +17 -69
  236. bp-members/bp-members-functions.php +327 -1160
  237. bp-members/bp-members-loader.php +80 -154
  238. bp-core/deprecated/1.9.php → bp-members/bp-members-notifications.php +46 -42
  239. bp-members/bp-members-screens.php +96 -249
  240. bp-members/bp-members-template.php +274 -1423
  241. bp-members/bp-members-widgets.php +0 -630
  242. bp-members/classes/class-bp-signup.php +0 -795
  243. bp-messages/bp-messages-actions.php +20 -393
  244. bp-messages/bp-messages-cache.php +22 -60
  245. bp-messages/bp-messages-classes.php +867 -6
  246. bp-messages/bp-messages-cssjs.php +17 -22
  247. bp-messages/bp-messages-filters.php +14 -38
  248. bp-messages/bp-messages-functions.php +65 -365
  249. bp-messages/bp-messages-loader.php +70 -141
  250. bp-messages/bp-messages-notifications.php +56 -150
  251. bp-messages/bp-messages-screens.php +86 -130
  252. bp-messages/bp-messages-star.php +0 -529
  253. bp-messages/bp-messages-template.php +295 -1765
  254. bp-messages/bp-messages-widgets.php +10 -24
  255. bp-messages/classes/class-bp-messages-message.php +0 -254
  256. bp-messages/classes/class-bp-messages-notice.php +0 -277
  257. bp-messages/classes/class-bp-messages-thread.php +0 -845
  258. {bp-core/deprecated → bp-messages}/css/autocomplete/jquery.autocompletefb.css +5 -0
  259. bp-messages/css/autocomplete/jquery.autocompletefb.min.css +1 -0
  260. {bp-core/deprecated → bp-messages}/js/autocomplete/jquery.autocomplete.js +2 -25
  261. bp-messages/js/autocomplete/jquery.autocomplete.min.js +13 -0
  262. {bp-core/deprecated → bp-messages}/js/autocomplete/jquery.autocompletefb.js +0 -0
  263. bp-messages/js/autocomplete/jquery.autocompletefb.min.js +16 -0
  264. {bp-core/deprecated → bp-messages}/js/autocomplete/jquery.bgiframe.js +0 -0
  265. bp-messages/js/autocomplete/jquery.bgiframe.min.js +6 -0
  266. {bp-core/deprecated → bp-messages}/js/autocomplete/jquery.dimensions.js +0 -0
  267. bp-messages/js/autocomplete/jquery.dimensions.min.js +13 -0
  268. {bp-core/deprecated → bp-messages}/js/autocomplete/license.bgiframe.txt +0 -0
  269. bp-notifications/bp-notifications-actions.php +25 -85
  270. bp-notifications/bp-notifications-adminbar.php +5 -6
  271. bp-notifications/bp-notifications-buddybar.php +57 -0
  272. bp-notifications/bp-notifications-cache.php +9 -72
  273. bp-notifications/bp-notifications-classes.php +914 -5
  274. bp-notifications/bp-notifications-functions.php +137 -318
  275. bp-notifications/bp-notifications-loader.php +65 -85
  276. bp-notifications/bp-notifications-screens.php +6 -31
  277. bp-notifications/bp-notifications-template.php +226 -545
  278. bp-notifications/classes/class-bp-notifications-notification.php +0 -1117
  279. bp-settings/bp-settings-actions.php +19 -182
  280. bp-settings/bp-settings-functions.php +97 -2
  281. bp-settings/bp-settings-loader.php +46 -53
  282. bp-settings/bp-settings-screens.php +14 -39
  283. bp-settings/bp-settings-template.php +12 -59
  284. bp-templates/bp-legacy/buddypress-functions.php +289 -763
  285. bp-templates/bp-legacy/buddypress/activity/activity-loop.php +12 -24
  286. bp-templates/bp-legacy/buddypress/activity/comment.php +6 -22
  287. bp-templates/bp-legacy/buddypress/activity/entry.php +14 -59
  288. bp-templates/bp-legacy/buddypress/activity/index.php +50 -140
  289. bp-templates/bp-legacy/buddypress/activity/post-form.php +9 -33
  290. bp-templates/bp-legacy/buddypress/activity/single/home.php +3 -15
  291. bp-templates/bp-legacy/buddypress/assets/_attachments/avatars/camera.php +0 -29
  292. bp-templates/bp-legacy/buddypress/assets/_attachments/avatars/crop.php +0 -26
  293. bp-templates/bp-legacy/buddypress/assets/_attachments/avatars/index.php +0 -47
  294. bp-templates/bp-legacy/buddypress/assets/_attachments/cover-images/index.php +0 -36
  295. bp-templates/bp-legacy/buddypress/assets/_attachments/uploader.php +0 -39
  296. bp-templates/bp-legacy/buddypress/blogs/blogs-loop.php +12 -49
  297. bp-templates/bp-legacy/buddypress/blogs/create.php +7 -44
  298. bp-templates/bp-legacy/buddypress/blogs/index.php +15 -103
  299. bp-templates/bp-legacy/buddypress/forums/forums-loop.php +9 -57
  300. bp-templates/bp-legacy/buddypress/forums/index.php +25 -128
  301. bp-templates/bp-legacy/buddypress/groups/create.php +66 -236
  302. bp-templates/bp-legacy/buddypress/groups/groups-loop.php +12 -55
  303. bp-templates/bp-legacy/buddypress/groups/index.php +13 -92
  304. bp-templates/bp-legacy/buddypress/groups/single/activity.php +15 -60
  305. bp-templates/bp-legacy/buddypress/groups/single/admin.php +66 -209
  306. bp-templates/bp-legacy/buddypress/groups/single/cover-image-header.php +0 -123
  307. bp-templates/bp-legacy/buddypress/groups/single/forum.php +10 -48
  308. bp-templates/bp-legacy/buddypress/groups/single/forum/edit.php +8 -64
  309. bp-templates/bp-legacy/buddypress/groups/single/forum/topic.php +30 -93
  310. bp-templates/bp-legacy/buddypress/groups/single/group-header.php +10 -68
  311. bp-templates/bp-legacy/buddypress/groups/single/home.php +37 -82
  312. bp-templates/bp-legacy/buddypress/groups/single/invites-loop.php +13 -44
  313. bp-templates/bp-legacy/buddypress/groups/single/members.php +8 -60
  314. bp-templates/bp-legacy/buddypress/groups/single/plugins.php +3 -30
  315. bp-templates/bp-legacy/buddypress/groups/single/request-membership.php +3 -30
  316. bp-templates/bp-legacy/buddypress/groups/single/requests-loop.php +2 -26
  317. bp-templates/bp-legacy/buddypress/groups/single/send-invites.php +5 -48
  318. bp-templates/bp-legacy/buddypress/members/activate.php +6 -47
  319. bp-templates/bp-legacy/buddypress/members/index.php +13 -96
  320. bp-templates/bp-legacy/buddypress/members/members-loop.php +10 -51
  321. bp-templates/bp-legacy/buddypress/members/register.php +43 -261
  322. bp-templates/bp-legacy/buddypress/members/single/activity.php +36 -36
  323. bp-templates/bp-legacy/buddypress/members/single/blogs.php +7 -26
  324. bp-templates/bp-legacy/buddypress/members/single/cover-image-header.php +0 -103
  325. bp-templates/bp-legacy/buddypress/members/single/forums.php +3 -22
  326. bp-templates/bp-legacy/buddypress/members/single/forums/topics.php +3 -4
  327. bp-templates/bp-legacy/buddypress/members/single/friends.php +3 -22
  328. bp-templates/bp-legacy/buddypress/members/single/friends/requests.php +7 -48
  329. bp-templates/bp-legacy/buddypress/members/single/groups.php +6 -25
  330. bp-templates/bp-legacy/buddypress/members/single/groups/invites.php +10 -46
  331. bp-templates/bp-legacy/buddypress/members/single/home.php +6 -58
  332. bp-templates/bp-legacy/buddypress/members/single/member-header.php +10 -45
  333. bp-templates/bp-legacy/buddypress/members/single/messages.php +5 -30
  334. bp-templates/bp-legacy/buddypress/members/single/messages/compose.php +6 -29
  335. bp-templates/bp-legacy/buddypress/members/single/messages/message.php +0 -86
  336. bp-templates/bp-legacy/buddypress/members/single/messages/messages-loop.php +50 -159
  337. bp-templates/bp-legacy/buddypress/members/single/messages/notices-loop.php +7 -55
  338. bp-templates/bp-legacy/buddypress/members/single/messages/single.php +54 -92
  339. bp-templates/bp-legacy/buddypress/members/single/notifications.php +4 -1
  340. bp-templates/bp-legacy/buddypress/members/single/notifications/feedback-no-notifications.php +2 -11
  341. bp-templates/bp-legacy/buddypress/members/single/notifications/notifications-loop.php +20 -39
  342. bp-templates/bp-legacy/buddypress/members/single/notifications/read.php +1 -11
  343. bp-templates/bp-legacy/buddypress/members/single/notifications/unread.php +1 -11
  344. bp-templates/bp-legacy/buddypress/members/single/plugins.php +6 -41
  345. bp-templates/bp-legacy/buddypress/members/single/profile.php +4 -22
  346. bp-templates/bp-legacy/buddypress/members/single/profile/change-avatar.php +10 -43
  347. bp-templates/bp-legacy/buddypress/members/single/profile/change-cover-image.php +0 -33
  348. bp-templates/bp-legacy/buddypress/members/single/profile/edit.php +11 -62
  349. bp-templates/bp-legacy/buddypress/members/single/profile/profile-loop.php +6 -34
  350. bp-templates/bp-legacy/buddypress/members/single/profile/profile-wp.php +5 -46
  351. bp-templates/bp-legacy/buddypress/members/single/settings.php +1 -0
  352. bp-templates/bp-legacy/buddypress/members/single/settings/capabilities.php +5 -31
  353. bp-templates/bp-legacy/buddypress/members/single/settings/delete-account.php +5 -31
  354. bp-templates/bp-legacy/buddypress/members/single/settings/general.php +8 -36
  355. bp-templates/bp-legacy/buddypress/members/single/settings/notifications.php +5 -38
  356. bp-templates/bp-legacy/buddypress/members/single/settings/profile.php +5 -39
  357. bp-templates/bp-legacy/css/buddypress-rtl.css +57 -327
  358. bp-templates/bp-legacy/css/buddypress-rtl.min.css +0 -1
  359. bp-templates/bp-legacy/css/buddypress.css +34 -224
  360. bp-templates/bp-legacy/css/buddypress.min.css +0 -1
  361. bp-templates/bp-legacy/css/twentyfifteen-rtl.css +0 -1944
  362. bp-templates/bp-legacy/css/twentyfifteen-rtl.min.css +0 -1
  363. bp-templates/bp-legacy/css/twentyfifteen.css +0 -1944
  364. bp-templates/bp-legacy/css/twentyfifteen.min.css +0 -1
  365. bp-templates/bp-legacy/css/twentyfifteen.scss +0 -2307
  366. bp-templates/bp-legacy/css/twentyfourteen-rtl.css +0 -1458
  367. bp-templates/bp-legacy/css/twentyfourteen-rtl.min.css +0 -1
  368. bp-templates/bp-legacy/css/twentyfourteen.css +0 -1458
  369. bp-templates/bp-legacy/css/twentyfourteen.min.css +0 -1
  370. bp-templates/bp-legacy/css/twentyfourteen.scss +0 -1853
  371. bp-templates/bp-legacy/css/twentysixteen-rtl.css +0 -1837
  372. bp-templates/bp-legacy/css/twentysixteen-rtl.min.css +0 -1
  373. bp-templates/bp-legacy/css/twentysixteen.css +0 -1837
  374. bp-templates/bp-legacy/css/twentysixteen.min.css +0 -1
  375. bp-templates/bp-legacy/css/twentysixteen.scss +0 -2320
  376. bp-templates/bp-legacy/css/twentythirteen-rtl.css +0 -1944
  377. bp-templates/bp-legacy/css/twentythirteen-rtl.min.css +0 -1
  378. bp-templates/bp-legacy/css/twentythirteen.css +0 -1944
  379. bp-templates/bp-legacy/css/twentythirteen.min.css +0 -1
  380. bp-templates/bp-legacy/css/twentythirteen.scss +0 -2375
  381. bp-templates/bp-legacy/js/buddypress.js +464 -743
  382. bp-templates/bp-legacy/js/buddypress.min.js +0 -3
  383. bp-templates/bp-legacy/js/password-verify.js +0 -43
  384. bp-templates/bp-legacy/js/password-verify.min.js +0 -2
  385. bp-themes/bp-default/.jshintrc +0 -25
  386. bp-themes/bp-default/_inc/ajax.php +1 -1
  387. bp-themes/bp-default/_inc/global.js +51 -45
  388. bp-themes/bp-default/_inc/images/45pc_black.png +0 -0
  389. bp-themes/bp-default/_inc/images/60pc_black.png +0 -0
  390. bp-themes/bp-default/_inc/images/activity_arrow.gif +0 -0
  391. bp-themes/bp-default/_inc/images/admin-menu-arrow.gif +0 -0
  392. bp-themes/bp-default/_inc/images/ajax-loader.gif +0 -0
  393. bp-themes/bp-default/_inc/images/background.gif +0 -0
  394. bp-themes/bp-default/_inc/images/closed.png +0 -0
  395. bp-themes/bp-default/_inc/images/default_header.jpg +0 -0
  396. bp-themes/bp-default/_inc/images/item_back.gif +0 -0
  397. bp-themes/bp-default/_inc/images/replyto_arrow.gif +0 -0
  398. bp-themes/bp-default/_inc/images/rss.png +0 -0
  399. bp-themes/bp-default/_inc/images/sidebar_back.gif +0 -0
  400. bp-themes/bp-default/_inc/images/white-grad.png +0 -0
  401. bp-themes/bp-default/activity/entry.php +1 -1
  402. bp-themes/bp-default/activity/index.php +1 -1
  403. bp-themes/bp-default/activity/post-form.php +1 -1
  404. bp-themes/bp-default/functions.php +1 -35
  405. bp-themes/bp-default/groups/single/activity.php +1 -1
  406. bp-themes/bp-default/groups/single/admin.php +1 -1
  407. bp-themes/bp-default/groups/single/forum/topic.php +1 -1
  408. bp-themes/bp-default/members/single/activity.php +1 -1
  409. bp-themes/bp-default/rtl.css +1 -1
  410. bp-themes/bp-default/screenshot.png +0 -0
  411. bp-themes/bp-default/style.css +1 -1
  412. bp-themes/index.php +5 -0
  413. bp-xprofile/admin/css/admin-rtl.css +0 -286
  414. bp-xprofile/admin/css/admin-rtl.min.css +0 -1
  415. bp-xprofile/admin/css/admin.css +100 -138
  416. bp-xprofile/admin/css/admin.min.css +1 -1
  417. bp-xprofile/admin/js/admin.js +82 -152
  418. bp-xprofile/admin/js/admin.min.js +1 -2
  419. bp-xprofile/bp-xprofile-actions.php +23 -45
  420. bp-xprofile/bp-xprofile-activity.php +148 -181
  421. bp-xprofile/bp-xprofile-admin.php +273 -593
  422. bp-xprofile/bp-xprofile-buddybar.php +4 -0
  423. bp-xprofile/bp-xprofile-cache.php +86 -193
  424. bp-xprofile/bp-xprofile-caps.php +20 -31
  425. bp-xprofile/bp-xprofile-classes.php +2889 -20
  426. bp-xprofile/bp-xprofile-cssjs.php +10 -32
  427. bp-xprofile/bp-xprofile-filters.php +78 -309
  428. bp-xprofile/bp-xprofile-functions.php +250 -554
  429. bp-xprofile/bp-xprofile-loader.php +98 -183
  430. bp-xprofile/bp-xprofile-notifications.php +0 -49
  431. bp-xprofile/bp-xprofile-screens.php +60 -170
  432. bp-xprofile/bp-xprofile-settings.php +12 -20
  433. bp-xprofile/bp-xprofile-template.php +193 -724
  434. bp-xprofile/classes/class-bp-xprofile-field-type-checkbox.php +0 -193
  435. bp-xprofile/classes/class-bp-xprofile-field-type-datebox.php +0 -324
  436. bp-xprofile/classes/class-bp-xprofile-field-type-multiselectbox.php +0 -208
  437. bp-xprofile/classes/class-bp-xprofile-field-type-number.php +0 -112
  438. bp-xprofile/classes/class-bp-xprofile-field-type-placeholder.php +0 -62
  439. bp-xprofile/classes/class-bp-xprofile-field-type-radiobutton.php +0 -196
  440. bp-xprofile/classes/class-bp-xprofile-field-type-selectbox.php +0 -188
  441. bp-xprofile/classes/class-bp-xprofile-field-type-textarea.php +0 -165
  442. bp-xprofile/classes/class-bp-xprofile-field-type-textbox.php +0 -113
  443. bp-xprofile/classes/class-bp-xprofile-field-type-url.php +0 -171
  444. bp-xprofile/classes/class-bp-xprofile-field-type.php +0 -485
  445. bp-xprofile/classes/class-bp-xprofile-field.php +0 -1503
  446. bp-xprofile/classes/class-bp-xprofile-group.php +0 -817
  447. bp-xprofile/classes/class-bp-xprofile-meta-query.php +0 -365
  448. bp-xprofile/classes/class-bp-xprofile-profiledata.php +0 -532
  449. bp-xprofile/classes/class-bp-xprofile-query.php +0 -538
  450. buddypress.pot +3530 -4594
  451. composer.json +0 -33
  452. humans.txt +2 -17
  453. readme.txt +58 -159
  454. tests/assets/group-extensions.php +148 -0
  455. tests/bootstrap.php +19 -0
  456. tests/includes/define-constants.php +43 -0
  457. tests/includes/factory.php +181 -0
  458. tests/includes/install.php +47 -0
  459. tests/includes/loader.php +9 -0
  460. tests/includes/testcase.php +441 -0
  461. tests/multisite.xml +17 -0
  462. tests/phpunit.xml.dist +14 -0
  463. tests/testcases/activity/cache.php +56 -0
  464. tests/testcases/activity/class.BP_Activity_Activity.php +633 -0
  465. tests/testcases/activity/filters.php +60 -0
  466. tests/testcases/activity/functions.php +745 -0
  467. tests/testcases/activity/notifications.php +252 -0
  468. tests/testcases/activity/template.php +310 -0
  469. tests/testcases/admin/functions.php +123 -0
  470. tests/testcases/blogs/activity.php +293 -0
  471. tests/testcases/blogs/cache.php +234 -0
  472. tests/testcases/blogs/class-bp-blogs-blog.php +67 -0
  473. tests/testcases/blogs/functions.php +407 -0
  474. tests/testcases/core/avatars.php +82 -0
  475. tests/testcases/core/cache.php +30 -0
  476. tests/testcases/core/class-bp-core-user.php +216 -0
  477. tests/testcases/core/class-bp-user-query.php +319 -0
  478. tests/testcases/core/functions.php +333 -0
  479. tests/testcases/friends/activity.php +52 -0
  480. tests/testcases/friends/class-bp-friends-friendship.php +118 -0
  481. tests/testcases/friends/functions.php +138 -0
  482. tests/testcases/groups/activity.php +51 -0
  483. tests/testcases/groups/avatars.php +33 -0
  484. tests/testcases/groups/cache.php +157 -0
  485. tests/testcases/groups/class-bp-group-extension.php +225 -0
  486. tests/testcases/groups/class-bp-group-member-query.php +609 -0
  487. tests/testcases/groups/class-bp-groups-group.php +903 -0
  488. tests/testcases/groups/class-bp-groups-member.php +131 -0
  489. tests/testcases/groups/functions.php +631 -0
  490. tests/testcases/groups/notifications.php +64 -0
  491. tests/testcases/groups/template.php +692 -0
  492. tests/testcases/members/class-bp-signup.php +213 -0
  493. tests/testcases/members/functions.php +356 -0
  494. tests/testcases/members/template.php +144 -0
  495. tests/testcases/messages/class.bp-messages-notice.php +53 -0
  496. tests/testcases/messages/functions.php +44 -0
  497. tests/testcases/messages/notifications.php +45 -0
  498. tests/testcases/notifications/class-bp-notifications-notification.php +249 -0
  499. tests/testcases/notifications/functions.php +123 -0
  500. tests/testcases/routing/activity.php +68 -0
  501. tests/testcases/routing/anonymous.php +29 -0
  502. tests/testcases/routing/core.php +31 -0
  503. tests/testcases/routing/friends.php +30 -0
  504. tests/testcases/routing/groups.php +30 -0
  505. tests/testcases/routing/members.php +30 -0
  506. tests/testcases/routing/messages.php +40 -0
  507. tests/testcases/routing/root-profiles.php +55 -0
  508. tests/testcases/routing/settings.php +40 -0
  509. tests/testcases/routing/xprofile.php +35 -0
  510. tests/testcases/url/url.php +64 -0
  511. tests/testcases/xprofile/activity.php +372 -0
  512. tests/testcases/xprofile/cache.php +150 -0
  513. tests/testcases/xprofile/class-bp-xprofile-field-type.php +172 -0
  514. tests/testcases/xprofile/class-bp-xprofile-field.php +29 -0
  515. tests/testcases/xprofile/class-bp-xprofile-group.php +70 -0
  516. tests/testcases/xprofile/class-bp-xprofile-profiledata.php +435 -0
  517. tests/testcases/xprofile/filters.php +57 -0
  518. tests/testcases/xprofile/functions.php +571 -0
.travis.yml ADDED
@@ -0,0 +1,48 @@
1
+ language: php
2
+
3
+ php:
4
+ - 5.2
5
+ - 5.3
6
+ - 5.4
7
+ - 5.5
8
+
9
+ env:
10
+ - WP_VERSION=trunk WP_MULTISITE=0
11
+ - WP_VERSION=tags/3.8.1 WP_MULTISITE=0
12
+ - WP_VERSION=tags/3.7.1 WP_MULTISITE=0
13
+ - WP_VERSION=trunk WP_MULTISITE=1
14
+ - WP_VERSION=tags/3.8.1 WP_MULTISITE=1
15
+ - WP_VERSION=tags/3.7.1 WP_MULTISITE=1
16
+
17
+ before_script:
18
+ # set up WP install
19
+ - WP_CORE_DIR=/tmp/wordpress/
20
+ - mkdir -p $WP_CORE_DIR
21
+ - svn co --ignore-externals https://develop.svn.wordpress.org/$WP_VERSION $WP_CORE_DIR
22
+ - plugin_slug=$(basename $(pwd))
23
+ - plugin_dir=$WP_CORE_DIR/src/wp-content/plugins/$plugin_slug
24
+ - cd ..
25
+ - mv $plugin_slug $plugin_dir
26
+ # set up tests config
27
+ - cd $WP_CORE_DIR
28
+ - cp wp-tests-config-sample.php wp-tests-config.php
29
+ - sed -i "s/youremptytestdbnamehere/wordpress_test/" wp-tests-config.php
30
+ - sed -i "s/yourusernamehere/root/" wp-tests-config.php
31
+ - sed -i "s/yourpasswordhere//" wp-tests-config.php
32
+ # disable WP_DEBUG for PHP 5.5 due to ext/mysqli E_DEPRECATED errors
33
+ - if [[ "$TRAVIS_PHP_VERSION" == 5.5* ]] ; then sed -i "s:define( 'WP_DEBUG://define( 'WP_DEBUG:" wp-tests-config.php; fi;
34
+ # set up database
35
+ - mysql -e 'CREATE DATABASE wordpress_test;' -uroot
36
+ # prepare for running the tests
37
+ - cd $plugin_dir/tests
38
+
39
+ script: phpunit
40
+
41
+ notifications:
42
+ email: false
43
+
44
+ irc:
45
+ channels:
46
+ - "irc.freenode.net#buddypress-dev"
47
+ template:
48
+ - "Build %{build_number} (%{branch} - %{commit}): %{message} %{build_url}"
bp-activity/admin/css/admin-rtl.css DELETED
@@ -1,87 +0,0 @@
1
- .akismet-status {
2
- float: left;
3
- }
4
- .akismet-status a {
5
- color: #AAA;
6
- font-style: italic;
7
- }
8
- .akismet-history {
9
- margin: 13px;
10
- }
11
- .akismet-history div {
12
- margin-bottom: 13px;
13
- }
14
- .akismet-history span {
15
- color: #999;
16
- }
17
-
18
- #wp-bp-activities-wrap {
19
- padding: 5px 0;
20
- }
21
- #bp-activities {
22
- height: 120px;
23
- }
24
- #bp-replyhead {
25
- font-size: 1em;
26
- line-height: 1.4em;
27
- margin: 0;
28
- }
29
- #bp-replysubmit {
30
- margin: 0;
31
- padding: 0 0 3px;
32
- text-align: center;
33
- }
34
- #bp-replysubmit .error {
35
- color: red;
36
- line-height: 21px;
37
- text-align: center;
38
- vertical-align: center;
39
- }
40
- #bp-replysubmit img.waiting {
41
- float: left;
42
- padding: 4px 10px 0;
43
- vertical-align: top;
44
- }
45
- #bp-activities-form .column-response img {
46
- float: right;
47
- margin-bottom: 5px;
48
- margin-left: 10px;
49
- margin-top: 1px;
50
- }
51
- .activity-errors {
52
- list-style-type: disc;
53
- margin-right: 2em;
54
- }
55
-
56
- #bp_activity_action div.inside,
57
- #bp_activity_content div.inside {
58
- line-height: 0;
59
- }
60
- #bp_activity_action h3,
61
- #bp_activity_content h3 {
62
- cursor: auto;
63
- }
64
- #bp_activity_action td.mceIframeContainer,
65
- #bp_activity_content td.mceIframeContainer {
66
- background-color: white;
67
- }
68
- #post-body #bp-activities-action_resize,
69
- #post-body #bp-activities-content_resize {
70
- position: inherit;
71
- margin-top: -2px;
72
- }
73
- #bp_activity_link input {
74
- width: 99%;
75
- }
76
- #bp-activities-primaryid {
77
- margin-bottom: 1em;
78
- }
79
- .column-action {
80
- width: 12%;
81
- }
82
-
83
- @media screen and (max-width: 782px) {
84
- body.toplevel_page_bp-activity .wp-list-table tr:not(.inline-edit-row):not(.no-items) td:not(.check-column) {
85
- display: table-cell;
86
- }
87
- }
bp-activity/admin/css/admin-rtl.min.css DELETED
@@ -1 +0,0 @@
1
- .akismet-status{float:left}.akismet-status a{color:#AAA;font-style:italic}.akismet-history{margin:13px}.akismet-history div{margin-bottom:13px}.akismet-history span{color:#999}#wp-bp-activities-wrap{padding:5px 0}#bp-activities{height:120px}#bp-replyhead{font-size:1em;line-height:1.4em;margin:0}#bp-replysubmit{margin:0;padding:0 0 3px;text-align:center}#bp-replysubmit .error{color:red;line-height:21px;text-align:center;vertical-align:center}#bp-replysubmit img.waiting{float:left;padding:4px 10px 0;vertical-align:top}#bp-activities-form .column-response img{float:right;margin-bottom:5px;margin-left:10px;margin-top:1px}.activity-errors{list-style-type:disc;margin-right:2em}#bp_activity_action div.inside,#bp_activity_content div.inside{line-height:0}#bp_activity_action h3,#bp_activity_content h3{cursor:auto}#bp_activity_action td.mceIframeContainer,#bp_activity_content td.mceIframeContainer{background-color:#fff}#post-body #bp-activities-action_resize,#post-body #bp-activities-content_resize{position:inherit;margin-top:-2px}#bp_activity_link input{width:99%}#bp-activities-primaryid{margin-bottom:1em}.column-action{width:12%}@media screen and (max-width:782px){body.toplevel_page_bp-activity .wp-list-table tr:not(.inline-edit-row):not(.no-items) td:not(.check-column){display:table-cell}}
bp-activity/admin/css/admin.css CHANGED
@@ -44,7 +44,6 @@
44
}
45
#bp-activities-form .column-response img {
46
float: left;
47
- margin-bottom: 5px;
48
margin-right: 10px;
49
margin-top: 1px;
50
}
@@ -78,10 +77,4 @@
78
}
79
.column-action {
80
width: 12%;
81
- }
82
-
83
- @media screen and (max-width: 782px) {
84
- body.toplevel_page_bp-activity .wp-list-table tr:not(.inline-edit-row):not(.no-items) td:not(.check-column) {
85
- display: table-cell;
86
- }
87
}
44
}
45
#bp-activities-form .column-response img {
46
float: left;
47
margin-right: 10px;
48
margin-top: 1px;
49
}
77
}
78
.column-action {
79
width: 12%;
80
}
bp-activity/admin/css/admin.min.css CHANGED
@@ -1 +1 @@
1
- .akismet-status{float:right}.akismet-status a{color:#AAA;font-style:italic}.akismet-history{margin:13px}.akismet-history div{margin-bottom:13px}.akismet-history span{color:#999}#wp-bp-activities-wrap{padding:5px 0}#bp-activities{height:120px}#bp-replyhead{font-size:1em;line-height:1.4em;margin:0}#bp-replysubmit{margin:0;padding:0 0 3px;text-align:center}#bp-replysubmit .error{color:red;line-height:21px;text-align:center;vertical-align:center}#bp-replysubmit img.waiting{float:right;padding:4px 10px 0;vertical-align:top}#bp-activities-form .column-response img{float:left;margin-bottom:5px;margin-right:10px;margin-top:1px}.activity-errors{list-style-type:disc;margin-left:2em}#bp_activity_action div.inside,#bp_activity_content div.inside{line-height:0}#bp_activity_action h3,#bp_activity_content h3{cursor:auto}#bp_activity_action td.mceIframeContainer,#bp_activity_content td.mceIframeContainer{background-color:#fff}#post-body #bp-activities-action_resize,#post-body #bp-activities-content_resize{position:inherit;margin-top:-2px}#bp_activity_link input{width:99%}#bp-activities-primaryid{margin-bottom:1em}.column-action{width:12%}@media screen and (max-width:782px){body.toplevel_page_bp-activity .wp-list-table tr:not(.inline-edit-row):not(.no-items) td:not(.check-column){display:table-cell}}
1
+ .akismet-status{float:right}.akismet-status a{color:#AAA;font-style:italic}.akismet-history{margin:13px}.akismet-history div{margin-bottom:13px}.akismet-history span{color:#999}#wp-bp-activities-wrap{padding:5px 0}#bp-activities{height:120px}#bp-replyhead{font-size:1em;line-height:1.4em;margin:0}#bp-replysubmit{margin:0;padding:0 0 3px;text-align:center}#bp-replysubmit .error{color:red;line-height:21px;text-align:center;vertical-align:center}#bp-replysubmit img.waiting{float:right;padding:4px 10px 0;vertical-align:top}#bp-activities-form .column-response img{float:left;margin-right:10px;margin-top:1px}.activity-errors{list-style-type:disc;margin-left:2em}#bp_activity_action div.inside,#bp_activity_content div.inside{line-height:0}#bp_activity_action h3,#bp_activity_content h3{cursor:auto}#bp_activity_action td.mceIframeContainer,#bp_activity_content td.mceIframeContainer{background-color:white}#post-body #bp-activities-action_resize,#post-body #bp-activities-content_resize{position:inherit;margin-top:-2px}#bp_activity_link input{width:99%}#bp-activities-primaryid{margin-bottom:1em}.column-action{width:12%}
bp-activity/admin/js/admin.js CHANGED
@@ -1,17 +1,16 @@
1
- /* global bp_activity_admin_vars, postboxes, wpAjax */
2
(function( $ ) {
3
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 );
@@ -20,7 +19,7 @@ var activityReply = {
20
21
// Close textarea on escape
22
$(document).on( 'keyup', '#bp-activities:visible', function( e ) {
23
- if ( 27 === e.which ) {
24
activityReply.close();
25
}
26
});
@@ -29,9 +28,9 @@ var activityReply = {
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
36
var box = $( '#bp-activities-container' ).hide();
37
$( this ).parents( 'tr' ).after( box );
@@ -46,11 +45,11 @@ var activityReply = {
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
53
- $('#bp-activities-container').fadeOut( '200', function () {
54
55
// Empty and unfocus the text area
56
$( '#bp-activities' ).val( '' ).blur();
@@ -66,9 +65,9 @@ var activityReply = {
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
73
$( '#bp-replysubmit .error' ).hide();
74
$( '#bp-replysubmit .waiting' ).show();
@@ -100,7 +99,7 @@ var activityReply = {
100
/**
101
* send() error message handler
102
*
103
- * @since 1.6.0
104
*/
105
error : function( r ) {
106
var er = r.statusText;
@@ -118,13 +117,13 @@ var activityReply = {
118
/**
119
* send() success handler
120
*
121
- * @since 1.6.0
122
*/
123
show : function ( xml ) {
124
var bg, id, response;
125
126
// Handle any errors in the response
127
- if ( typeof( xml ) === 'string' ) {
128
activityReply.error( { 'responseText': xml } );
129
return false;
130
}
@@ -137,7 +136,7 @@ var activityReply = {
137
response = response.responses[0];
138
139
// Close and reset the reply row, and add the new Activity item into the list.
140
- $('#bp-activities-container').fadeOut( '200', function () {
141
142
// Empty and unfocus the text area
143
$( '#bp-activities' ).val( '' ).blur();
@@ -165,11 +164,9 @@ $(document).ready( function () {
165
$( '#bp_activity_action h3, #bp_activity_content h3' ).unbind( 'click' );
166
167
// redo the post box toggles to reset the one made by comment.js in favor
168
- // of activity administration page id so that metaboxes are still collapsible
169
// in single Activity Administration screen.
170
- if ( typeof postboxes !== 'undefined' ) {
171
- postboxes.add_postbox_toggles( bp_activity_admin_vars.page );
172
- }
173
});
174
175
- })(jQuery);
1
(function( $ ) {
2
3
/**
4
* Activity reply object for the activity index screen
5
*
6
+ * @since BuddyPress (1.6)
7
*/
8
var activityReply = {
9
10
/**
11
* Attach event handler functions to the relevant elements.
12
*
13
+ * @since BuddyPress (1.6)
14
*/
15
init : function() {
16
$(document).on( 'click', '.row-actions a.reply', activityReply.open );
19
20
// Close textarea on escape
21
$(document).on( 'keyup', '#bp-activities:visible', function( e ) {
22
+ if ( 27 == e.which ) {
23
activityReply.close();
24
}
25
});
28
/**
29
* Reveals the entire row when "reply" is pressed.
30
*
31
+ * @since BuddyPress (1.6)
32
*/
33
+ open : function( e ) {
34
// Hide the container row, and move it to the new location
35
var box = $( '#bp-activities-container' ).hide();
36
$( this ).parents( 'tr' ).after( box );
45
/**
46
* Hide and reset the entire row when "cancel", or escape, are pressed.
47
*
48
+ * @since BuddyPress (1.6)
49
*/
50
+ close : function( e ) {
51
// Hide the container row
52
+ $('#bp-activities-container').fadeOut( '200', function () {
53
54
// Empty and unfocus the text area
55
$( '#bp-activities' ).val( '' ).blur();
65
/**
66
* Submits "form" via AJAX back to WordPress.
67
*
68
+ * @since BuddyPress (1.6)
69
*/
70
+ send : function( e ) {
71
// Hide any existing error message, and show the loading spinner
72
$( '#bp-replysubmit .error' ).hide();
73
$( '#bp-replysubmit .waiting' ).show();
99
/**
100
* send() error message handler
101
*
102
+ * @since BuddyPress (1.6)
103
*/
104
error : function( r ) {
105
var er = r.statusText;
117
/**
118
* send() success handler
119
*
120
+ * @since BuddyPress (1.6)
121
*/
122
show : function ( xml ) {
123
var bg, id, response;
124
125
// Handle any errors in the response
126
+ if ( typeof( xml ) == 'string' ) {
127
activityReply.error( { 'responseText': xml } );
128
return false;
129
}
136
response = response.responses[0];
137
138
// Close and reset the reply row, and add the new Activity item into the list.
139
+ $('#bp-activities-container').fadeOut( '200', function () {
140
141
// Empty and unfocus the text area
142
$( '#bp-activities' ).val( '' ).blur();
164
$( '#bp_activity_action h3, #bp_activity_content h3' ).unbind( 'click' );
165
166
// redo the post box toggles to reset the one made by comment.js in favor
167
+ // of activity administration page id so that metaboxes are still collapsible
168
// in single Activity Administration screen.
169
+ postboxes.add_postbox_toggles( bp_activity_admin_vars.page );
170
});
171
172
+ })(jQuery);
bp-activity/admin/js/admin.min.js CHANGED
@@ -1,2 +1 @@
1
- /*! buddypress - v2.4.0 - 2015-10-29 4:00:53 PM UTC - https://wordpress.org/plugins/buddypress/ */
2
- !function(a){var b={init:function(){a(document).on("click",".row-actions a.reply",b.open),a(document).on("click","#bp-activities-container a.cancel",b.close),a(document).on("click","#bp-activities-container a.save",b.send),a(document).on("keyup","#bp-activities:visible",function(a){27===a.which&&b.close()})},open:function(){var b=a("#bp-activities-container").hide();return a(this).parents("tr").after(b),b.fadeIn("300"),a("#bp-activities").focus(),!1},close:function(){return a("#bp-activities-container").fadeOut("200",function(){a("#bp-activities").val("").blur(),a("#bp-replysubmit .error").html("").hide(),a("#bp-replysubmit .waiting").hide()}),!1},send:function(){a("#bp-replysubmit .error").hide(),a("#bp-replysubmit .waiting").show();var c={};return c["_ajax_nonce-bp-activity-admin-reply"]=a('#bp-activities-container input[name="_ajax_nonce-bp-activity-admin-reply"]').val(),c.action="bp-activity-admin-reply",c.content=a("#bp-activities").val(),c.parent_id=a("#bp-activities-container").prev().data("parent_id"),c.root_id=a("#bp-activities-container").prev().data("root_id"),a.ajax({data:c,type:"POST",url:ajaxurl,error:function(a){b.error(a)},success:function(a){b.show(a)}}),!1},error:function(b){var c=b.statusText;a("#bp-replysubmit .waiting").hide(),b.responseText&&(c=b.responseText.replace(/<.[^<>]*?>/g,"")),c&&a("#bp-replysubmit .error").html(c).show()},show:function(c){var d,e,f;return"string"==typeof c?(b.error({responseText:c}),!1):(f=wpAjax.parseAjaxResponse(c),f.errors?(b.error({responseText:wpAjax.broken}),!1):(f=f.responses[0],void a("#bp-activities-container").fadeOut("200",function(){a("#bp-activities").val("").blur(),a("#bp-replysubmit .error").html("").hide(),a("#bp-replysubmit .waiting").hide(),a("#bp-activities-container").before(f.data),e=a("#activity-"+f.id),d=e.closest(".widefat").css("backgroundColor"),e.animate({backgroundColor:"#CEB"},300).animate({backgroundColor:d},300)})))}};a(document).ready(function(){b.init(),a("#bp_activity_action h3, #bp_activity_content h3").unbind("click"),"undefined"!=typeof postboxes&&postboxes.add_postbox_toggles(bp_activity_admin_vars.page)})}(jQuery);
1
+ (function(b){var a={init:function(){b(document).on("click",".row-actions a.reply",a.open);b(document).on("click","#bp-activities-container a.cancel",a.close);b(document).on("click","#bp-activities-container a.save",a.send);b(document).on("keyup","#bp-activities:visible",function(c){if(27==c.which){a.close()}})},open:function(d){var c=b("#bp-activities-container").hide();b(this).parents("tr").after(c);c.fadeIn("300");b("#bp-activities").focus();return false},close:function(c){b("#bp-activities-container").fadeOut("200",function(){b("#bp-activities").val("").blur();b("#bp-replysubmit .error").html("").hide();b("#bp-replysubmit .waiting").hide()});return false},send:function(d){b("#bp-replysubmit .error").hide();b("#bp-replysubmit .waiting").show();var c={};c["_ajax_nonce-bp-activity-admin-reply"]=b('#bp-activities-container input[name="_ajax_nonce-bp-activity-admin-reply"]').val();c.action="bp-activity-admin-reply";c.content=b("#bp-activities").val();c.parent_id=b("#bp-activities-container").prev().data("parent_id");c.root_id=b("#bp-activities-container").prev().data("root_id");b.ajax({data:c,type:"POST",url:ajaxurl,error:function(e){a.error(e)},success:function(e){a.show(e)}});return false},error:function(c){var d=c.statusText;b("#bp-replysubmit .waiting").hide();if(c.responseText){d=c.responseText.replace(/<.[^<>]*?>/g,"")}if(d){b("#bp-replysubmit .error").html(d).show()}},show:function(d){var e,f,c;if(typeof(d)=="string"){a.error({responseText:d});return false}c=wpAjax.parseAjaxResponse(d);if(c.errors){a.error({responseText:wpAjax.broken});return false}c=c.responses[0];b("#bp-activities-container").fadeOut("200",function(){b("#bp-activities").val("").blur();b("#bp-replysubmit .error").html("").hide();b("#bp-replysubmit .waiting").hide();b("#bp-activities-container").before(c.data);f=b("#activity-"+c.id);e=f.closest(".widefat").css("backgroundColor");f.animate({backgroundColor:"#CEB"},300).animate({backgroundColor:e},300)})}};b(document).ready(function(){a.init();b("#bp_activity_action h3, #bp_activity_content h3").unbind("click");postboxes.add_postbox_toggles(bp_activity_admin_vars.page)})})(jQuery);
bp-activity/bp-activity-actions.php CHANGED
@@ -1,4 +1,5 @@
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,23 +9,17 @@
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
*/
21
function bp_register_activity_actions() {
22
-
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
}
30
add_action( 'bp_init', 'bp_register_activity_actions', 8 );
@@ -32,8 +27,9 @@ add_action( 'bp_init', 'bp_register_activity_actions', 8 );
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()
39
* @uses bp_action_variable()
@@ -50,15 +46,15 @@ add_action( 'bp_init', 'bp_register_activity_actions', 8 );
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,49 +65,43 @@ function bp_activity_action_permalink_router() {
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 );
100
$redirect = add_query_arg( urlencode_deep( $query_frags ), $redirect );
101
}
102
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
- */
110
if ( ! $redirect = apply_filters_ref_array( 'bp_activity_permalink_redirect_url', array( $redirect, &$activity ) ) ) {
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,7 +109,9 @@ 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,59 +124,43 @@ add_action( 'bp_actions', 'bp_activity_action_permalink_router' );
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
175
bp_core_add_message( __( 'There was an error when deleting that activity', 'buddypress' ), 'error' );
176
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,22 +171,23 @@ add_action( 'bp_actions', 'bp_activity_action_delete_activity' );
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,42 +195,27 @@ function bp_activity_action_spam_activity( $activity_id = 0 ) {
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,7 +226,7 @@ add_action( 'bp_actions', 'bp_activity_action_spam_activity' );
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,83 +246,52 @@ add_action( 'bp_actions', 'bp_activity_action_spam_activity' );
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
- */
301
$content = apply_filters( 'bp_activity_post_update_content', $_POST['whats-new'] );
302
303
if ( ! empty( $_POST['whats-new-post-object'] ) ) {
304
-
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
- */
312
$object = apply_filters( 'bp_activity_post_update_object', $_POST['whats-new-post-object'] );
313
}
314
315
if ( ! empty( $_POST['whats-new-post-in'] ) ) {
316
-
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 ) );
341
}
342
343
} else {
344
-
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.
352
- * @param string $content Activity content being posted.
353
- */
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,7 +299,7 @@ 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,25 +319,10 @@ function bp_activity_action_post_comment() {
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
- */
401
$activity_id = apply_filters( 'bp_activity_post_comment_activity_id', $_POST['comment_form_id'] );
402
-
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
- */
410
$content = apply_filters( 'bp_activity_post_comment_content', $_POST['ac_input_' . $activity_id] );
411
412
if ( empty( $content ) ) {
@@ -423,7 +339,7 @@ function bp_activity_action_post_comment() {
423
if ( !empty( $comment_id ) )
424
bp_core_add_message( __( 'Reply Posted!', 'buddypress' ) );
425
else
426
- bp_core_add_message( __( 'There was an error posting that reply. Please try again.', 'buddypress' ), 'error' );
427
428
bp_core_redirect( wp_get_referer() . '#ac-form-' . $activity_id );
429
}
@@ -432,7 +348,7 @@ add_action( 'bp_actions', 'bp_activity_action_post_comment' );
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,13 +367,13 @@ function bp_activity_action_mark_favorite() {
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 ) ) )
458
bp_core_add_message( __( 'Activity marked as favorite.', 'buddypress' ) );
459
else
460
- bp_core_add_message( __( 'There was an error marking that activity as a favorite. Please try again.', 'buddypress' ), 'error' );
461
462
bp_core_redirect( wp_get_referer() . '#activity-' . bp_action_variable( 0 ) );
463
}
@@ -466,7 +382,7 @@ add_action( 'bp_actions', 'bp_activity_action_mark_favorite' );
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,13 +401,13 @@ function bp_activity_action_remove_favorite() {
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 ) ) )
492
bp_core_add_message( __( 'Activity removed as favorite.', 'buddypress' ) );
493
else
494
- bp_core_add_message( __( 'There was an error removing that activity as a favorite. Please try again.', 'buddypress' ), 'error' );
495
496
bp_core_redirect( wp_get_referer() . '#activity-' . bp_action_variable( 0 ) );
497
}
@@ -500,8 +416,9 @@ add_action( 'bp_actions', 'bp_activity_action_remove_favorite' );
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()
507
* @uses bp_is_user()
@@ -510,17 +427,17 @@ add_action( 'bp_actions', 'bp_activity_action_remove_favorite' );
510
* @return bool False on failure.
511
*/
512
function bp_activity_action_sitewide_feed() {
513
- $bp = buddypress();
514
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
522
/* translators: Sitewide activity RSS title - "[Site Name] | Site Wide Activity" */
523
- 'title' => sprintf( __( '%s | Site-Wide Activity', 'buddypress' ), bp_get_site_name() ),
524
525
'link' => bp_get_activity_directory_permalink(),
526
'description' => __( 'Activity feed for the entire site.', 'buddypress' ),
@@ -532,7 +449,7 @@ add_action( 'bp_actions', 'bp_activity_action_sitewide_feed' );
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,7 +462,7 @@ function bp_activity_action_personal_feed() {
545
return false;
546
}
547
548
- // Setup the feed.
549
buddypress()->activity->feed = new BP_Activity_Feed( array(
550
'id' => 'personal',
551
@@ -562,7 +479,7 @@ add_action( 'bp_actions', 'bp_activity_action_personal_feed' );
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,7 +495,7 @@ function bp_activity_action_friends_feed() {
578
return false;
579
}
580
581
- // Setup the feed.
582
buddypress()->activity->feed = new BP_Activity_Feed( array(
583
'id' => 'friends',
584
@@ -595,7 +512,7 @@ add_action( 'bp_actions', 'bp_activity_action_friends_feed' );
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,11 +528,11 @@ function bp_activity_action_my_groups_feed() {
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
@@ -623,7 +540,7 @@ function bp_activity_action_my_groups_feed() {
623
'title' => sprintf( __( '%1$s | %2$s | Group Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
624
625
'link' => trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() ),
626
- 'description' => sprintf( __( "Public group activity feed of which %s is a member.", 'buddypress' ), bp_get_displayed_user_fullname() ),
627
'activity_args' => array(
628
'object' => buddypress()->groups->id,
629
'primary_id' => $group_ids,
@@ -636,7 +553,7 @@ add_action( 'bp_actions', 'bp_activity_action_my_groups_feed' );
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,7 +571,7 @@ function bp_activity_action_mentions_feed() {
654
return false;
655
}
656
657
- // Setup the feed.
658
buddypress()->activity->feed = new BP_Activity_Feed( array(
659
'id' => 'mentions',
660
@@ -673,7 +590,7 @@ add_action( 'bp_actions', 'bp_activity_action_mentions_feed' );
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,11 +604,11 @@ function bp_activity_action_favorites_feed() {
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,125 +625,25 @@ add_action( 'bp_actions', 'bp_activity_action_favorites_feed' );
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
- }
731
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
- */
739
- if ( ! apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) ) {
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'] ) ) {
754
- wp_send_json_error( 'missing_parameter' );
755
- exit;
756
- }
757
-
758
- $args = array(
759
- 'term' => sanitize_text_field( $_GET['term'] ),
760
- 'type' => sanitize_text_field( $_GET['type'] ),
761
- );
762
-
763
- // Support per-Group suggestions.
764
- if ( ! empty( $_GET['group-id'] ) ) {
765
- $args['group_id'] = absint( $_GET['group-id'] );
766
- }
767
-
768
- $results = bp_core_get_suggestions( $args );
769
-
770
- if ( is_wp_error( $results ) ) {
771
- wp_send_json_error( $results->get_error_message() );
772
- exit;
773
- }
774
-
775
- wp_send_json_success( $results );
776
- }
777
- add_action( 'wp_ajax_bp_get_suggestions', 'bp_ajax_get_suggestions' );
778
-
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
- *
786
- * @param string $new_status New status for the post.
787
- * @param string $old_status Old status for the post.
788
- * @param object $post Post data.
789
- */
790
- function bp_activity_catch_transition_post_type_status( $new_status, $old_status, $post ) {
791
- if ( ! post_type_supports( $post->post_type, 'buddypress-activity' ) ) {
792
- return;
793
- }
794
-
795
- // This is an edit.
796
- if ( $new_status === $old_status ) {
797
- // An edit of an existing post should update the existing activity item.
798
- if ( $new_status == 'publish' ) {
799
- bp_activity_post_type_update( $post );
800
- }
801
-
802
- return;
803
- }
804
-
805
- // Publishing a previously unpublished post.
806
- if ( 'publish' === $new_status ) {
807
- // Untrashing the post type - nothing here yet.
808
- if ( 'trash' == $old_status ) {
809
-
810
- /**
811
- * Fires if untrashing post in a post type.
812
- *
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
- */
820
- do_action( 'bp_activity_post_type_untrash_' . $post->post_type, $post );
821
- } else {
822
- // Record the post.
823
- bp_activity_post_type_publish( $post->ID, $post );
824
- }
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
- }
832
- add_action( 'transition_post_status', 'bp_activity_catch_transition_post_type_status', 10, 3 );
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
* @subpackage ActivityActions
10
*/
11
12
+ // Exit if accessed directly
13
+ if ( !defined( 'ABSPATH' ) ) exit;
14
15
/**
16
* Allow core components and dependent plugins to register activity actions.
17
*
18
+ * @since BuddyPress (1.2)
19
*
20
* @uses do_action() To call 'bp_register_activity_actions' hook.
21
*/
22
function bp_register_activity_actions() {
23
do_action( 'bp_register_activity_actions' );
24
}
25
add_action( 'bp_init', 'bp_register_activity_actions', 8 );
27
/**
28
* Catch and route requests for single activity item permalinks.
29
*
30
+ * @since BuddyPress (1.2)
31
*
32
+ * @global object $bp BuddyPress global settings
33
* @uses bp_is_activity_component()
34
* @uses bp_is_current_action()
35
* @uses bp_action_variable()
46
*/
47
function bp_activity_action_permalink_router() {
48
49
+ // Not viewing activity
50
if ( ! bp_is_activity_component() || ! bp_is_current_action( 'p' ) )
51
return false;
52
53
+ // No activity to display
54
if ( ! bp_action_variable( 0 ) || ! is_numeric( bp_action_variable( 0 ) ) )
55
return false;
56
57
+ // Get the activity details
58
$activity = bp_activity_get_specific( array( 'activity_ids' => bp_action_variable( 0 ), 'show_hidden' => true ) );
59
60
// 404 if activity does not exist
65
$activity = $activity['activities'][0];
66
}
67
68
+ // Do not redirect at default
69
$redirect = false;
70
71
+ // Redirect based on the type of activity
72
if ( bp_is_active( 'groups' ) && $activity->component == buddypress()->groups->id ) {
73
74
+ // Activity is a user update
75
if ( ! empty( $activity->user_id ) ) {
76
$redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id . '/';
77
78
+ // Activity is something else
79
} else {
80
81
+ // Set redirect to group activity stream
82
if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) ) {
83
$redirect = bp_get_group_permalink( $group ) . bp_get_activity_slug() . '/' . $activity->id . '/';
84
}
85
}
86
87
+ // Set redirect to users' activity stream
88
+ } else if ( ! empty( $activity->user_id ) ) {
89
$redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id . '/';
90
}
91
92
+ // If set, add the original query string back onto the redirect URL
93
if ( ! empty( $_SERVER['QUERY_STRING'] ) ) {
94
$query_frags = array();
95
wp_parse_str( $_SERVER['QUERY_STRING'], $query_frags );
96
$redirect = add_query_arg( urlencode_deep( $query_frags ), $redirect );
97
}
98
99
+ // Allow redirect to be filtered
100
if ( ! $redirect = apply_filters_ref_array( 'bp_activity_permalink_redirect_url', array( $redirect, &$activity ) ) ) {
101
bp_core_redirect( bp_get_root_domain() );
102
}
103
104
+ // Redirect to the actual activity permalink page
105
bp_core_redirect( $redirect );
106
}
107
add_action( 'bp_actions', 'bp_activity_action_permalink_router' );
109
/**
110
* Delete specific activity item and redirect to previous page.
111
*
112
+ * @since BuddyPress (1.1)
113
+ *
114
+ * @param int $activity_id Activity id to be deleted. Defaults to 0.
115
*
116
* @uses bp_is_activity_component()
117
* @uses bp_is_current_action()
124
* @uses do_action() Calls 'bp_activity_action_delete_activity' hook to allow actions to be taken after the activity is deleted.
125
* @uses bp_core_redirect()
126
*
127
* @return bool False on failure.
128
*/
129
function bp_activity_action_delete_activity( $activity_id = 0 ) {
130
131
+ // Not viewing activity or action is not delete
132
if ( !bp_is_activity_component() || !bp_is_current_action( 'delete' ) )
133
return false;
134
135
if ( empty( $activity_id ) && bp_action_variable( 0 ) )
136
$activity_id = (int) bp_action_variable( 0 );
137
138
+ // Not viewing a specific activity item
139
if ( empty( $activity_id ) )
140
return false;
141
142
+ // Check the nonce
143
check_admin_referer( 'bp_activity_delete_link' );
144
145
+ // Load up the activity item
146
$activity = new BP_Activity_Activity( $activity_id );
147
148
+ // Check access
149
if ( ! bp_activity_user_can_delete( $activity ) )
150
return false;
151
152
+ // Call the action before the delete so plugins can still fetch information about it
153
do_action( 'bp_activity_before_action_delete_activity', $activity_id, $activity->user_id );
154
155
+ // Delete the activity item and provide user feedback
156
if ( bp_activity_delete( array( 'id' => $activity_id, 'user_id' => $activity->user_id ) ) )
157
bp_core_add_message( __( 'Activity deleted successfully', 'buddypress' ) );
158
else
159
bp_core_add_message( __( 'There was an error when deleting that activity', 'buddypress' ), 'error' );
160
161
do_action( 'bp_activity_action_delete_activity', $activity_id, $activity->user_id );
162
163
+ // Check for the redirect query arg, otherwise let WP handle things
164
if ( !empty( $_GET['redirect_to'] ) )
165
bp_core_redirect( esc_url( $_GET['redirect_to'] ) );
166
else
171
/**
172
* Mark specific activity item as spam and redirect to previous page.
173
*
174
+ * @since BuddyPress (1.6)
175
*
176
+ * @global object $bp BuddyPress global settings
177
* @param int $activity_id Activity id to be deleted. Defaults to 0.
178
* @return bool False on failure.
179
*/
180
function bp_activity_action_spam_activity( $activity_id = 0 ) {
181
+ global $bp;
182
183
+ // Not viewing activity, or action is not spam, or Akismet isn't present
184
if ( !bp_is_activity_component() || !bp_is_current_action( 'spam' ) || empty( $bp->activity->akismet ) )
185
return false;
186
187
if ( empty( $activity_id ) && bp_action_variable( 0 ) )
188
$activity_id = (int) bp_action_variable( 0 );
189
190
+ // Not viewing a specific activity item
191
if ( empty( $activity_id ) )
192
return false;
193
195
if ( !bp_activity_user_can_mark_spam() )
196
return false;
197
198
+ // Load up the activity item
199
$activity = new BP_Activity_Activity( $activity_id );
200
if ( empty( $activity->id ) )
201
return false;
202
203
+ // Check nonce
204
check_admin_referer( 'bp_activity_akismet_spam_' . $activity->id );
205
206
+ // Call an action before the spamming so plugins can modify things if they want to
207
do_action( 'bp_activity_before_action_spam_activity', $activity->id, $activity );
208
209
+ // Mark as spam
210
bp_activity_mark_as_spam( $activity );
211
$activity->save();
212
213
+ // Tell the user the spamming has been succesful
214
bp_core_add_message( __( 'The activity item has been marked as spam and is no longer visible.', 'buddypress' ) );
215
216
do_action( 'bp_activity_action_spam_activity', $activity_id, $activity->user_id );
217
218
+ // Check for the redirect query arg, otherwise let WP handle things
219
if ( !empty( $_GET['redirect_to'] ) )
220
bp_core_redirect( esc_url( $_GET['redirect_to'] ) );
221
else
226
/**
227
* Post user/group activity update.
228
*
229
+ * @since BuddyPress (1.2)
230
*
231
* @uses is_user_logged_in()
232
* @uses bp_is_activity_component()
246
*/
247
function bp_activity_action_post_update() {
248
249
+ // Do not proceed if user is not logged in, not viewing activity, or not posting
250
if ( !is_user_logged_in() || !bp_is_activity_component() || !bp_is_current_action( 'post' ) )
251
return false;
252
253
+ // Check the nonce
254
check_admin_referer( 'post_update', '_wpnonce_post_update' );
255
256
+ // Get activity info
257
$content = apply_filters( 'bp_activity_post_update_content', $_POST['whats-new'] );
258
259
if ( ! empty( $_POST['whats-new-post-object'] ) ) {
260
$object = apply_filters( 'bp_activity_post_update_object', $_POST['whats-new-post-object'] );
261
}
262
263
if ( ! empty( $_POST['whats-new-post-in'] ) ) {
264
$item_id = apply_filters( 'bp_activity_post_update_item_id', $_POST['whats-new-post-in'] );
265
}
266
267
+ // No activity content so provide feedback and redirect
268
if ( empty( $content ) ) {
269
bp_core_add_message( __( 'Please enter some content to post.', 'buddypress' ), 'error' );
270
bp_core_redirect( wp_get_referer() );
271
}
272
273
+ // No existing item_id
274
if ( empty( $item_id ) ) {
275
$activity_id = bp_activity_post_update( array( 'content' => $content ) );
276
277
+ // Post to groups object
278
+ } else if ( 'groups' == $object && bp_is_active( 'groups' ) ) {
279
if ( (int) $item_id ) {
280
$activity_id = groups_post_update( array( 'content' => $content, 'group_id' => $item_id ) );
281
}
282
283
+ // Special circumstance so let filters handle it
284
} else {
285
$activity_id = apply_filters( 'bp_activity_custom_update', $object, $item_id, $content );
286
}
287
288
+ // Provide user feedback
289
if ( !empty( $activity_id ) )
290
bp_core_add_message( __( 'Update Posted!', 'buddypress' ) );
291
else
292
+ bp_core_add_message( __( 'There was an error when posting your update, please try again.', 'buddypress' ), 'error' );
293
294
+ // Redirect
295
bp_core_redirect( wp_get_referer() );
296
}
297
add_action( 'bp_actions', 'bp_activity_action_post_update' );
299
/**
300
* Post new activity comment.
301
*
302
+ * @since BuddyPress (1.2)
303
*
304
* @uses is_user_logged_in()
305
* @uses bp_is_activity_component()
319
if ( !is_user_logged_in() || !bp_is_activity_component() || !bp_is_current_action( 'reply' ) )
320
return false;
321
322
+ // Check the nonce
323
check_admin_referer( 'new_activity_comment', '_wpnonce_new_activity_comment' );
324
325
$activity_id = apply_filters( 'bp_activity_post_comment_activity_id', $_POST['comment_form_id'] );
326
$content = apply_filters( 'bp_activity_post_comment_content', $_POST['ac_input_' . $activity_id] );
327
328
if ( empty( $content ) ) {
339
if ( !empty( $comment_id ) )
340
bp_core_add_message( __( 'Reply Posted!', 'buddypress' ) );
341
else
342
+ bp_core_add_message( __( 'There was an error posting that reply, please try again.', 'buddypress' ), 'error' );
343
344
bp_core_redirect( wp_get_referer() . '#ac-form-' . $activity_id );
345
}
348
/**
349
* Mark activity as favorite.
350
*
351
+ * @since BuddyPress (1.2)
352
*
353
* @uses is_user_logged_in()
354
* @uses bp_is_activity_component()
367
if ( !is_user_logged_in() || !bp_is_activity_component() || !bp_is_current_action( 'favorite' ) )
368
return false;
369
370
+ // Check the nonce
371
check_admin_referer( 'mark_favorite' );
372
373
if ( bp_activity_add_user_favorite( bp_action_variable( 0 ) ) )
374
bp_core_add_message( __( 'Activity marked as favorite.', 'buddypress' ) );
375
else
376
+ bp_core_add_message( __( 'There was an error marking that activity as a favorite, please try again.', 'buddypress' ), 'error' );
377
378
bp_core_redirect( wp_get_referer() . '#activity-' . bp_action_variable( 0 ) );
379
}
382
/**
383
* Remove activity from favorites.
384
*
385
+ * @since BuddyPress (1.2)
386
*
387
* @uses is_user_logged_in()
388
* @uses bp_is_activity_component()
401
if ( ! is_user_logged_in() || ! bp_is_activity_component() || ! bp_is_current_action( 'unfavorite' ) )
402
return false;
403
404
+ // Check the nonce
405
check_admin_referer( 'unmark_favorite' );
406
407
if ( bp_activity_remove_user_favorite( bp_action_variable( 0 ) ) )
408
bp_core_add_message( __( 'Activity removed as favorite.', 'buddypress' ) );
409
else
410
+ bp_core_add_message( __( 'There was an error removing that activity as a favorite, please try again.', 'buddypress' ), 'error' );
411
412
bp_core_redirect( wp_get_referer() . '#activity-' . bp_action_variable( 0 ) );
413
}
416
/**
417
* Load the sitewide activity feed.
418
*
419
+ * @since BuddyPress (1.0)
420
*
421
+ * @global object $bp BuddyPress global settings
422
* @uses bp_is_activity_component()
423
* @uses bp_is_current_action()
424
* @uses bp_is_user()
427
* @return bool False on failure.
428
*/
429
function bp_activity_action_sitewide_feed() {
430
+ global $bp;
431
432
if ( ! bp_is_activity_component() || ! bp_is_current_action( 'feed' ) || bp_is_user() || ! empty( $bp->groups->current_group ) )
433
return false;
434
435
+ // setup the feed
436
buddypress()->activity->feed = new BP_Activity_Feed( array(
437
'id' => 'sitewide',
438
439
/* translators: Sitewide activity RSS title - "[Site Name] | Site Wide Activity" */
440
+ 'title' => sprintf( __( '%s | Site Wide Activity', 'buddypress' ), bp_get_site_name() ),
441
442
'link' => bp_get_activity_directory_permalink(),
443
'description' => __( 'Activity feed for the entire site.', 'buddypress' ),
449
/**
450
* Load a user's personal activity feed.
451
*
452
+ * @since BuddyPress (1.0)
453
*
454
* @uses bp_is_user_activity()
455
* @uses bp_is_current_action()
462
return false;
463
}
464
465
+ // setup the feed
466
buddypress()->activity->feed = new BP_Activity_Feed( array(
467
'id' => 'personal',
468
479
/**
480
* Load a user's friends' activity feed.
481
*
482
+ * @since BuddyPress (1.0)
483
*
484
* @uses bp_is_active()
485
* @uses bp_is_user_activity()
495
return false;
496
}
497
498
+ // setup the feed
499
buddypress()->activity->feed = new BP_Activity_Feed( array(
500
'id' => 'friends',
501
512
/**
513
* Load the activity feed for a user's groups.
514
*
515
+ * @since BuddyPress (1.2)
516
*
517
* @uses bp_is_active()
518
* @uses bp_is_user_activity()
528
return false;
529
}
530
531
+ // get displayed user's group IDs
532
$groups = groups_get_user_groups();
533
$group_ids = implode( ',', $groups['groups'] );
534
535
+ // setup the feed
536
buddypress()->activity->feed = new BP_Activity_Feed( array(
537
'id' => 'mygroups',
538
540
'title' => sprintf( __( '%1$s | %2$s | Group Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
541
542
'link' => trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() ),
543
+ 'description' => sprintf( __( "Public group activity feed of which %s is a member of.", 'buddypress' ), bp_get_displayed_user_fullname() ),
544
'activity_args' => array(
545
'object' => buddypress()->groups->id,
546
'primary_id' => $group_ids,
553
/**
554
* Load a user's @mentions feed.
555
*
556
+ * @since BuddyPress (1.2)
557
*
558
* @uses bp_is_user_activity()
559
* @uses bp_is_current_action()
571
return false;
572
}
573
574
+ // setup the feed
575
buddypress()->activity->feed = new BP_Activity_Feed( array(
576
'id' => 'mentions',
577
590
/**
591
* Load a user's favorites feed.
592
*
593
+ * @since BuddyPress (1.2)
594
*
595
* @uses bp_is_user_activity()
596
* @uses bp_is_current_action()
604
return false;
605
}
606
607
+ // get displayed user's favorite activity IDs
608
$favs = bp_activity_get_user_favorites( bp_displayed_user_id() );
609
$fav_ids = implode( ',', (array) $favs );
610
611
+ // setup the feed
612
buddypress()->activity->feed = new BP_Activity_Feed( array(
613
'id' => 'favorites',
614
625
/**
626
* Loads Akismet filtering for activity.
627
*
628
+ * @since BuddyPress (1.6)
629
+ *
630
+ * @global object $bp BuddyPress global settings
631
*/
632
function bp_activity_setup_akismet() {
633
+ global $bp;
634
635
+ // Bail if Akismet is not active
636
+ if ( ! defined( 'AKISMET_VERSION' ) )
637
return;
638
639
+ // Bail if no Akismet key is set
640
+ if ( ! bp_get_option( 'wordpress_api_key' ) && ! defined( 'WPCOM_API_KEY' ) )
641
return;
642
643
+ // Bail if BuddyPress Activity Akismet support has been disabled by another plugin
644
+ if ( ! apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) )
645
return;
646
647
+ // Instantiate Akismet for BuddyPress
648
$bp->activity->akismet = new BP_Akismet();
649
}
bp-activity/bp-activity-admin.php CHANGED
@@ -6,31 +6,31 @@
6
* help text, on which this implementation is heavily based.
7
*
8
* @package BuddyPress
9
- * @subpackage ActivityAdmin
10
- * @since 1.6.0
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 1.6.0
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' ),
34
'bp_moderate',
35
'bp-activity',
36
'bp_activity_admin',
@@ -49,10 +49,10 @@ 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 1.7.0
53
*
54
* @param array $custom_menus The list of top-level BP menu items.
55
- * @return array $custom_menus List of top-level BP menu items, with Activity added.
56
*/
57
function bp_activity_admin_menu_order( $custom_menus = array() ) {
58
array_push( $custom_menus, 'bp-activity' );
@@ -66,10 +66,10 @@ add_filter( 'bp_admin_menu_order', 'bp_activity_admin_menu_order' );
66
* Processes requests to add new activity comments, and echoes HTML for a new
67
* table row.
68
*
69
- * @since 1.6.0
70
*/
71
function bp_activity_admin_reply() {
72
- // Check nonce.
73
check_ajax_referer( 'bp-activity-admin-reply', '_ajax_nonce-bp-activity-admin-reply' );
74
75
$parent_id = ! empty( $_REQUEST['parent_id'] ) ? (int) $_REQUEST['parent_id'] : 0;
@@ -79,15 +79,15 @@ function bp_activity_admin_reply() {
79
if ( empty( $parent_id ) )
80
die( '-1' );
81
82
- // If $root_id not set (e.g. for root items), use $parent_id.
83
if ( empty( $root_id ) )
84
$root_id = $parent_id;
85
86
- // Check that a reply has been entered.
87
if ( empty( $_REQUEST['content'] ) )
88
die( __( 'ERROR: Please type a reply.', 'buddypress' ) );
89
90
- // Check parent activity exists.
91
$parent_activity = new BP_Activity_Activity( $parent_id );
92
if ( empty( $parent_activity->component ) )
93
die( __( 'ERROR: The item you are trying to reply to cannot be found, or it has been deleted.', 'buddypress' ) );
@@ -97,25 +97,25 @@ function bp_activity_admin_reply() {
97
if ( ! current_user_can( 'bp_moderate' ) )
98
die( '-1' );
99
100
- // Add new activity comment.
101
$new_activity_id = bp_activity_new_comment( array(
102
- 'activity_id' => $root_id, // ID of the root activity item.
103
'content' => $_REQUEST['content'],
104
- 'parent_id' => $parent_id, // ID of a parent comment.
105
) );
106
107
- // Fetch the new activity item, as we need it to create table markup to return.
108
$new_activity = new BP_Activity_Activity( $new_activity_id );
109
110
- // This needs to be set for the BP_Activity_List_Table constructor to work.
111
set_current_screen( 'toplevel_page_bp-activity' );
112
113
- // Set up an output buffer.
114
ob_start();
115
$list_table = new BP_Activity_List_Table();
116
$list_table->single_row( (array) $new_activity );
117
118
- // Get table markup.
119
$response = array(
120
'data' => ob_get_contents(),
121
'id' => $new_activity_id,
@@ -124,7 +124,7 @@ function bp_activity_admin_reply() {
124
);
125
ob_end_clean();
126
127
- // Send response.
128
$r = new WP_Ajax_Response();
129
$r->add( $response );
130
$r->send();
@@ -136,10 +136,11 @@ add_action( 'wp_ajax_bp-activity-admin-reply', 'bp_activity_admin_reply' );
136
/**
137
* Handle save/update of screen options for the Activity component admin screen.
138
*
139
- * @since 1.6.0
140
*
141
- * @param string $value Will always be false unless another plugin filters it first.
142
- * @param string $option Screen option name.
143
* @param string $new_value Screen option form value.
144
* @return string Option value. False to abandon update.
145
*/
@@ -147,7 +148,7 @@ function bp_activity_admin_screen_options( $value, $option, $new_value ) {
147
if ( 'toplevel_page_bp_activity_per_page' != $option && 'toplevel_page_bp_activity_network_per_page' != $option )
148
return $value;
149
150
- // Per page.
151
$new_value = (int) $new_value;
152
if ( $new_value < 1 || $new_value > 999 )
153
return $value;
@@ -158,9 +159,8 @@ function bp_activity_admin_screen_options( $value, $option, $new_value ) {
158
/**
159
* Hide the advanced edit meta boxes by default, so we don't clutter the screen.
160
*
161
- * @since 1.6.0
162
*
163
- * @param array $hidden Array of items to hide.
164
* @param WP_Screen $screen Screen identifier.
165
* @return array Hidden Meta Boxes.
166
*/
@@ -168,17 +168,9 @@ function bp_activity_admin_edit_hidden_metaboxes( $hidden, $screen ) {
168
if ( empty( $screen->id ) || 'toplevel_page_bp-activity' != $screen->id && 'toplevel_page_bp-activity_network' != $screen->id )
169
return $hidden;
170
171
- // Hide the primary link meta box by default.
172
$hidden = array_merge( (array) $hidden, array( 'bp_activity_itemids', 'bp_activity_link', 'bp_activity_type', 'bp_activity_userid', ) );
173
174
- /**
175
- * Filters default hidden metaboxes so plugins can alter list.
176
- *
177
- * @since 1.6.0
178
- *
179
- * @param array $hidden Default metaboxes to hide.
180
- * @param WP_Screen $screen Screen identifier.
181
- */
182
return apply_filters( 'bp_hide_meta_boxes', array_unique( $hidden ), $screen );
183
}
184
add_filter( 'default_hidden_meta_boxes', 'bp_activity_admin_edit_hidden_metaboxes', 10, 2 );
@@ -188,12 +180,12 @@ add_filter( 'default_hidden_meta_boxes', 'bp_activity_admin_edit_hidden_metaboxe
188
*
189
* Does the following:
190
* - Register contextual help and screen options for this admin page.
191
- * - Enqueues scripts and styles.
192
- * - Catches POST and GET requests related to Activity.
193
*
194
- * @since 1.6.0
195
*
196
- * @global object $bp BuddyPress global settings.
197
* @global BP_Activity_List_Table $bp_activity_list_table Activity screen list table.
198
*/
199
function bp_activity_admin_load() {
@@ -201,23 +193,17 @@ function bp_activity_admin_load() {
201
202
$bp = buddypress();
203
204
- // Decide whether to load the dev version of the CSS and JavaScript.
205
$min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : 'min.';
206
207
$doaction = bp_admin_list_table_current_bulk_action();
208
209
- /**
210
- * Fires at top of Activity admin page.
211
- *
212
- * @since 1.6.0
213
- *
214
- * @param string $doaction Current $_GET action being performed in admin screen.
215
- */
216
do_action( 'bp_activity_admin_load', $doaction );
217
218
- // Edit screen.
219
if ( 'edit' == $doaction && ! empty( $_GET['aid'] ) ) {
220
- // Columns screen option.
221
add_screen_option( 'layout_columns', array( 'default' => 2, 'max' => 2, ) );
222
223
get_current_screen()->add_help_tab( array(
@@ -234,16 +220,16 @@ function bp_activity_admin_load() {
234
'title' => __( 'Item, Link, Type', 'buddypress' ),
235
'content' =>
236
'<p>' . __( '<strong>Primary Item/Secondary Item</strong> - These identify the object that created the activity. For example, the fields could reference a comment left on a specific site. Some types of activity may only use one, or none, of these fields.', 'buddypress' ) . '</p>' .
237
- '<p>' . __( '<strong>Link</strong> - Used by some types of activity (e.g blog posts and comments, and forum topics and replies) to store a link back to the original content.', 'buddypress' ) . '</p>' .
238
'<p>' . __( '<strong>Type</strong> - Each distinct kind of activity has its own type. For example, <code>created_group</code> is used when a group is created and <code>joined_group</code> is used when a user joins a group.', 'buddypress' ) . '</p>' .
239
'<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>'
240
) );
241
242
- // Help panel - sidebar links.
243
get_current_screen()->set_help_sidebar(
244
'<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
245
- '<p>' . __( '<a href="https://codex.buddypress.org/administrator-guide/activity-stream-management-panels/">Managing Activity</a>', 'buddypress' ) . '</p>' .
246
- '<p>' . __( '<a href="https://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
247
);
248
249
// Register metaboxes for the edit screen.
@@ -253,27 +239,20 @@ function bp_activity_admin_load() {
253
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' );
254
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' );
255
256
- /**
257
- * Fires after the registration of all of the default activity meta boxes.
258
- *
259
- * @since 2.4.0
260
- */
261
- do_action( 'bp_activity_admin_meta_boxes' );
262
-
263
- // Enqueue JavaScript files.
264
wp_enqueue_script( 'postbox' );
265
wp_enqueue_script( 'dashboard' );
266
wp_enqueue_script( 'comment' );
267
268
- // Index screen.
269
} else {
270
- // Create the Activity screen list table.
271
$bp_activity_list_table = new BP_Activity_List_Table();
272
273
- // The per_page screen option.
274
add_screen_option( 'per_page', array( 'label' => _x( 'Activity', 'Activity items per page (screen options)', 'buddypress' )) );
275
276
- // Help panel - overview text.
277
get_current_screen()->add_help_tab( array(
278
'id' => 'bp-activity-overview',
279
'title' => __( 'Overview', 'buddypress' ),
@@ -282,7 +261,7 @@ function bp_activity_admin_load() {
282
'<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>'
283
) );
284
285
- // Help panel - moderation text.
286
get_current_screen()->add_help_tab( array(
287
'id' => 'bp-activity-moderating',
288
'title' => __( 'Moderating Activity', 'buddypress' ),
@@ -291,79 +270,61 @@ function bp_activity_admin_load() {
291
'<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>'
292
) );
293
294
- // Help panel - sidebar links.
295
get_current_screen()->set_help_sidebar(
296
'<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
297
- '<p>' . __( '<a href="https://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
298
);
299
}
300
301
- // Enqueue CSS and JavaScript.
302
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 );
303
wp_localize_script( 'bp_activity_admin_js', 'bp_activity_admin_vars', array(
304
'page' => get_current_screen()->id
305
) );
306
wp_enqueue_style( 'bp_activity_admin_css', $bp->plugin_url . "bp-activity/admin/css/admin.{$min}css", array(), bp_get_version() );
307
308
- wp_style_add_data( 'bp_activity_admin_css', 'rtl', true );
309
- if ( $min ) {
310
- wp_style_add_data( 'bp_activity_admin_css', 'suffix', $min );
311
- }
312
-
313
- /**
314
- * Fires after the activity js and style has been enqueued.
315
- *
316
- * @since 2.4.0
317
- */
318
- do_action( 'bp_activity_admin_enqueue_scripts' );
319
-
320
- // Handle spam/un-spam/delete of activities.
321
if ( !empty( $doaction ) && ! in_array( $doaction, array( '-1', 'edit', 'save', ) ) ) {
322
323
- // Build redirection URL.
324
$redirect_to = remove_query_arg( array( 'aid', 'deleted', 'error', 'spammed', 'unspammed', ), wp_get_referer() );
325
$redirect_to = add_query_arg( 'paged', $bp_activity_list_table->get_pagenum(), $redirect_to );
326
327
- // Get activity IDs.
328
$activity_ids = array_map( 'absint', (array) $_REQUEST['aid'] );
329
330
- /**
331
- * Filters list of IDs being spammed/un-spammed/deleted.
332
- *
333
- * @since 1.6.0
334
- *
335
- * @param array $activity_ids Activity IDs to spam/un-spam/delete.
336
- */
337
$activity_ids = apply_filters( 'bp_activity_admin_action_activity_ids', $activity_ids );
338
339
// Is this a bulk request?
340
if ( 'bulk_' == substr( $doaction, 0, 5 ) && ! empty( $_REQUEST['aid'] ) ) {
341
- // Check this is a valid form submission.
342
check_admin_referer( 'bulk-activities' );
343
344
- // Trim 'bulk_' off the action name to avoid duplicating a ton of code.
345
$doaction = substr( $doaction, 5 );
346
347
// This is a request to delete, spam, or un-spam, a single item.
348
} elseif ( !empty( $_REQUEST['aid'] ) ) {
349
350
- // Check this is a valid form submission.
351
check_admin_referer( 'spam-activity_' . $activity_ids[0] );
352
}
353
354
- // Initialise counters for how many of each type of item we perform an action on.
355
$deleted = $spammed = $unspammed = 0;
356
357
- // Store any errors that occurs when updating the database items.
358
$errors = array();
359
360
// "We'd like to shoot the monster, could you move, please?"
361
foreach ( $activity_ids as $activity_id ) {
362
// @todo: Check the permissions on each
363
//if ( ! current_user_can( 'bp_edit_activity', $activity_id ) )
364
- // continue;
365
366
- // Get the activity from the database.
367
$activity = new BP_Activity_Activity( $activity_id );
368
if ( empty( $activity->component ) ) {
369
$errors[] = $activity_id;
@@ -391,7 +352,7 @@ function bp_activity_admin_load() {
391
bp_activity_mark_as_ham( $activity );
392
$result = $activity->save();
393
394
- // Check for any error during activity save.
395
if ( ! $result )
396
$errors[] = $activity-&g