BuddyPress - Version 1.7

Version Description

See: http://codex.buddypress.org/releases/version-1-7/

Download this release

Release Info

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

Code changes from version 1.6.5 to 1.7

Files changed (296) hide show
  1. bp-activity/admin/css/admin.css +77 -1
  2. bp-activity/admin/css/admin.dev.css +0 -77
  3. bp-activity/admin/css/admin.min.css +1 -0
  4. bp-activity/admin/js/admin.dev.js +0 -167
  5. bp-activity/admin/js/admin.js +167 -1
  6. bp-activity/admin/js/admin.min.js +1 -0
  7. bp-activity/bp-activity-actions.php +6 -8
  8. bp-activity/bp-activity-admin.php +89 -84
  9. bp-activity/bp-activity-akismet.php +30 -30
  10. bp-activity/bp-activity-cache.php +1 -3
  11. bp-activity/bp-activity-classes.php +31 -26
  12. bp-activity/bp-activity-filters.php +70 -45
  13. bp-activity/bp-activity-functions.php +139 -63
  14. bp-activity/bp-activity-loader.php +6 -7
  15. bp-activity/bp-activity-notifications.php +10 -15
  16. bp-activity/bp-activity-screens.php +109 -1
  17. bp-activity/bp-activity-template.php +266 -51
  18. bp-activity/feeds/bp-activity-favorites-feed.php +2 -3
  19. bp-activity/feeds/bp-activity-friends-feed.php +2 -3
  20. bp-activity/feeds/bp-activity-group-feed.php +2 -3
  21. bp-activity/feeds/bp-activity-mentions-feed.php +2 -3
  22. bp-activity/feeds/bp-activity-mygroups-feed.php +2 -3
  23. bp-activity/feeds/bp-activity-personal-feed.php +2 -3
  24. bp-activity/feeds/bp-activity-sitewide-feed.php +2 -3
  25. bp-blogs/bp-blogs-actions.php +0 -2
  26. bp-blogs/bp-blogs-activity.php +2 -4
  27. bp-blogs/bp-blogs-buddybar.php +2 -4
  28. bp-blogs/bp-blogs-cache.php +5 -7
  29. bp-blogs/bp-blogs-classes.php +36 -8
  30. bp-blogs/bp-blogs-filters.php +16 -6
  31. bp-blogs/bp-blogs-functions.php +90 -18
  32. bp-blogs/bp-blogs-loader.php +12 -5
  33. bp-blogs/bp-blogs-screens.php +130 -1
  34. bp-blogs/bp-blogs-template.php +197 -13
  35. bp-blogs/bp-blogs-widgets.php +3 -4
  36. bp-core/admin/bp-core-actions.php +171 -0
  37. bp-core/admin/bp-core-components.php +275 -162
  38. bp-core/admin/bp-core-functions.php +331 -96
  39. bp-core/admin/bp-core-schema.php +9 -61
  40. bp-core/admin/bp-core-settings.php +3 -4
  41. bp-core/admin/bp-core-slugs.php +12 -13
  42. bp-core/admin/bp-core-update.php +0 -1051
  43. bp-core/admin/css/common.css +220 -1
  44. bp-core/admin/css/common.dev.css +0 -148
  45. bp-core/admin/css/common.min.css +1 -0
  46. bp-core/admin/css/wizard.css +0 -1
  47. bp-core/admin/css/wizard.dev.css +0 -181
  48. bp-core/admin/images/badge-2x.png +0 -0
  49. bp-core/admin/images/badge.png +0 -0
  50. bp-core/admin/images/completed.gif +0 -0
  51. bp-core/admin/images/find.png +0 -0
  52. bp-core/admin/images/icons64.png +0 -0
  53. bp-core/admin/images/installed.gif +0 -0
  54. bp-core/admin/images/menu-2x.png +0 -0
  55. bp-core/admin/js/wizard.dev.js +0 -11
  56. bp-core/admin/js/wizard.js +0 -1
  57. bp-core/bp-core-actions.php +25 -195
  58. bp-core/bp-core-admin.php +349 -243
  59. bp-core/bp-core-adminbar.php +60 -17
  60. bp-core/bp-core-avatars.php +116 -93
  61. bp-core/bp-core-buddybar.php +15 -71
  62. bp-core/bp-core-cache.php +3 -5
  63. bp-core/bp-core-caps.php +87 -223
  64. bp-core/bp-core-catchuri.php +37 -27
  65. bp-core/bp-core-classes.php +767 -105
  66. bp-core/bp-core-component.php +0 -5
  67. bp-core/bp-core-cssjs.php +57 -38
  68. bp-core/bp-core-dependency.php +271 -0
  69. bp-core/bp-core-filters.php +87 -60
  70. bp-core/bp-core-functions.php +186 -68
  71. bp-core/bp-core-loader.php +4 -3
  72. bp-core/bp-core-moderation.php +6 -7
  73. bp-core/bp-core-options.php +15 -1
  74. bp-core/bp-core-template-loader.php +398 -0
  75. bp-core/bp-core-template.php +312 -50
  76. bp-core/bp-core-theme-compatibility.php +697 -0
  77. bp-core/bp-core-update.php +178 -43
  78. bp-core/bp-core-widgets.php +39 -38
  79. bp-core/bp-core-wpabstraction.php +0 -2
  80. bp-core/css/admin-bar-rtl.css +27 -1
  81. bp-core/css/admin-bar-rtl.dev.css +0 -27
  82. bp-core/css/admin-bar-rtl.min.css +1 -0
  83. bp-core/css/admin-bar.css +58 -1
  84. bp-core/css/admin-bar.dev.css +0 -58
  85. bp-core/css/admin-bar.min.css +1 -0
  86. bp-core/css/buddybar-rtl.css +77 -1
  87. bp-core/css/buddybar-rtl.dev.css +0 -77
  88. bp-core/css/buddybar-rtl.min.css +1 -0
  89. bp-core/css/buddybar.css +203 -1
  90. bp-core/css/buddybar.dev.css +0 -203
  91. bp-core/css/buddybar.min.css +1 -0
  92. bp-core/deprecated/1.5.php +62 -35
  93. bp-core/deprecated/1.6.php +45 -35
  94. bp-core/deprecated/1.7.php +163 -0
  95. bp-core/js/widget-members.dev.js +0 -49
  96. bp-core/js/widget-members.js +49 -1
  97. bp-core/js/widget-members.min.js +1 -0
  98. bp-forums/bb-config.php +0 -1
  99. bp-forums/bp-forums-actions.php +0 -2
  100. bp-forums/bp-forums-bbpress-sa.php +0 -2
  101. bp-forums/bp-forums-bbpress.php +0 -1
  102. bp-forums/bp-forums-filters.php +1 -4
  103. bp-forums/bp-forums-functions.php +55 -74
  104. bp-forums/bp-forums-loader.php +4 -34
  105. bp-forums/bp-forums-screens.php +98 -10
  106. bp-forums/bp-forums-template.php +0 -1
  107. bp-forums/deprecated/1.6.php +4 -40
  108. bp-forums/{bp-forums-admin.php → deprecated/1.7.php} +19 -6
  109. bp-friends/bp-friends-actions.php +0 -2
  110. bp-friends/bp-friends-activity.php +1 -3
  111. bp-friends/bp-friends-cache.php +0 -2
  112. bp-friends/bp-friends-classes.php +6 -8
  113. bp-friends/bp-friends-filters.php +35 -0
  114. bp-friends/bp-friends-functions.php +3 -5
  115. bp-friends/bp-friends-loader.php +11 -4
  116. bp-friends/bp-friends-notifications.php +4 -10
  117. bp-friends/bp-friends-screens.php +1 -3
  118. bp-friends/bp-friends-template.php +5 -7
  119. bp-groups/admin/css/admin.css +20 -0
  120. bp-groups/admin/css/admin.min.css +1 -0
  121. bp-groups/admin/js/admin.js +31 -0
  122. bp-groups/admin/js/admin.min.js +1 -0
  123. bp-groups/bp-groups-actions.php +5 -3
  124. bp-groups/bp-groups-activity.php +0 -2
  125. bp-groups/bp-groups-admin.php +1324 -0
  126. bp-groups/bp-groups-adminbar.php +0 -2
  127. bp-groups/bp-groups-buddybar.php +0 -2
  128. bp-groups/bp-groups-cache.php +17 -4
  129. bp-groups/bp-groups-classes.php +152 -52
  130. bp-groups/bp-groups-filters.php +7 -4
  131. bp-groups/bp-groups-forums.php +11 -13
  132. bp-groups/bp-groups-functions.php +49 -21
  133. bp-groups/bp-groups-loader.php +43 -30
  134. bp-groups/bp-groups-notifications.php +8 -16
  135. bp-groups/bp-groups-screens.php +664 -458
  136. bp-groups/bp-groups-template.php +254 -64
  137. bp-groups/bp-groups-widgets.php +37 -44
  138. bp-groups/js/widget-groups.dev.js +0 -49
  139. bp-groups/js/widget-groups.js +49 -1
  140. bp-groups/js/widget-groups.min.js +1 -0
  141. bp-languages/buddypress.pot +2652 -1973
  142. bp-loader.php +342 -241
  143. bp-members/bp-members-actions.php +0 -2
  144. bp-members/bp-members-adminbar.php +1 -3
  145. bp-members/bp-members-buddybar.php +7 -17
  146. bp-members/bp-members-filters.php +7 -11
  147. bp-members/bp-members-functions.php +101 -67
  148. bp-members/bp-members-loader.php +7 -8
  149. bp-members/bp-members-notifications.php +5 -7
  150. bp-members/bp-members-screens.php +235 -27
  151. bp-members/bp-members-template.php +79 -13
  152. bp-messages/bp-messages-actions.php +11 -31
  153. bp-messages/bp-messages-cache.php +0 -2
  154. bp-messages/bp-messages-classes.php +4 -4
  155. bp-messages/bp-messages-cssjs.php +7 -19
  156. bp-messages/bp-messages-filters.php +0 -2
  157. bp-messages/bp-messages-functions.php +13 -2
  158. bp-messages/bp-messages-loader.php +13 -6
  159. bp-messages/bp-messages-notifications.php +6 -4
  160. bp-messages/bp-messages-screens.php +24 -12
  161. bp-messages/bp-messages-template.php +12 -14
  162. bp-messages/css/autocomplete/jquery.autocompletefb.css +85 -1
  163. bp-messages/css/autocomplete/jquery.autocompletefb.dev.css +0 -85
  164. bp-messages/css/autocomplete/jquery.autocompletefb.min.css +1 -0
  165. bp-messages/js/autocomplete/jquery.autocomplete.dev.js +0 -730
  166. bp-messages/js/autocomplete/jquery.autocomplete.js +718 -1
  167. bp-messages/js/autocomplete/jquery.autocomplete.min.js +13 -0
  168. bp-messages/js/autocomplete/jquery.autocompletefb.dev.js +0 -76
  169. bp-messages/js/autocomplete/jquery.autocompletefb.js +61 -1
  170. bp-messages/js/autocomplete/jquery.autocompletefb.min.js +16 -0
  171. bp-messages/js/autocomplete/jquery.bgiframe.dev.js +0 -39
  172. bp-messages/js/autocomplete/jquery.bgiframe.js +34 -1
  173. bp-messages/js/autocomplete/jquery.bgiframe.min.js +6 -0
  174. bp-messages/js/autocomplete/jquery.dimensions.dev.js +0 -117
  175. bp-messages/js/autocomplete/jquery.dimensions.js +105 -1
  176. bp-messages/js/autocomplete/jquery.dimensions.min.js +13 -0
  177. bp-messages/js/autocomplete/license.bgiframe.txt +19 -19
  178. bp-settings/bp-settings-actions.php +179 -177
  179. bp-settings/bp-settings-functions.php +0 -2
  180. bp-settings/bp-settings-loader.php +17 -24
  181. bp-settings/bp-settings-screens.php +0 -2
  182. bp-settings/bp-settings-template.php +2 -6
  183. bp-templates/bp-legacy/buddypress-functions.php +1238 -0
  184. bp-templates/bp-legacy/buddypress/activity/activity-loop.php +53 -0
  185. bp-templates/bp-legacy/buddypress/activity/comment.php +54 -0
  186. bp-templates/bp-legacy/buddypress/activity/entry.php +122 -0
  187. bp-templates/bp-legacy/buddypress/activity/index.php +129 -0
  188. bp-templates/bp-legacy/buddypress/activity/post-form.php +74 -0
  189. bp-templates/bp-legacy/buddypress/activity/single/home.php +17 -0
  190. bp-templates/bp-legacy/buddypress/blogs/blogs-loop.php +95 -0
  191. bp-templates/bp-legacy/buddypress/blogs/create.php +21 -0
  192. bp-templates/bp-legacy/buddypress/blogs/index.php +65 -0
  193. bp-templates/bp-legacy/buddypress/forums/forums-loop.php +127 -0
  194. bp-templates/bp-legacy/buddypress/forums/index.php +140 -0
  195. bp-templates/bp-legacy/buddypress/groups/create.php +306 -0
  196. bp-templates/bp-legacy/buddypress/groups/groups-loop.php +100 -0
  197. bp-templates/bp-legacy/buddypress/groups/index.php +66 -0
  198. bp-templates/bp-legacy/buddypress/groups/single/activity.php +43 -0
  199. bp-templates/bp-legacy/buddypress/groups/single/admin.php +373 -0
  200. bp-templates/bp-legacy/buddypress/groups/single/forum.php +97 -0
  201. bp-templates/bp-legacy/buddypress/groups/single/forum/edit.php +92 -0
  202. bp-templates/bp-legacy/buddypress/groups/single/forum/topic.php +166 -0
  203. bp-templates/bp-legacy/buddypress/groups/single/group-header.php +64 -0
  204. bp-templates/bp-legacy/buddypress/groups/single/home.php +107 -0
  205. bp-templates/bp-legacy/buddypress/groups/single/members.php +90 -0
  206. bp-templates/bp-legacy/buddypress/groups/single/plugins.php +13 -0
  207. bp-templates/bp-legacy/buddypress/groups/single/request-membership.php +18 -0
  208. bp-templates/bp-legacy/buddypress/groups/single/send-invites.php +78 -0
  209. bp-templates/bp-legacy/buddypress/members/activate.php +42 -0
  210. bp-templates/bp-legacy/buddypress/members/index.php +64 -0
  211. bp-templates/bp-legacy/buddypress/members/members-loop.php +113 -0
  212. bp-templates/bp-legacy/buddypress/members/register.php +269 -0
  213. bp-templates/bp-legacy/buddypress/members/single/activity.php +77 -0
  214. bp-templates/bp-legacy/buddypress/members/single/blogs.php +52 -0
  215. bp-templates/bp-legacy/buddypress/members/single/forums.php +47 -0
  216. bp-templates/bp-legacy/buddypress/members/single/forums/topics.php +7 -0
  217. bp-templates/bp-legacy/buddypress/members/single/friends.php +60 -0
  218. bp-templates/bp-legacy/buddypress/members/single/friends/requests.php +73 -0
  219. bp-templates/bp-legacy/buddypress/members/single/groups.php +63 -0
  220. bp-templates/bp-legacy/buddypress/members/single/groups/invites.php +42 -0
  221. bp-templates/bp-legacy/buddypress/members/single/home.php +63 -0
  222. bp-templates/bp-legacy/buddypress/members/single/member-header.php +62 -0
  223. bp-templates/bp-legacy/buddypress/members/single/messages.php +67 -0
  224. bp-templates/bp-legacy/buddypress/members/single/messages/compose.php +37 -0
  225. bp-templates/bp-legacy/buddypress/members/single/messages/messages-loop.php +74 -0
  226. bp-templates/bp-legacy/buddypress/members/single/messages/notices-loop.php +59 -0
  227. bp-templates/bp-legacy/buddypress/members/single/messages/single.php +121 -0
  228. bp-templates/bp-legacy/buddypress/members/single/plugins.php +31 -0
  229. bp-templates/bp-legacy/buddypress/members/single/profile.php +60 -0
  230. bp-templates/bp-legacy/buddypress/members/single/profile/change-avatar.php +59 -0
  231. bp-templates/bp-legacy/buddypress/members/single/profile/edit.php +159 -0
  232. bp-templates/bp-legacy/buddypress/members/single/profile/profile-loop.php +48 -0
  233. bp-templates/bp-legacy/buddypress/members/single/profile/profile-wp.php +73 -0
  234. bp-templates/bp-legacy/buddypress/members/single/settings.php +40 -0
  235. bp-templates/bp-legacy/buddypress/members/single/settings/capabilities.php +34 -0
  236. bp-templates/bp-legacy/buddypress/members/single/settings/delete-account.php +48 -0
  237. bp-templates/bp-legacy/buddypress/members/single/settings/general.php +45 -0
  238. bp-templates/bp-legacy/buddypress/members/single/settings/notifications.php +34 -0
  239. bp-templates/bp-legacy/css/buddypress-rtl.css +1536 -0
  240. bp-templates/bp-legacy/css/buddypress.css +1536 -0
  241. bp-templates/bp-legacy/js/buddypress.js +1461 -0
  242. bp-themes/bp-default/_inc/ajax.php +4 -5
  243. bp-themes/bp-default/_inc/global.js +47 -48
  244. bp-themes/bp-default/activity/comment.php +4 -1
  245. bp-themes/bp-default/activity/entry.php +1 -1
  246. bp-themes/bp-default/blogs/create.php +2 -1
  247. bp-themes/bp-default/comments.php +25 -17
  248. bp-themes/bp-default/forums/forums-loop.php +1 -1
  249. bp-themes/bp-default/functions.php +8 -8
  250. bp-themes/bp-default/groups/create.php +1 -1
  251. bp-themes/bp-default/groups/index.php +2 -1
  252. bp-themes/bp-default/groups/single/forum.php +2 -1
  253. bp-themes/bp-default/groups/single/home.php +57 -25
  254. bp-themes/bp-default/groups/single/send-invites.php +1 -1
  255. bp-themes/bp-default/header.php +1 -1
  256. bp-themes/bp-default/license.txt +280 -280
  257. bp-themes/bp-default/members/single/messages/compose.php +1 -1
  258. bp-themes/bp-default/members/single/messages/messages-loop.php +1 -1
  259. bp-themes/bp-default/members/single/profile/edit.php +2 -0
  260. bp-themes/bp-default/members/single/settings.php +1 -1
  261. bp-themes/bp-default/readme.txt +21 -21
  262. bp-themes/bp-default/registration/activate.php +9 -7
  263. bp-themes/bp-default/registration/register.php +10 -9
  264. bp-themes/bp-default/rtl.css +2 -2
  265. bp-themes/bp-default/sidebar.php +2 -0
  266. bp-themes/bp-default/style.css +2 -2
  267. bp-themes/index.php +5 -0
  268. bp-xprofile/admin/css/admin.css +248 -1
  269. bp-xprofile/admin/css/admin.dev.css +0 -248
  270. bp-xprofile/admin/css/admin.min.css +1 -0
  271. bp-xprofile/admin/js/admin.dev.js +0 -209
  272. bp-xprofile/admin/js/admin.js +238 -1
  273. bp-xprofile/admin/js/admin.min.js +1 -0
  274. bp-xprofile/bp-xprofile-actions.php +0 -3
  275. bp-xprofile/bp-xprofile-activity.php +2 -4
  276. bp-xprofile/bp-xprofile-admin.php +3 -5
  277. bp-xprofile/bp-xprofile-buddybar.php +0 -2
  278. bp-xprofile/bp-xprofile-cache.php +0 -2
  279. bp-xprofile/bp-xprofile-caps.php +3 -4
  280. bp-xprofile/bp-xprofile-classes.php +138 -122
  281. bp-xprofile/bp-xprofile-cssjs.php +5 -13
  282. bp-xprofile/bp-xprofile-filters.php +45 -7
  283. bp-xprofile/bp-xprofile-functions.php +33 -22
  284. bp-xprofile/bp-xprofile-loader.php +27 -14
  285. bp-xprofile/bp-xprofile-screens.php +28 -14
  286. bp-xprofile/bp-xprofile-template.php +2 -7
  287. humans.txt +12 -7
  288. readme.txt +16 -13
  289. screenshot-1.gif +0 -0
  290. screenshot-2.gif +0 -0
  291. screenshot-3.gif +0 -0
  292. screenshot-4.gif +0 -0
  293. screenshot-5.gif +0 -0
  294. screenshot-6.gif +0 -0
  295. screenshot-7.gif +0 -0
  296. screenshot-8.gif +0 -0
bp-activity/admin/css/admin.css CHANGED
@@ -1 +1,77 @@
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}
1
+ .akismet-status {
2
+ float: right;
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: right;
42
+ padding: 4px 10px 0;
43
+ vertical-align: top;
44
+ }
45
+ #bp-activities-form .column-response img {
46
+ float: left;
47
+ margin-right: 10px;
48
+ margin-top: 1px;
49
+ }
50
+ .activity-errors {
51
+ list-style-type: disc;
52
+ margin-left: 2em;
53
+ }
54
+
55
+ #bp_activity_action div.inside,
56
+ #bp_activity_content div.inside {
57
+ line-height: 0;
58
+ }
59
+ #bp_activity_action h3,
60
+ #bp_activity_content h3 {
61
+ cursor: auto;
62
+ }
63
+ #bp_activity_action td.mceIframeContainer,
64
+ #bp_activity_content td.mceIframeContainer {
65
+ background-color: white;
66
+ }
67
+ #post-body #bp-activities-action_resize,
68
+ #post-body #bp-activities-content_resize {
69
+ position: inherit;
70
+ margin-top: -2px;
71
+ }
72
+ #bp_activity_link input {
73
+ width: 99%;
74
+ }
75
+ #bp-activities-primaryid {
76
+ margin-bottom: 1em;
77
+ }
bp-activity/admin/css/admin.dev.css DELETED
@@ -1,77 +0,0 @@
1
- .akismet-status {
2
- float: right;
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: right;
42
- padding: 4px 10px 0;
43
- vertical-align: top;
44
- }
45
- #bp-activities-form .column-response img {
46
- float: left;
47
- margin-right: 10px;
48
- margin-top: 1px;
49
- }
50
- .activity-errors {
51
- list-style-type: disc;
52
- margin-left: 2em;
53
- }
54
-
55
- #bp_activity_action div.inside,
56
- #bp_activity_content div.inside {
57
- line-height: 0;
58
- }
59
- #bp_activity_action h3,
60
- #bp_activity_content h3 {
61
- cursor: auto;
62
- }
63
- #bp_activity_action td.mceIframeContainer,
64
- #bp_activity_content td.mceIframeContainer {
65
- background-color: white;
66
- }
67
- #post-body #bp-activities-action_resize,
68
- #post-body #bp-activities-content_resize {
69
- position: inherit;
70
- margin-top: -2px;
71
- }
72
- #bp_activity_link input {
73
- width: 99%;
74
- }
75
- #bp-activities-primaryid {
76
- margin-bottom: 1em;
77
- }
bp-activity/admin/css/admin.min.css ADDED
@@ -0,0 +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-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}
bp-activity/admin/js/admin.dev.js DELETED
@@ -1,167 +0,0 @@
1
- (function( $ ) {
2
-
3
- /**
4
- * Activity reply object for the activity index screen
5
- *
6
- * @since 1.6
7
- */
8
- var activityReply = {
9
-
10
- /**
11
- * Attach event handler functions to the relevant elements.
12
- *
13
- * @since 1.6
14
- */
15
- init : function() {
16
- $(document).on( 'click', '.row-actions a.reply', activityReply.open );
17
- $(document).on( 'click', '#bp-activities-container a.cancel', activityReply.close );
18
- $(document).on( 'click', '#bp-activities-container a.save', activityReply.send );
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
- });
26
- },
27
-
28
- /**
29
- * Reveals the entire row when "reply" is pressed.
30
- *
31
- * @since 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 );
37
-
38
- // Fade the whole row in, and set focus on the text area.
39
- box.fadeIn( '300' );
40
- $( '#bp-activities' ).focus();
41
-
42
- return false;
43
- },
44
-
45
- /**
46
- * Hide and reset the entire row when "cancel", or escape, are pressed.
47
- *
48
- * @since 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();
56
-
57
- // Remove any error message and disable the spinner
58
- $( '#bp-replysubmit .error' ).html( '' ).hide();
59
- $( '#bp-replysubmit .waiting' ).hide();
60
- });
61
-
62
- return false;
63
- },
64
-
65
- /**
66
- * Submits "form" via AJAX back to WordPress.
67
- *
68
- * @since 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();
74
-
75
- // Grab the nonce
76
- var reply = {};
77
- reply['_ajax_nonce-bp-activity-admin-reply'] = $( '#bp-activities-container input[name="_ajax_nonce-bp-activity-admin-reply"]' ).val();
78
-
79
- // Get the rest of the data
80
- reply.action = 'bp-activity-admin-reply';
81
- reply.content = $( '#bp-activities' ).val();
82
- reply.parent_id = $( '#bp-activities-container' ).prev().data( 'parent_id' );
83
- reply.root_id = $( '#bp-activities-container' ).prev().data( 'root_id' );
84
-
85
- // Make the AJAX call
86
- $.ajax({
87
- data : reply,
88
- type : 'POST',
89
- url : ajaxurl,
90
-
91
- // Callbacks
92
- error : function( r ) { activityReply.error( r ); },
93
- success : function( r ) { activityReply.show( r ); }
94
- });
95
-
96
- return false;
97
- },
98
-
99
- /**
100
- * send() error message handler
101
- *
102
- * @since 1.6
103
- */
104
- error : function( r ) {
105
- var er = r.statusText;
106
- $('#bp-replysubmit .waiting').hide();
107
-
108
- if ( r.responseText ) {
109
- er = r.responseText.replace( /<.[^<>]*?>/g, '' );
110
- }
111
-
112
- if ( er ) {
113
- $('#bp-replysubmit .error').html( er ).show();
114
- }
115
- },
116
-
117
- /**
118
- * send() success handler
119
- *
120
- * @since 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
- }
130
-
131
- response = wpAjax.parseAjaxResponse( xml );
132
- if ( response.errors ) {
133
- activityReply.error( { 'responseText': wpAjax.broken } );
134
- return false;
135
- }
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();
143
-
144
- // Remove any error message and disable the spinner
145
- $( '#bp-replysubmit .error' ).html( '' ).hide();
146
- $( '#bp-replysubmit .waiting' ).hide();
147
-
148
- // Insert new activity item
149
- $( '#bp-activities-container' ).before( response.data );
150
-
151
- // Get background colour and animate the flash
152
- id = $( '#activity-' + response.id );
153
- bg = id.closest( '.widefat' ).css( 'backgroundColor' );
154
- id.animate( { 'backgroundColor': '#CEB' }, 300 ).animate( { 'backgroundColor': bg }, 300 );
155
- });
156
- }
157
- };
158
-
159
- $(document).ready( function () {
160
- // Create the Activity reply object after domready event
161
- activityReply.init();
162
-
163
- // On the edit screen, unload the close/open toggle js for the action & content metaboxes
164
- $( '#bp_activity_action h3, #bp_activity_content h3' ).unbind( 'click' );
165
- });
166
-
167
- })(jQuery);
bp-activity/admin/js/admin.js CHANGED
@@ -1 +1,167 @@
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")})})(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 );
17
+ $(document).on( 'click', '#bp-activities-container a.cancel', activityReply.close );
18
+ $(document).on( 'click', '#bp-activities-container a.save', activityReply.send );
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
+ });
26
+ },
27
+
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 );
37
+
38
+ // Fade the whole row in, and set focus on the text area.
39
+ box.fadeIn( '300' );
40
+ $( '#bp-activities' ).focus();
41
+
42
+ return false;
43
+ },
44
+
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();
56
+
57
+ // Remove any error message and disable the spinner
58
+ $( '#bp-replysubmit .error' ).html( '' ).hide();
59
+ $( '#bp-replysubmit .waiting' ).hide();
60
+ });
61
+
62
+ return false;
63
+ },
64
+
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();
74
+
75
+ // Grab the nonce
76
+ var reply = {};
77
+ reply['_ajax_nonce-bp-activity-admin-reply'] = $( '#bp-activities-container input[name="_ajax_nonce-bp-activity-admin-reply"]' ).val();
78
+
79
+ // Get the rest of the data
80
+ reply.action = 'bp-activity-admin-reply';
81
+ reply.content = $( '#bp-activities' ).val();
82
+ reply.parent_id = $( '#bp-activities-container' ).prev().data( 'parent_id' );
83
+ reply.root_id = $( '#bp-activities-container' ).prev().data( 'root_id' );
84
+
85
+ // Make the AJAX call
86
+ $.ajax({
87
+ data : reply,
88
+ type : 'POST',
89
+ url : ajaxurl,
90
+
91
+ // Callbacks
92
+ error : function( r ) { activityReply.error( r ); },
93
+ success : function( r ) { activityReply.show( r ); }
94
+ });
95
+
96
+ return false;
97
+ },
98
+
99
+ /**
100
+ * send() error message handler
101
+ *
102
+ * @since BuddyPress (1.6)
103
+ */
104
+ error : function( r ) {
105
+ var er = r.statusText;
106
+ $('#bp-replysubmit .waiting').hide();
107
+
108
+ if ( r.responseText ) {
109
+ er = r.responseText.replace( /<.[^<>]*?>/g, '' );
110
+ }
111
+
112
+ if ( er ) {
113
+ $('#bp-replysubmit .error').html( er ).show();
114
+ }
115
+ },
116
+
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
+ }
130
+
131
+ response = wpAjax.parseAjaxResponse( xml );
132
+ if ( response.errors ) {
133
+ activityReply.error( { 'responseText': wpAjax.broken } );
134
+ return false;
135
+ }
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();
143
+
144
+ // Remove any error message and disable the spinner
145
+ $( '#bp-replysubmit .error' ).html( '' ).hide();
146
+ $( '#bp-replysubmit .waiting' ).hide();
147
+
148
+ // Insert new activity item
149
+ $( '#bp-activities-container' ).before( response.data );
150
+
151
+ // Get background colour and animate the flash
152
+ id = $( '#activity-' + response.id );
153
+ bg = id.closest( '.widefat' ).css( 'backgroundColor' );
154
+ id.animate( { 'backgroundColor': '#CEB' }, 300 ).animate( { 'backgroundColor': bg }, 300 );
155
+ });
156
+ }
157
+ };
158
+
159
+ $(document).ready( function () {
160
+ // Create the Activity reply object after domready event
161
+ activityReply.init();
162
+
163
+ // On the edit screen, unload the close/open toggle js for the action & content metaboxes
164
+ $( '#bp_activity_action h3, #bp_activity_content h3' ).unbind( 'click' );
165
+ });
166
+
167
+ })(jQuery);
bp-activity/admin/js/admin.min.js ADDED
@@ -0,0 +1 @@
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")})})(jQuery);
bp-activity/bp-activity-actions.php CHANGED
@@ -147,7 +147,7 @@ function bp_activity_action_delete_activity( $activity_id = 0 ) {
147
$activity = new BP_Activity_Activity( $activity_id );
148
149
// Check access
150
- if ( empty( $activity->user_id ) || !bp_activity_user_can_delete( $activity ) )
151
return false;
152
153
// Call the action before the delete so plugins can still fetch information about it
@@ -175,7 +175,7 @@ add_action( 'bp_actions', 'bp_activity_action_delete_activity' );
175
* @global object $bp BuddyPress global settings
176
* @param int $activity_id Activity id to be deleted. Defaults to 0.
177
* @return bool False on failure
178
- * @since 1.6
179
*/
180
function bp_activity_action_spam_activity( $activity_id = 0 ) {
181
global $bp;
@@ -325,9 +325,9 @@ function bp_activity_action_post_comment() {
325
}
326
327
$comment_id = bp_activity_new_comment( array(
328
- 'content' => $content,
329
'activity_id' => $activity_id,
330
- 'parent_id' => $parent_id
331
));
332
333
if ( !empty( $comment_id ) )
@@ -577,7 +577,7 @@ add_action( 'bp_actions', 'bp_activity_action_favorites_feed' );
577
* Loads Akismet
578
*
579
* @global object $bp BuddyPress global settings
580
- * @since 1.6
581
*/
582
function bp_activity_setup_akismet() {
583
global $bp;
@@ -591,11 +591,9 @@ function bp_activity_setup_akismet() {
591
return;
592
593
// Bail if BuddyPress Activity Akismet support has been disabled by another plugin
594
- if ( ! apply_filters( 'bp_activity_use_akismet', true ) )
595
return;
596
597
// Instantiate Akismet for BuddyPress
598
$bp->activity->akismet = new BP_Akismet();
599
}
600
-
601
- ?>
147
$activity = new BP_Activity_Activity( $activity_id );
148
149
// Check access
150
+ if ( ! bp_activity_user_can_delete( $activity ) )
151
return false;
152
153
// Call the action before the delete so plugins can still fetch information about it
175
* @global object $bp BuddyPress global settings
176
* @param int $activity_id Activity id to be deleted. Defaults to 0.
177
* @return bool False on failure
178
+ * @since BuddyPress (1.6)
179
*/
180
function bp_activity_action_spam_activity( $activity_id = 0 ) {
181
global $bp;
325
}
326
327
$comment_id = bp_activity_new_comment( array(
328
+ 'content' => $content,
329
'activity_id' => $activity_id,
330
+ 'parent_id' => false
331
));
332
333
if ( !empty( $comment_id ) )
577
* Loads Akismet
578
*
579
* @global object $bp BuddyPress global settings
580
+ * @since BuddyPress (1.6)
581
*/
582
function bp_activity_setup_akismet() {
583
global $bp;
591
return;
592
593
// Bail if BuddyPress Activity Akismet support has been disabled by another plugin
594
+ if ( ! apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) )
595
return;
596
597
// Instantiate Akismet for BuddyPress
598
$bp->activity->akismet = new BP_Akismet();
599
}
bp-activity/bp-activity-admin.php CHANGED
@@ -6,7 +6,7 @@
6
* on which this implementation is heavily based.
7
*
8
* @package BuddyPress
9
- * @since 1.6
10
* @subpackage Activity
11
*/
12
@@ -23,7 +23,7 @@ if ( is_admin() && ! empty( $_REQUEST['page'] ) && 'bp-activity' == $_REQUEST['p
23
/**
24
* Registers the Activity component admin screen
25
*
26
- * @since 1.6
27
*/
28
function bp_activity_add_admin_menu() {
29
@@ -31,18 +31,39 @@ function bp_activity_add_admin_menu() {
31
return;
32
33
// Add our screen
34
- $hook = add_menu_page( __( 'Activity', 'buddypress' ), __( 'Activity', 'buddypress' ), 'manage_options', 'bp-activity', 'bp_activity_admin' );
35
36
// Hook into early actions to load custom CSS and our init handler.
37
add_action( "load-$hook", 'bp_activity_admin_load' );
38
}
39
add_action( bp_core_admin_hook(), 'bp_activity_add_admin_menu' );
40
41
/**
42
* AJAX receiver for Activity replies via the admin screen. Adds a new activity
43
* comment, and returns HTML for a new table row.
44
*
45
- * @since 1.6
46
*/
47
function bp_activity_admin_reply() {
48
// Check nonce
@@ -116,7 +137,7 @@ add_action( 'wp_ajax_bp-activity-admin-reply', 'bp_activity_admin_reply' );
116
* @param string $option Screen option name
117
* @param string $new_value Screen option form value
118
* @return string Option value. False to abandon update.
119
- * @since 1.6
120
*/
121
function bp_activity_admin_screen_options( $value, $option, $new_value ) {
122
if ( 'toplevel_page_bp_activity_per_page' != $option && 'toplevel_page_bp_activity_network_per_page' != $option )
@@ -135,7 +156,7 @@ function bp_activity_admin_screen_options( $value, $option, $new_value ) {
135
*
136
* @param WP_Screen $screen Screen identifier
137
* @return array Hidden Meta Boxes
138
- * @since 1.0
139
*/
140
function bp_activity_admin_edit_hidden_metaboxes( $hidden, $screen ) {
141
if ( empty( $screen->id ) || 'toplevel_page_bp-activity' != $screen->id && 'toplevel_page_bp-activity_network' != $screen->id )
@@ -153,16 +174,15 @@ add_filter( 'default_hidden_meta_boxes', 'bp_activity_admin_edit_hidden_metaboxe
153
*
154
* @global object $bp BuddyPress global settings
155
* @global BP_Activity_List_Table $bp_activity_list_table Activity screen list table
156
- * @since 1.6
157
*/
158
function bp_activity_admin_load() {
159
global $bp, $bp_activity_list_table;
160
161
// Decide whether to load the dev version of the CSS and JavaScript
162
- $dev = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? 'dev.' : '';
163
164
- // Decide whether to load the index or edit screen
165
- $doaction = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
166
167
// Call an action for plugins to hook in early
168
do_action( 'bp_activity_admin_load', $doaction );
@@ -244,8 +264,8 @@ function bp_activity_admin_load() {
244
}
245
246
// Enqueue CSS and JavaScript
247
- wp_enqueue_script( 'bp_activity_admin_js', BP_PLUGIN_URL . "bp-activity/admin/js/admin.{$dev}js", array( 'jquery', 'wp-ajax-response' ), bp_get_version(), true );
248
- wp_enqueue_style( 'bp_activity_admin_css', BP_PLUGIN_URL . "bp-activity/admin/css/admin.{$dev}css", array(), bp_get_version() );
249
250
// Handle spam/un-spam/delete of activities
251
if ( !empty( $doaction ) && ! in_array( $doaction, array( '-1', 'edit', 'save', ) ) ) {
@@ -503,7 +523,7 @@ function bp_activity_admin_load() {
503
/**
504
* Outputs the Activity component admin screens
505
*
506
- * @since 1.6
507
*/
508
function bp_activity_admin() {
509
// Decide whether to load the index or edit screen
@@ -522,10 +542,9 @@ function bp_activity_admin() {
522
* Display the single activity edit screen
523
*
524
* @global int $screen_layout_columns Number of columns shown on this admin page
525
- * @since 1.6
526
*/
527
function bp_activity_admin_edit() {
528
- global $screen_layout_columns;
529
530
// @todo: Check if user is allowed to edit activity items
531
// if ( ! current_user_can( 'bp_edit_activity' ) )
@@ -556,8 +575,7 @@ function bp_activity_admin_edit() {
556
$form_url = add_query_arg( 'action', 'save', $form_url );
557
558
// Call an action for plugins to modify the activity before we display the edit form
559
- do_action_ref_array( 'bp_activity_admin_edit', array( &$activity ) );
560
- ?>
561
562
<div class="wrap">
563
<?php screen_icon( 'buddypress-activity' ); ?>
@@ -568,7 +586,7 @@ function bp_activity_admin_edit() {
568
<form action="<?php echo esc_attr( $form_url ); ?>" id="bp-activities-edit-form" method="post">
569
<div id="poststuff">
570
571
- <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
572
<div id="post-body-content">
573
<div id="postdiv" class="postarea">
574
<div id="bp_activity_action" class="postbox">
@@ -604,7 +622,7 @@ function bp_activity_admin_edit() {
604
</form>
605
606
<?php else : ?>
607
- <p><?php printf( __( 'No activity found with this ID. <a href="%s">Go back and try again</a>.', 'buddypress' ), network_admin_url( 'admin.php?page=bp-activity' ) ); ?></p>
608
<?php endif; ?>
609
610
</div><!-- .wrap -->
@@ -616,7 +634,7 @@ function bp_activity_admin_edit() {
616
* Status metabox for the Activity admin edit screen
617
*
618
* @param object $item Activity item
619
- * @since 1.6
620
*/
621
function bp_activity_admin_edit_metabox_status( $item ) {
622
?>
@@ -671,7 +689,7 @@ function bp_activity_admin_edit_metabox_status( $item ) {
671
* Primary link metabox for the Activity admin edit screen
672
*
673
* @param object $item Activity item
674
- * @since 1.6
675
*/
676
function bp_activity_admin_edit_metabox_link( $item ) {
677
?>
@@ -687,7 +705,7 @@ function bp_activity_admin_edit_metabox_link( $item ) {
687
* User ID metabox for the Activity admin edit screen
688
*
689
* @param object $item Activity item
690
- * @since 1.6
691
*/
692
function bp_activity_admin_edit_metabox_userid( $item ) {
693
?>
@@ -703,7 +721,7 @@ function bp_activity_admin_edit_metabox_userid( $item ) {
703
*
704
* @global object $bp BuddyPress global settings
705
* @param object $item Activity item
706
- * @since 1.6
707
*/
708
function bp_activity_admin_edit_metabox_type( $item ) {
709
global $bp;
@@ -723,8 +741,7 @@ function bp_activity_admin_edit_metabox_type( $item ) {
723
unset( $actions['friends_register_activity_action'] );
724
725
// Sort array by the human-readable value
726
- natsort( $actions );
727
- ?>
728
729
<select name="bp-activities-type">
730
<?php foreach ( $actions as $k => $v ) : ?>
@@ -739,7 +756,7 @@ function bp_activity_admin_edit_metabox_type( $item ) {
739
* Primary item ID/Secondary item ID metabox for the Activity admin edit screen
740
*
741
* @param object $item Activity item
742
- * @since 1.6
743
*/
744
function bp_activity_admin_edit_metabox_itemids( $item ) {
745
?>
@@ -761,7 +778,7 @@ function bp_activity_admin_edit_metabox_itemids( $item ) {
761
*
762
* @global BP_Activity_List_Table $bp_activity_list_table Activity screen list table
763
* @global string $plugin_page
764
- * @since 1.6
765
*/
766
function bp_activity_admin_index() {
767
global $bp_activity_list_table, $plugin_page;
@@ -780,15 +797,16 @@ function bp_activity_admin_index() {
780
781
// Make sure we don't get any empty values in $errors
782
for ( $i = 0, $errors_count = count( $errors ); $i < $errors_count; $i++ ) {
783
- if ( 0 === $errors[$i] )
784
unset( $errors[$i] );
785
}
786
787
// Reindex array
788
$errors = array_values( $errors );
789
790
if ( $deleted > 0 )
791
- $messages[] = sprintf( _n( '%s activity has been permanently deleted.', '%s activity items have been permanently deleted.', $deleted, 'buddypress' ), number_format_i18n( $deleted ) );
792
793
if ( ! empty( $errors ) ) {
794
if ( 1 == count( $errors ) ) {
@@ -810,21 +828,20 @@ function bp_activity_admin_index() {
810
}
811
812
if ( $spammed > 0 )
813
- $messages[] = sprintf( _n( '%s activity has been successfully spammed.', '%s activity items have been successfully spammed.', $spammed, 'buddypress' ), number_format_i18n( $spammed ) );
814
815
if ( $unspammed > 0 )
816
- $messages[] = sprintf( _n( '%s activity has been successfully unspammed.', '%s activity items have been successfully unspammed.', $unspammed, 'buddypress' ), number_format_i18n( $unspammed ) );
817
818
if ( $updated > 0 )
819
- $messages[] = __( 'The activity has been updated succesfully.', 'buddypress' );
820
}
821
822
// Prepare the activity items for display
823
$bp_activity_list_table->prepare_items();
824
825
// Call an action for plugins to modify the activity before we display the edit form
826
- do_action( 'bp_activity_admin_index', $messages );
827
- ?>
828
829
<div class="wrap">
830
<?php screen_icon( 'buddypress-activity' ); ?>
@@ -867,7 +884,7 @@ function bp_activity_admin_index() {
867
<a href="#" class="cancel button-secondary alignleft"><?php _e( 'Cancel', 'buddypress' ); ?></a>
868
<a href="#" class="save button-primary alignright"><?php _e( 'Reply', 'buddypress' ); ?></a>
869
870
- <img class="waiting" style="display:none;" src="<?php echo esc_url( network_admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
871
<span class="error" style="display:none;"></span>
872
<br class="clear" />
873
</p>
@@ -886,34 +903,35 @@ function bp_activity_admin_index() {
886
/**
887
* List table class for the Activity component admin page.
888
*
889
- * @since 1.6
890
*/
891
class BP_Activity_List_Table extends WP_List_Table {
892
/**
893
* What type of view is being displayed? e.g. "All", "Pending", "Approved", "Spam"...
894
*
895
- * @since 1.6
896
*/
897
public $view = 'all';
898
899
/**
900
* How many activity items have been marked as spam.
901
*
902
- * @since 1.6
903
*/
904
public $spam_count = 0;
905
906
/**
907
* Store activity-to-user-ID mappings for use in the In Response To column.
908
*
909
- * @since 1.6
910
*/
911
protected $activity_user_id = array();
912
913
/**
914
* Constructor
915
*
916
- * @since 1.6
917
*/
918
public function __construct() {
919
@@ -928,7 +946,7 @@ class BP_Activity_List_Table extends WP_List_Table {
928
/**
929
* Handle filtering of data, sorting, pagination, and any other data-manipulation required prior to rendering.
930
*
931
- * @since 1.6
932
*/
933
function prepare_items() {
934
$screen = get_current_screen();
@@ -1030,7 +1048,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1030
* Get an array of all the columns on the page
1031
*
1032
* @return array
1033
- * @since 1.6
1034
*/
1035
function get_column_info() {
1036
$this->_column_headers = array(
@@ -1045,7 +1063,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1045
/**
1046
* Displays a message on screen when no items are found (e.g. no search matches)
1047
*
1048
- * @since 1.6
1049
*/
1050
function no_items() {
1051
_e( 'No activities found.', 'buddypress' );
@@ -1054,13 +1072,12 @@ class BP_Activity_List_Table extends WP_List_Table {
1054
/**
1055
* Outputs the Activity data table
1056
*
1057
- * @since 1.6
1058
*/
1059
function display() {
1060
extract( $this->_args );
1061
1062
- $this->display_tablenav( 'top' );
1063
- ?>
1064
1065
<table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0">
1066
<thead>
@@ -1088,11 +1105,16 @@ class BP_Activity_List_Table extends WP_List_Table {
1088
* Generates content for a single row of the table
1089
*
1090
* @param object $item The current item
1091
- * @since 1.6
1092
*/
1093
function single_row( $item ) {
1094
static $row_class = '';
1095
- $row_class = ( $row_class == '' ? ' class="alternate"' : '' );
1096
1097
echo '<tr' . $row_class . ' id="activity-' . esc_attr( $item['id'] ) . '" data-parent_id="' . esc_attr( $item['id'] ) . '" data-root_id="' . esc_attr( $item['item_id'] ) . '">';
1098
echo $this->single_row_columns( $item );
@@ -1102,7 +1124,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1102
/**
1103
* Get the list of views available on this table (e.g. "all", "spam").
1104
*
1105
- * @since 1.6
1106
*/
1107
function get_views() {
1108
$redirect_to = remove_query_arg( array( 'activity_status', 'aid', 'deleted', 'error', 'spammed', 'unspammed', 'updated', ), $_SERVER['REQUEST_URI'] );
@@ -1120,7 +1142,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1120
* Get bulk actions
1121
*
1122
* @return array Key/value pairs for the bulk actions dropdown
1123
- * @since 1.6
1124
*/
1125
function get_bulk_actions() {
1126
$actions = array();
@@ -1136,7 +1158,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1136
*
1137
* @see WP_List_Table::single_row_columns()
1138
* @return array
1139
- * @since 1.6
1140
*/
1141
function get_columns() {
1142
return array(
@@ -1151,7 +1173,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1151
* Get the column names for sortable columns
1152
*
1153
* @return array
1154
- * @since 1.6
1155
* @todo For this to work, BP_Activity_Activity::get() needs updating to supporting ordering by specific fields
1156
*/
1157
function get_sortable_columns() {
@@ -1165,34 +1187,17 @@ class BP_Activity_List_Table extends WP_List_Table {
1165
/**
1166
* Markup for the "filter" part of the form (i.e. which activity type to display)
1167
*
1168
- * @global object $bp BuddyPress global settings
1169
* @param string $which 'top' or 'bottom'
1170
- * @since 1.6
1171
*/
1172
function extra_tablenav( $which ) {
1173
- global $bp;
1174
-
1175
if ( 'bottom' == $which )
1176
return;
1177
1178
- $actions = array();
1179
$selected = !empty( $_REQUEST['activity_type'] ) ? $_REQUEST['activity_type'] : '';
1180
1181
- // Walk through the registered actions, and build an array of actions/values.
1182
- foreach ( $bp->activity->actions as $action ) {
1183
- $action = array_values( (array) $action );
1184
-
1185
- for ( $i = 0, $i_count = count( $action ); $i < $i_count; $i++ )
1186
- $actions[ $action[$i]['key'] ] = $action[$i]['value'];
1187
- }
1188
-
1189
- // This was a mis-named activity type from before BP 1.6
1190
- unset( $actions['friends_register_activity_action'] );
1191
-
1192
- // This type has not been used since BP 1.0.3. It will be re-instated in a future version.
1193
- unset( $actions['updated_profile'] );
1194
-
1195
- // Sort array by the human-readable value
1196
natsort( $actions );
1197
?>
1198
@@ -1216,7 +1221,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1216
*
1217
* @param array $item A singular item (one full row)
1218
* @see WP_List_Table::single_row_columns()
1219
- * @since 1.6
1220
*/
1221
function column_cb( $item ) {
1222
printf( '<input type="checkbox" name="aid[]" value="%d" />', (int) $item['id'] );
@@ -1227,7 +1232,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1227
*
1228
* @param array $item A singular item (one full row)
1229
* @see WP_List_Table::single_row_columns()
1230
- * @since 1.6
1231
*/
1232
function column_author( $item ) {
1233
echo '<strong>' . get_avatar( $item['user_id'], '32' ) . ' ' . bp_core_get_userlink( $item['user_id'] ) . '</strong>';
@@ -1240,7 +1245,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1240
*
1241
* @param array $item A singular item (one full row)
1242
* @see WP_List_Table::single_row_columns()
1243
- * @since 1.6
1244
*/
1245
function column_comment( $item ) {
1246
// Determine what type of item (row) we're dealing with
@@ -1258,7 +1263,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1258
);
1259
1260
// Build actions URLs
1261
- $base_url = network_admin_url( 'admin.php?page=bp-activity&amp;aid=' . $item['id'] );
1262
$spam_nonce = esc_html( '_wpnonce=' . wp_create_nonce( 'spam-activity_' . $item['id'] ) );
1263
1264
$delete_url = $base_url . "&amp;action=delete&amp;$spam_nonce";
@@ -1298,10 +1303,11 @@ class BP_Activity_List_Table extends WP_List_Table {
1298
echo '</div>';
1299
1300
// Get activity content - if not set, use the action
1301
- if ( ! empty( $item['content'] ) )
1302
$content = apply_filters_ref_array( 'bp_get_activity_content_body', array( $item['content'] ) );
1303
- else
1304
$content = apply_filters_ref_array( 'bp_get_activity_action', array( $item['action'] ) );
1305
1306
echo $content . ' ' . $this->row_actions( $actions );
1307
}
@@ -1311,18 +1317,18 @@ class BP_Activity_List_Table extends WP_List_Table {
1311
*
1312
* @param array $item A singular item (one full row)
1313
* @see WP_List_Table::single_row_columns()
1314
- * @since 1.6
1315
*/
1316
function column_response( $item ) {
1317
// Is $item is a root activity?
1318
if ( empty( $item['item_id'] ) || ! in_array( $item['type'], apply_filters( 'bp_activity_admin_root_activity_types', array( 'activity_comment' ), $item ) ) ) {
1319
$comment_count = !empty( $item['children'] ) ? bp_activity_recurse_comment_count( (object) $item ) : 0;
1320
- $root_activity_url = network_admin_url( 'admin.php?page=bp-activity&amp;aid=' . $item['id'] );
1321
1322
// If the activity has comments, display a link to the activity's permalink, with its comment count in a speech bubble
1323
if ( $comment_count ) {
1324
$title_attr = sprintf( _n( '%s related activity', '%s related activities', $comment_count, 'buddypress' ), number_format_i18n( $comment_count ) );
1325
- printf( '<a href="%1$s" title="%2$s" class="post-com-count"><span class="comment-count">%3$s</span></a>', esc_attr( $root_activity_url ), esc_attr( $title_attr ), number_format_i18n( $comment_count ) );
1326
}
1327
1328
// For non-root activities, display a link to the replied-to activity's author's profile
@@ -1339,7 +1345,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1339
* A wrapper function for the BP_Activity_List_Table to get the specified activity's user ID.
1340
*
1341
* @param int $activity_id Activity ID to retrieve User ID for
1342
- * @since 1.6
1343
*/
1344
protected function get_activity_user_id( $activity_id ) {
1345
// If there is an existing activity/user ID mapping, just return the user ID.
@@ -1373,7 +1379,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1373
*
1374
* @param array $tree Source array
1375
* @return array Flattened array
1376
- * @since 1.6
1377
*/
1378
public static function flatten_activity_array( $tree ){
1379
foreach ( (array) $tree as $node ) {
@@ -1390,4 +1396,3 @@ class BP_Activity_List_Table extends WP_List_Table {
1390
return $tree;
1391
}
1392
}
1393
- ?>
6
* on which this implementation is heavily based.
7
*
8
* @package BuddyPress
9
+ * @since BuddyPress (1.6)
10
* @subpackage Activity
11
*/
12
23
/**
24
* Registers the Activity component admin screen
25
*
26
+ * @since BuddyPress (1.6)
27
*/
28
function bp_activity_add_admin_menu() {
29
31
return;
32
33
// Add our screen
34
+ $hook = add_menu_page(
35
+ __( 'Activity', 'buddypress' ),
36
+ __( 'Activity', 'buddypress' ),
37
+ 'manage_options',
38
+ 'bp-activity',
39
+ 'bp_activity_admin',
40
+ 'div'
41
+ );
42
43
// Hook into early actions to load custom CSS and our init handler.
44
add_action( "load-$hook", 'bp_activity_admin_load' );
45
}
46
add_action( bp_core_admin_hook(), 'bp_activity_add_admin_menu' );
47
48
+ /**
49
+ * Add activity component to custom menus array
50
+ *
51
+ * @since BuddyPress (1.7)
52
+ *
53
+ * @param array $custom_menus
54
+ * @return array
55
+ */
56
+ function bp_activity_admin_menu_order( $custom_menus = array() ) {
57
+ array_push( $custom_menus, 'bp-activity' );
58
+ return $custom_menus;
59
+ }
60
+ add_filter( 'bp_admin_menu_order', 'bp_activity_admin_menu_order' );
61
+
62
/**
63
* AJAX receiver for Activity replies via the admin screen. Adds a new activity
64
* comment, and returns HTML for a new table row.
65
*
66
+ * @since BuddyPress (1.6)
67
*/
68
function bp_activity_admin_reply() {
69
// Check nonce
137
* @param string $option Screen option name
138
* @param string $new_value Screen option form value
139
* @return string Option value. False to abandon update.
140
+ * @since BuddyPress (1.6)
141
*/
142
function bp_activity_admin_screen_options( $value, $option, $new_value ) {
143
if ( 'toplevel_page_bp_activity_per_page' != $option && 'toplevel_page_bp_activity_network_per_page' != $option )
156
*
157
* @param WP_Screen $screen Screen identifier
158
* @return array Hidden Meta Boxes
159
+ * @since BuddyPress (1.0)
160
*/
161
function bp_activity_admin_edit_hidden_metaboxes( $hidden, $screen ) {
162
if ( empty( $screen->id ) || 'toplevel_page_bp-activity' != $screen->id && 'toplevel_page_bp-activity_network' != $screen->id )
174
*
175
* @global object $bp BuddyPress global settings
176
* @global BP_Activity_List_Table $bp_activity_list_table Activity screen list table
177
+ * @since BuddyPress (1.6)
178
*/
179
function bp_activity_admin_load() {
180
global $bp, $bp_activity_list_table;
181
182
// Decide whether to load the dev version of the CSS and JavaScript
183
+ $min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : 'min.';
184
185
+ $doaction = bp_admin_list_table_current_bulk_action();
186
187
// Call an action for plugins to hook in early
188
do_action( 'bp_activity_admin_load', $doaction );
264
}
265
266
// Enqueue CSS and JavaScript
267
+ 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 );
268
+ wp_enqueue_style( 'bp_activity_admin_css', BP_PLUGIN_URL . "bp-activity/admin/css/admin.{$min}css", array(), bp_get_version() );
269
270
// Handle spam/un-spam/delete of activities
271
if ( !empty( $doaction ) && ! in_array( $doaction, array( '-1', 'edit', 'save', ) ) ) {
523
/**
524
* Outputs the Activity component admin screens
525
*
526
+ * @since BuddyPress (1.6)
527
*/
528
function bp_activity_admin() {
529
// Decide whether to load the index or edit screen
542
* Display the single activity edit screen
543
*
544
* @global int $screen_layout_columns Number of columns shown on this admin page
545
+ * @since BuddyPress (1.6)
546
*/
547
function bp_activity_admin_edit() {
548
549
// @todo: Check if user is allowed to edit activity items
550
// if ( ! current_user_can( 'bp_edit_activity' ) )
575
$form_url = add_query_arg( 'action', 'save', $form_url );
576
577
// Call an action for plugins to modify the activity before we display the edit form
578
+ do_action_ref_array( 'bp_activity_admin_edit', array( &$activity ) ); ?>
579
580
<div class="wrap">
581
<?php screen_icon( 'buddypress-activity' ); ?>
586
<form action="<?php echo esc_attr( $form_url ); ?>" id="bp-activities-edit-form" method="post">
587
<div id="poststuff">
588
589
+ <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
590
<div id="post-body-content">
591
<div id="postdiv" class="postarea">
592
<div id="bp_activity_action" class="postbox">
622
</form>
623
624
<?php else : ?>
625
+ <p><?php printf( __( 'No activity found with this ID. <a href="%s">Go back and try again</a>.', 'buddypress' ), esc_url( bp_get_admin_url( 'admin.php?page=bp-activity' ) ) ); ?></p>
626
<?php endif; ?>
627
628
</div><!-- .wrap -->
634
* Status metabox for the Activity admin edit screen
635
*
636
* @param object $item Activity item
637
+ * @since BuddyPress (1.6)
638
*/
639
function bp_activity_admin_edit_metabox_status( $item ) {
640
?>
689
* Primary link metabox for the Activity admin edit screen
690
*
691
* @param object $item Activity item
692
+ * @since BuddyPress (1.6)
693
*/
694
function bp_activity_admin_edit_metabox_link( $item ) {
695
?>
705
* User ID metabox for the Activity admin edit screen
706
*
707
* @param object $item Activity item
708
+ * @since BuddyPress (1.6)
709
*/
710
function bp_activity_admin_edit_metabox_userid( $item ) {
711
?>
721
*
722
* @global object $bp BuddyPress global settings
723
* @param object $item Activity item
724
+ * @since BuddyPress (1.6)
725
*/
726
function bp_activity_admin_edit_metabox_type( $item ) {
727
global $bp;
741
unset( $actions['friends_register_activity_action'] );
742
743
// Sort array by the human-readable value
744
+ natsort( $actions ); ?>
745
746
<select name="bp-activities-type">
747
<?php foreach ( $actions as $k => $v ) : ?>
756
* Primary item ID/Secondary item ID metabox for the Activity admin edit screen
757
*
758
* @param object $item Activity item
759
+ * @since BuddyPress (1.6)
760
*/
761
function bp_activity_admin_edit_metabox_itemids( $item ) {
762
?>
778
*
779
* @global BP_Activity_List_Table $bp_activity_list_table Activity screen list table
780
* @global string $plugin_page
781
+ * @since BuddyPress (1.6)
782
*/
783
function bp_activity_admin_index() {
784
global $bp_activity_list_table, $plugin_page;
797
798
// Make sure we don't get any empty values in $errors
799
for ( $i = 0, $errors_count = count( $errors ); $i < $errors_count; $i++ ) {
800
+ if ( 0 === $errors[$i] ) {
801
unset( $errors[$i] );
802
+ }
803
}
804
805
// Reindex array
806
$errors = array_values( $errors );
807
808
if ( $deleted > 0 )
809
+ $messages[] = sprintf( _n( '%s activity item has been permanently deleted.', '%s activity items have been permanently deleted.', $deleted, 'buddypress' ), number_format_i18n( $deleted ) );
810
811
if ( ! empty( $errors ) ) {
812
if ( 1 == count( $errors ) ) {
828
}
829
830
if ( $spammed > 0 )
831
+ $messages[] = sprintf( _n( '%s activity item has been successfully spammed.', '%s activity items have been successfully spammed.', $spammed, 'buddypress' ), number_format_i18n( $spammed ) );
832
833
if ( $unspammed > 0 )
834
+ $messages[] = sprintf( _n( '%s activity item has been successfully unspammed.', '%s activity items have been successfully unspammed.', $unspammed, 'buddypress' ), number_format_i18n( $unspammed ) );
835
836
if ( $updated > 0 )
837
+ $messages[] = __( 'The activity item has been updated succesfully.', 'buddypress' );
838
}
839
840
// Prepare the activity items for display
841
$bp_activity_list_table->prepare_items();
842
843
// Call an action for plugins to modify the activity before we display the edit form
844
+ do_action( 'bp_activity_admin_index', $messages ); ?>
845
846
<div class="wrap">
847
<?php screen_icon( 'buddypress-activity' ); ?>
884
<a href="#" class="cancel button-secondary alignleft"><?php _e( 'Cancel', 'buddypress' ); ?></a>
885
<a href="#" class="save button-primary alignright"><?php _e( 'Reply', 'buddypress' ); ?></a>
886
887
+ <img class="waiting" style="display:none;" src="<?php echo esc_url( bp_get_admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
888
<span class="error" style="display:none;"></span>
889
<br class="clear" />
890
</p>
903
/**
904
* List table class for the Activity component admin page.
905
*
906
+ * @since BuddyPress (1.6)
907
*/
908
class BP_Activity_List_Table extends WP_List_Table {
909
+
910
/**
911
* What type of view is being displayed? e.g. "All", "Pending", "Approved", "Spam"...
912
*
913
+ * @since BuddyPress (1.6)
914
*/
915
public $view = 'all';
916
917
/**
918
* How many activity items have been marked as spam.
919
*
920
+ * @since BuddyPress (1.6)
921
*/
922
public $spam_count = 0;
923
924
/**
925
* Store activity-to-user-ID mappings for use in the In Response To column.
926
*
927
+ * @since BuddyPress (1.6)
928
*/
929
protected $activity_user_id = array();
930
931
/**
932
* Constructor
933
*
934
+ * @since BuddyPress (1.6)
935
*/
936
public function __construct() {
937
946
/**
947
* Handle filtering of data, sorting, pagination, and any other data-manipulation required prior to rendering.
948
*
949
+ * @since BuddyPress (1.6)
950
*/
951
function prepare_items() {
952
$screen = get_current_screen();
1048
* Get an array of all the columns on the page
1049
*
1050
* @return array
1051
+ * @since BuddyPress (1.6)
1052
*/
1053
function get_column_info() {
1054
$this->_column_headers = array(
1063
/**
1064
* Displays a message on screen when no items are found (e.g. no search matches)
1065
*
1066
+ * @since BuddyPress (1.6)
1067
*/
1068
function no_items() {
1069
_e( 'No activities found.', 'buddypress' );
1072
/**
1073
* Outputs the Activity data table
1074
*
1075
+ * @since BuddyPress (1.6)
1076
*/
1077
function display() {
1078
extract( $this->_args );
1079
1080
+ $this->display_tablenav( 'top' ); ?>
1081
1082
<table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0">
1083
<thead>
1105
* Generates content for a single row of the table
1106
*
1107
* @param object $item The current item
1108
+ * @since BuddyPress (1.6)
1109
*/
1110
function single_row( $item ) {
1111
static $row_class = '';
1112
+
1113
+ if ( empty( $row_class ) ) {
1114
+ $row_class = ' class="alternate"';
1115
+ } else {
1116
+ $row_class = '';
1117
+ }
1118
1119
echo '<tr' . $row_class . ' id="activity-' . esc_attr( $item['id'] ) . '" data-parent_id="' . esc_attr( $item['id'] ) . '" data-root_id="' . esc_attr( $item['item_id'] ) . '">';
1120
echo $this->single_row_columns( $item );
1124
/**
1125
* Get the list of views available on this table (e.g. "all", "spam").
1126
*
1127
+ * @since BuddyPress (1.6)
1128
*/
1129
function get_views() {
1130
$redirect_to = remove_query_arg( array( 'activity_status', 'aid', 'deleted', 'error', 'spammed', 'unspammed', 'updated', ), $_SERVER['REQUEST_URI'] );
1142
* Get bulk actions
1143
*
1144
* @return array Key/value pairs for the bulk actions dropdown
1145
+ * @since BuddyPress (1.6)
1146
*/
1147
function get_bulk_actions() {
1148
$actions = array();
1158
*
1159
* @see WP_List_Table::single_row_columns()
1160
* @return array
1161
+ * @since BuddyPress (1.6)
1162
*/
1163
function get_columns() {
1164
return array(
1173
* Get the column names for sortable columns
1174
*
1175
* @return array
1176
+ * @since BuddyPress (1.6)
1177
* @todo For this to work, BP_Activity_Activity::get() needs updating to supporting ordering by specific fields
1178
*/
1179
function get_sortable_columns() {
1187
/**
1188
* Markup for the "filter" part of the form (i.e. which activity type to display)
1189
*
1190
* @param string $which 'top' or 'bottom'
1191
+ * @since BuddyPress (1.6)
1192
*/
1193
function extra_tablenav( $which ) {
1194
if ( 'bottom' == $which )
1195
return;
1196
1197
$selected = !empty( $_REQUEST['activity_type'] ) ? $_REQUEST['activity_type'] : '';
1198
1199
+ // Get all types of activities, and sort alphabetically.
1200
+ $actions = bp_activity_get_types();
1201
natsort( $actions );
1202
?>
1203
1221
*
1222
* @param array $item A singular item (one full row)
1223
* @see WP_List_Table::single_row_columns()
1224
+ * @since BuddyPress (1.6)
1225
*/
1226
function column_cb( $item ) {
1227
printf( '<input type="checkbox" name="aid[]" value="%d" />', (int) $item['id'] );
1232
*
1233
* @param array $item A singular item (one full row)
1234
* @see WP_List_Table::single_row_columns()
1235
+ * @since BuddyPress (1.6)
1236
*/
1237
function column_author( $item ) {
1238
echo '<strong>' . get_avatar( $item['user_id'], '32' ) . ' ' . bp_core_get_userlink( $item['user_id'] ) . '</strong>';
1245
*
1246
* @param array $item A singular item (one full row)
1247
* @see WP_List_Table::single_row_columns()
1248
+ * @since BuddyPress (1.6)
1249
*/
1250
function column_comment( $item ) {
1251
// Determine what type of item (row) we're dealing with
1263
);
1264
1265
// Build actions URLs
1266
+ $base_url = bp_get_admin_url( 'admin.php?page=bp-activity&amp;aid=' . $item['id'] );
1267
$spam_nonce = esc_html( '_wpnonce=' . wp_create_nonce( 'spam-activity_' . $item['id'] ) );
1268
1269
$delete_url = $base_url . "&amp;action=delete&amp;$spam_nonce";
1303
echo '</div>';
1304
1305
// Get activity content - if not set, use the action
1306
+ if ( ! empty( $item['content'] ) ) {
1307
$content = apply_filters_ref_array( 'bp_get_activity_content_body', array( $item['content'] ) );
1308
+ } else {
1309
$content = apply_filters_ref_array( 'bp_get_activity_action', array( $item['action'] ) );
1310
+ }
1311
1312
echo $content . ' ' . $this->row_actions( $actions );
1313
}
1317
*
1318
* @param array $item A singular item (one full row)
1319
* @see WP_List_Table::single_row_columns()
1320
+ * @since BuddyPress (1.6)
1321
*/
1322
function column_response( $item ) {
1323
// Is $item is a root activity?
1324
if ( empty( $item['item_id'] ) || ! in_array( $item['type'], apply_filters( 'bp_activity_admin_root_activity_types', array( 'activity_comment' ), $item ) ) ) {
1325
$comment_count = !empty( $item['children'] ) ? bp_activity_recurse_comment_count( (object) $item ) : 0;
1326
+ $root_activity_url = bp_get_admin_url( 'admin.php?page=bp-activity&amp;aid=' . $item['id'] );
1327
1328
// If the activity has comments, display a link to the activity's permalink, with its comment count in a speech bubble
1329
if ( $comment_count ) {
1330
$title_attr = sprintf( _n( '%s related activity', '%s related activities', $comment_count, 'buddypress' ), number_format_i18n( $comment_count ) );
1331
+ printf( '<a href="%1$s" title="%2$s" class="post-com-count"><span class="comment-count">%3$s</span></a>', esc_url( $root_activity_url ), esc_attr( $title_attr ), number_format_i18n( $comment_count ) );
1332
}
1333
1334
// For non-root activities, display a link to the replied-to activity's author's profile
1345
* A wrapper function for the BP_Activity_List_Table to get the specified activity's user ID.
1346
*
1347
* @param int $activity_id Activity ID to retrieve User ID for
1348
+ * @since BuddyPress (1.6)
1349
*/
1350
protected function get_activity_user_id( $activity_id ) {
1351
// If there is an existing activity/user ID mapping, just return the user ID.
1379
*
1380
* @param array $tree Source array
1381
* @return array Flattened array
1382
+ * @since BuddyPress (1.6)
1383
*/
1384
public static function flatten_activity_array( $tree ){
1385
foreach ( (array) $tree as $node ) {
1396
return $tree;
1397
}
1398
}
bp-activity/bp-activity-akismet.php CHANGED
@@ -3,7 +3,7 @@
3
* Akismet support for BuddyPress' Activity Stream
4
*
5
* @package BuddyPress
6
- * @since 1.6
7
* @subpackage Activity
8
*/
9
@@ -16,14 +16,14 @@ class BP_Akismet {
16
*
17
* @access protected
18
* @var BP_Activity_Activity
19
- * @since 1.6
20
*/
21
protected $last_activity = null;
22
23
/**
24
* Constructor
25
*
26
- * @since 1.6
27
*/
28
public function __construct() {
29
$this->setup_actions();
@@ -32,7 +32,7 @@ class BP_Akismet {
32
/**
33
* Hook Akismet into the activity stream
34
*
35
- * @since 1.6
36
*/
37
protected function setup_actions() {
38
// Add nonces to activity stream lists
@@ -67,7 +67,7 @@ class BP_Akismet {
67
* @param array $actions The hover links
68
* @param array $activity The activity for the current row being processed
69
* @return array The hover links
70
- * @since 1.6
71
*/
72
function comment_row_action( $actions, $activity ) {
73
$akismet_result = bp_activity_get_meta( $activity['id'], '_bp_akismet_result' );
@@ -97,14 +97,14 @@ class BP_Akismet {
97
foreach ( $actions as $k => $item ) {
98
$b[ $k ] = $item;
99
if ( $k == 'edit' )
100
- $b['history'] = '<a href="' . network_admin_url( 'admin.php?page=bp-activity&amp;action=edit&aid=' . $activity['id'] ) . '#bp_activity_history"> '. __( 'History', 'buddypress' ) . '</a>';
101
}
102
103
$actions = $b;
104
}
105
106
if ( $desc )
107
- echo '<span class="akismet-status"><a href="' . network_admin_url( 'admin.php?page=bp-activity&amp;action=edit&aid=' . $activity['id'] ) . '#bp_activity_history">' . htmlspecialchars( $desc ) . '</a></span>';
108
109
return apply_filters( 'bp_akismet_comment_row_action', $actions );
110
}
@@ -114,10 +114,10 @@ class BP_Akismet {
114
* This is used by Akismet to help detect spam activity.
115
*
116
* @see http://plugins.trac.wordpress.org/ticket/1232
117
- * @since 1.6
118
*/
119
public function add_activity_stream_nonce() {
120
- $form_id = '_bp_as_nonce';
121
$value = '_bp_as_nonce_' . bp_loggedin_user_id();
122
123
// If we're in the activity stream loop, we can use the current item's ID to make the nonce unique
@@ -138,7 +138,7 @@ class BP_Akismet {
138
* @param int $user_id User ID
139
* @param int $activity_id Activity ID
140
* @see bp_dtheme_post_update()
141
- * @since 1.6
142
*/
143
public function check_member_activity_update( $content, $user_id, $activity_id ) {
144
// By default, only handle activity updates and activity comments.
@@ -158,7 +158,7 @@ class BP_Akismet {
158
*
159
* This function is intended to be used inside the activity stream loop.
160
*
161
- * @since 1.6
162
*/
163
public function add_activity_spam_button() {
164
if ( !bp_activity_user_can_mark_spam() )
@@ -186,7 +186,7 @@ class BP_Akismet {
186
*
187
* This function is intended to be used inside the activity stream loop.
188
*
189
- * @since 1.6
190
*/
191
public function add_activity_comment_spam_button() {
192
if ( !bp_activity_user_can_mark_spam() )
@@ -214,7 +214,7 @@ class BP_Akismet {
214
* Get a list of filterable types of activity item that we want Akismet to automatically check for spam.
215
*
216
* @return array List of activity types
217
- * @since 1.6
218
* @static
219
*/
220
public static function get_activity_types() {
@@ -226,7 +226,7 @@ class BP_Akismet {
226
*
227
* @param BP_Activity_Activity $activity
228
* @param string $source Either "by_a_person" (e.g. a person has manually marked the activity as spam) or "by_akismet" (automatically spammed).
229
- * @since 1.6
230
*/
231
public function mark_as_spam( $activity, $source ) {
232
// Record this item so we can do some tidyup in BP_Akismet::check_member_activity_update()
@@ -240,7 +240,7 @@ class BP_Akismet {
240
*
241
* @param BP_Activity_Activity $activity
242
* @param string $source Either "by_a_person" (e.g. a person has manually marked the activity as ham) or "by_akismet" (automatically hammed).
243
- * @since 1.6
244
*/
245
public function mark_as_ham( $activity, $source ) {
246
// If the activity was, originally, automatically marked as spam by Akismet, run the @mentions filter as it would have been skipped.
@@ -248,14 +248,14 @@ class BP_Akismet {
248
$activity->content = bp_activity_at_name_filter( $activity->content, $activity->id );
249
250
do_action( 'bp_activity_akismet_mark_as_ham', $activity, $source );
251
- }
252
253
/**
254
* Build a data package for the Akismet service to inspect
255
*
256
* @param BP_Activity_Activity $activity
257
* @see http://akismet.com/development/api/#comment-check
258
- * @since 1.6
259
* @static
260
*/
261
public static function build_akismet_data_package( $activity ) {
@@ -294,7 +294,7 @@ class BP_Akismet {
294
*
295
* @param BP_Activity_Activity $activity The activity item to check
296
* @see http://akismet.com/development/api/
297
- * @since 1.6
298
* @todo Spam counter?
299
* @todo Auto-delete old spam?
300
*/
@@ -335,7 +335,7 @@ class BP_Akismet {
335
* Update activity meta after a manual spam change (user initiated)
336
*
337
* @param BP_Activity_Activity $activity The activity to check
338
- * @since 1.6
339
*/
340
public function update_activity_spam_meta( $activity ) {
341
// By default, only handle activity updates and activity comments.
@@ -351,7 +351,7 @@ class BP_Akismet {
351
* Update activity meta after a manual ham change (user initiated)
352
*
353
* @param BP_Activity_Activity $activity The activity to check
354
- * @since 1.6
355
*/
356
public function update_activity_ham_meta( $activity ) {
357
// By default, only handle activity updates and activity comments.
@@ -367,7 +367,7 @@ class BP_Akismet {
367
* Update activity meta after an automatic spam check (not user initiated)
368
*
369
* @param BP_Activity_Activity $activity The activity to check
370
- * @since 1.6
371
*/
372
public function update_activity_akismet_meta( $activity ) {
373
// Check we're dealing with what was last updated by Akismet
@@ -408,7 +408,7 @@ class BP_Akismet {
408
* @param array $activity_data Packet of information to submit to Akismet
409
* @param string $check "check" or "submit"
410
* @param string $spam "spam" or "ham"
411
- * @since 1.6
412
*/
413
public function send_akismet_request( $activity_data, $check = 'check', $spam = 'spam' ) {
414
global $akismet_api_host, $akismet_api_port;
@@ -480,7 +480,7 @@ class BP_Akismet {
480
* Filters user agent when sending to Akismet.
481
*
482
* @param string $user_agent
483
- * @since 1.6
484
*/
485
public function buddypress_ua( $user_agent ) {
486
$user_agent = 'BuddyPress/' . bp_get_version() . ' | Akismet/'. constant( 'AKISMET_VERSION' );
@@ -491,7 +491,7 @@ class BP_Akismet {
491
* Adds a "History" meta box to the activity edit screen.
492
*
493
* @param string $screen_action The type of screen that has been requested
494
- * @since 1.6
495
*/
496
function add_history_metabox( $screen_action ) {
497
// Only proceed if we're on the edit screen
@@ -506,7 +506,7 @@ class BP_Akismet {
506
* History meta box for the Activity admin edit screen
507
*
508
* @param object $item Activity item
509
- * @since 1.6
510
* @todo Update activity meta to allow >1 record with the same key (iterate through $history).
511
* @see http://buddypress.trac.wordpress.org/ticket/3907
512
*/
@@ -527,7 +527,7 @@ class BP_Akismet {
527
* @param int $activity_id Activity item ID
528
* @param string $message Human-readable description of what's changed
529
* @param string $event The type of check we were carrying out
530
- * @since 1.6
531
*/
532
public function update_activity_history( $activity_id = 0, $message = '', $event = '' ) {
533
$event = array(
@@ -546,7 +546,7 @@ class BP_Akismet {
546
*
547
* @param int $activity_id Activity item ID
548
* @return array The activity item's Akismet history
549
- * @since 1.6
550
*/
551
public function get_activity_history( $activity_id = 0 ) {
552
$history = bp_activity_get_meta( $activity_id, '_bp_akismet_history' );
@@ -565,7 +565,7 @@ class BP_Akismet {
565
*
566
* @global object $bp BuddyPress global settings
567
* @global wpdb $wpdb WordPress database object
568
- * @since 1.6
569
*/
570
function bp_activity_akismet_delete_old_metadata() {
571
global $bp, $wpdb;
@@ -575,7 +575,7 @@ function bp_activity_akismet_delete_old_metadata() {
575
// Enforce a minimum of 1 day
576
$interval = max( 1, absint( $interval ) );
577
578
- // _bp_akismet_submission meta values are large, so expire them after $interval days regardless of the activity status
579
$sql = $wpdb->prepare( "SELECT a.id FROM {$bp->activity->table_name} a LEFT JOIN {$bp->activity->table_name_meta} m ON a.id = m.activity_id WHERE m.meta_key = %s AND DATE_SUB(%s, INTERVAL {$interval} DAY) > a.date_recorded LIMIT 10000", '_bp_akismet_submission', current_time( 'mysql', 1 ) );
580
$activity_ids = $wpdb->get_col( $sql );
581
@@ -584,4 +584,4 @@ function bp_activity_akismet_delete_old_metadata() {
584
bp_activity_delete_meta( $activity_id, '_bp_akismet_submission' );
585
}
586
}
587
- ?>
3
* Akismet support for BuddyPress' Activity Stream
4
*
5
* @package BuddyPress
6
+ * @since BuddyPress (1.6)
7
* @subpackage Activity
8
*/
9
16
*
17
* @access protected
18
* @var BP_Activity_Activity
19
+ * @since BuddyPress (1.6)
20
*/
21
protected $last_activity = null;
22
23
/**
24
* Constructor
25
*
26
+ * @since BuddyPress (1.6)
27
*/
28
public function __construct() {
29
$this->setup_actions();
32
/**
33
* Hook Akismet into the activity stream
34
*
35
+ * @since BuddyPress (1.6)
36
*/
37
protected function setup_actions() {
38
// Add nonces to activity stream lists
67
* @param array $actions The hover links
68
* @param array $activity The activity for the current row being processed
69
* @return array The hover links
70
+ * @since BuddyPress (1.6)
71
*/
72
function comment_row_action( $actions, $activity ) {
73
$akismet_result = bp_activity_get_meta( $activity['id'], '_bp_akismet_result' );
97
foreach ( $actions as $k => $item ) {
98
$b[ $k ] = $item;
99
if ( $k == 'edit' )
100
+ $b['history'] = '<a href="' . esc_url( bp_get_admin_url( 'admin.php?page=bp-activity&amp;action=edit&aid=' . $activity['id'] ) ) . '#bp_activity_history"> '. __( 'History', 'buddypress' ) . '</a>';
101
}
102
103
$actions = $b;
104
}
105
106
if ( $desc )
107
+ echo '<span class="akismet-status"><a href="' . esc_url( bp_get_admin_url( 'admin.php?page=bp-activity&amp;action=edit&aid=' . $activity['id'] ) ) . '#bp_activity_history">' . htmlspecialchars( $desc ) . '</a></span>';
108
109
return apply_filters( 'bp_akismet_comment_row_action', $actions );
110
}
114
* This is used by Akismet to help detect spam activity.
115
*
116
* @see http://plugins.trac.wordpress.org/ticket/1232
117
+ * @since BuddyPress (1.6)
118
*/
119
public function add_activity_stream_nonce() {
120
+ $form_id = '_bp_as_nonce';
121
$value = '_bp_as_nonce_' . bp_loggedin_user_id();
122
123
// If we're in the activity stream loop, we can use the current item's ID to make the nonce unique
138
* @param int $user_id User ID
139
* @param int $activity_id Activity ID
140
* @see bp_dtheme_post_update()
141
+ * @since BuddyPress (1.6)
142
*/
143
public function check_member_activity_update( $content, $user_id, $activity_id ) {
144
// By default, only handle activity updates and activity comments.
158
*
159
* This function is intended to be used inside the activity stream loop.
160
*
161
+ * @since BuddyPress (1.6)
162
*/
163
public function add_activity_spam_button() {
164
if ( !bp_activity_user_can_mark_spam() )
186
*
187
* This function is intended to be used inside the activity stream loop.
188
*
189
+ * @since BuddyPress (1.6)
190
*/
191
public function add_activity_comment_spam_button() {
192
if ( !bp_activity_user_can_mark_spam() )
214
* Get a list of filterable types of activity item that we want Akismet to automatically check for spam.
215
*
216
* @return array List of activity types
217
+ * @since BuddyPress (1.6)
218
* @static
219
*/
220
public static function get_activity_types() {
226
*
227
* @param BP_Activity_Activity $activity
228
* @param string $source Either "by_a_person" (e.g. a person has manually marked the activity as spam) or "by_akismet" (automatically spammed).
229
+ * @since BuddyPress (1.6)
230
*/
231
public function mark_as_spam( $activity, $source ) {
232
// Record this item so we can do some tidyup in BP_Akismet::check_member_activity_update()
240
*
241
* @param BP_Activity_Activity $activity
242
* @param string $source Either "by_a_person" (e.g. a person has manually marked the activity as ham) or "by_akismet" (automatically hammed).
243
+ * @since BuddyPress (1.6)
244
*/
245
public function mark_as_ham( $activity, $source ) {
246
// If the activity was, originally, automatically marked as spam by Akismet, run the @mentions filter as it would have been skipped.
248
$activity->content = bp_activity_at_name_filter( $activity->content, $activity->id );
249
250
do_action( 'bp_activity_akismet_mark_as_ham', $activity, $source );
251
+ }
252
253
/**
254
* Build a data package for the Akismet service to inspect
255
*
256
* @param BP_Activity_Activity $activity
257
* @see http://akismet.com/development/api/#comment-check
258
+ * @since BuddyPress (1.6)
259
* @static
260
*/
261
public static function build_akismet_data_package( $activity ) {
294
*
295
* @param BP_Activity_Activity $activity The activity item to check
296
* @see http://akismet.com/development/api/
297
+ * @since BuddyPress (1.6)
298
* @todo Spam counter?
299
* @todo Auto-delete old spam?
300
*/
335
* Update activity meta after a manual spam change (user initiated)
336
*
337
* @param BP_Activity_Activity $activity The activity to check
338
+ * @since BuddyPress (1.6)
339
*/
340
public function update_activity_spam_meta( $activity ) {
341
// By default, only handle activity updates and activity comments.
351
* Update activity meta after a manual ham change (user initiated)
352
*
353
* @param BP_Activity_Activity $activity The activity to check
354
+ * @since BuddyPress (1.6)
355
*/
356
public function update_activity_ham_meta( $activity ) {
357
// By default, only handle activity updates and activity comments.
367
* Update activity meta after an automatic spam check (not user initiated)
368
*
369
* @param BP_Activity_Activity $activity The activity to check
370
+ * @since BuddyPress (1.6)
371
*/
372
public function update_activity_akismet_meta( $activity ) {
373
// Check we're dealing with what was last updated by Akismet
408
* @param array $activity_data Packet of information to submit to Akismet
409
* @param string $check "check" or "submit"
410
* @param string $spam "spam" or "ham"
411
+ * @since BuddyPress (1.6)
412
*/
413
public function send_akismet_request( $activity_data, $check = 'check', $spam = 'spam' ) {
414
global $akismet_api_host, $akismet_api_port;
480
* Filters user agent when sending to Akismet.
481
*
482
* @param string $user_agent
483
+ * @since BuddyPress (1.6)
484
*/
485
public function buddypress_ua( $user_agent ) {
486
$user_agent = 'BuddyPress/' . bp_get_version() . ' | Akismet/'. constant( 'AKISMET_VERSION' );
491
* Adds a "History" meta box to the activity edit screen.
492
*
493
* @param string $screen_action The type of screen that has been requested
494
+ * @since BuddyPress (1.6)
495
*/
496
function add_history_metabox( $screen_action ) {
497
// Only proceed if we're on the edit screen
506
* History meta box for the Activity admin edit screen
507
*
508
* @param object $item Activity item
509
+ * @since BuddyPress (1.6)
510
* @todo Update activity meta to allow >1 record with the same key (iterate through $history).
511
* @see http://buddypress.trac.wordpress.org/ticket/3907
512
*/
527
* @param int $activity_id Activity item ID
528
* @param string $message Human-readable description of what's changed
529
* @param string $event The type of check we were carrying out
530
+ * @since BuddyPress (1.6)
531
*/
532
public function update_activity_history( $activity_id = 0, $message = '', $event = '' ) {
533
$event = array(
546
*
547
* @param int $activity_id Activity item ID
548
* @return array The activity item's Akismet history
549
+ * @since BuddyPress (1.6)
550
*/
551
public function get_activity_history( $activity_id = 0 ) {
552
$history = bp_activity_get_meta( $activity_id, '_bp_akismet_history' );
565
*
566
* @global object $bp BuddyPress global settings
567
* @global wpdb $wpdb WordPress database object
568
+ * @since BuddyPress (1.6)
569
*/
570
function bp_activity_akismet_delete_old_metadata() {
571
global $bp, $wpdb;
575
// Enforce a minimum of 1 day
576
$interval = max( 1, absint( $interval ) );
577
578
+ // _bp_akismet_submission meta values are large, so expire them after $interval days regardless of the activity status
579
$sql = $wpdb->prepare( "SELECT a.id FROM {$bp->activity->table_name} a LEFT JOIN {$bp->activity->table_name_meta} m ON a.id = m.activity_id WHERE m.meta_key = %s AND DATE_SUB(%s, INTERVAL {$interval} DAY) > a.date_recorded LIMIT 10000", '_bp_akismet_submission', current_time( 'mysql', 1 ) );
580
$activity_ids = $wpdb->get_col( $sql );
581
584
bp_activity_delete_meta( $activity_id, '_bp_akismet_submission' );
585
}
586
}
587
+ add_action( 'bp_activity_akismet_delete_old_metadata', 'bp_activity_akismet_delete_old_metadata' );
bp-activity/bp-activity-cache.php CHANGED
@@ -3,7 +3,7 @@
3
/**
4
* Functions related to the BuddyPress Activity component and the WP Cache
5
*
6
- * @since 1.6
7
*/
8
9
// Exit if accessed directly
@@ -35,5 +35,3 @@ function bp_activity_update_meta_cache( $activity_ids = false ) {
35
36
bp_update_meta_cache( $cache_args );
37
}
38
-
39
- ?>
3
/**
4
* Functions related to the BuddyPress Activity component and the WP Cache
5
*
6
+ * @since BuddyPress (1.6)
7
*/
8
9
// Exit if accessed directly
35
36
bp_update_meta_cache( $cache_args );
37
}
bp-activity/bp-activity-classes.php CHANGED
@@ -50,13 +50,13 @@ class BP_Activity_Activity {
50
$this->mptt_left = $row->mptt_left;
51
$this->mptt_right = $row->mptt_right;
52
$this->is_spam = $row->is_spam;
53
-
54
bp_activity_update_meta_cache( $this->id );
55
}
56
}
57
58
function save() {
59
- global $wpdb, $bp;
60
61
$this->id = apply_filters_ref_array( 'bp_activity_id_before_save', array( $this->id, &$this ) );
62
$this->item_id = apply_filters_ref_array( 'bp_activity_item_id_before_save', array( $this->item_id, &$this ) );
@@ -83,23 +83,21 @@ class BP_Activity_Activity {
83
$this->primary_link = bp_loggedin_user_domain();
84
85
// If we have an existing ID, update the activity item, otherwise insert it.
86
- if ( $this->id ) {
87
$q = $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET user_id = %d, component = %s, type = %s, action = %s, content = %s, primary_link = %s, date_recorded = %s, item_id = %d, secondary_item_id = %d, hide_sitewide = %d, is_spam = %d WHERE id = %d", $this->user_id, $this->component, $this->type, $this->action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide, $this->is_spam, $this->id );
88
- } else {
89
$q = $wpdb->prepare( "INSERT INTO {$bp->activity->table_name} ( user_id, component, type, action, content, primary_link, date_recorded, item_id, secondary_item_id, hide_sitewide, is_spam ) VALUES ( %d, %s, %s, %s, %s, %s, %s, %d, %d, %d, %d )", $this->user_id, $this->component, $this->type, $this->action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide, $this->is_spam );
90
- }
91
92
if ( false === $wpdb->query( $q ) )
93
return false;
94
95
// If this is a new activity item, set the $id property
96
- if ( empty( $this->id ) ) {
97
$this->id = $wpdb->insert_id;
98
99
// If an existing activity item, prevent any changes to the content generating new @mention notifications.
100
- } else {
101
add_filter( 'bp_activity_at_name_do_notifications', '__return_false' );
102
- }
103
104
do_action_ref_array( 'bp_activity_after_save', array( &$this ) );
105
@@ -209,7 +207,7 @@ class BP_Activity_Activity {
209
210
// Define the preferred order for indexes
211
$indexes = apply_filters( 'bp_activity_preferred_index_order', array( 'user_id', 'item_id', 'secondary_item_id', 'date_recorded', 'component', 'type', 'hide_sitewide', 'is_spam' ) );
212
-
213
foreach( $indexes as $key => $index ) {
214
if ( false !== strpos( $where_sql, $index ) ) {
215
$the_index = $index;
@@ -263,13 +261,13 @@ class BP_Activity_Activity {
263
}
264
}
265
}
266
-
267
// Get activity meta
268
$activity_ids = array();
269
foreach ( (array) $activities as $activity ) {
270
$activity_ids[] = $activity->id;
271
}
272
-
273
if ( !empty( $activity_ids ) ) {
274
bp_activity_update_meta_cache( $activity_ids );
275
}
@@ -299,7 +297,7 @@ class BP_Activity_Activity {
299
* @param string MySQL column sort; ASC or DESC. (Optional; default is DESC)
300
* @param bool $display_comments Retrieve an activity item's associated comments or not. (Optional; default is false)
301
* @return array
302
- * @since 1.2
303
*/
304
function get_specific( $activity_ids, $max = false, $page = 1, $per_page = 25, $sort = 'DESC', $display_comments = false ) {
305
_deprecated_function( __FUNCTION__, '1.5', 'Use BP_Activity_Activity::get() with the "in" parameter instead.' );
@@ -447,20 +445,20 @@ class BP_Activity_Activity {
447
* @param array $activities
448
* @param bool $spam Optional; 'ham_only' (default), 'spam_only' or 'all'.
449
* @return array The updated activities with nested comments
450
- * @since 1.2
451
*/
452
function append_comments( $activities, $spam = 'ham_only' ) {
453
global $wpdb;
454
455
$activity_comments = array();
456
457
- /* Now fetch the activity comments and parse them into the correct position in the activities array. */
458
foreach( (array) $activities as $activity ) {
459
- if ( 'activity_comment' != $activity->type && $activity->mptt_left && $activity->mptt_right )
460
- $activity_comments[$activity->id] = BP_Activity_Activity::get_activity_comments( $activity->id, $activity->mptt_left, $activity->mptt_right, $spam );
461
}
462
463
- /* Merge the comments with the activity items */
464
foreach( (array) $activities as $key => $activity )
465
if ( isset( $activity_comments[$activity->id] ) )
466
$activities[$key]->children = $activity_comments[$activity->id];
@@ -477,13 +475,19 @@ class BP_Activity_Activity {
477
* @param int $left Left-most node boundary
478
* @param into $right Right-most node boundary
479
* @param bool $spam Optional; 'ham_only' (default), 'spam_only' or 'all'.
480
* @return array The updated activities with nested comments
481
- * @since 1.2
482
*/
483
- function get_activity_comments( $activity_id, $left, $right, $spam = 'ham_only' ) {
484
global $wpdb, $bp;
485
486
if ( !$comments = wp_cache_get( 'bp_activity_comments_' . $activity_id ) ) {
487
// Select the user's fullname with the query
488
if ( bp_is_active( 'xprofile' ) ) {
489
$fullname_select = ", pd.value as user_fullname";
@@ -496,17 +500,20 @@ class BP_Activity_Activity {
496
}
497
498
// Don't retrieve activity comments marked as spam
499
- if ( 'ham_only' == $spam )
500
$spam_sql = 'AND a.is_spam = 0';
501
- elseif ( 'spam_only' == $spam )
502
$spam_sql = 'AND a.is_spam = 1';
503
- else
504
$spam_sql = '';
505
506
- $sql = apply_filters( 'bp_activity_comments_user_join_filter', $wpdb->prepare( "SELECT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name{$fullname_select} FROM {$bp->activity->table_name} a, {$wpdb->users} u{$fullname_from} WHERE u.ID = a.user_id {$fullname_where} AND a.type = 'activity_comment' ${spam_sql} AND a.item_id = %d AND a.mptt_left BETWEEN %d AND %d ORDER BY a.date_recorded ASC", $activity_id, $left, $right ), $activity_id, $left, $right, $spam_sql );
507
508
// Retrieve all descendants of the $root node
509
$descendants = $wpdb->get_results( $sql );
510
511
// Loop descendants and build an assoc array
512
foreach ( (array) $descendants as $d ) {
@@ -562,7 +569,7 @@ class BP_Activity_Activity {
562
function get_recorded_components() {
563
global $wpdb, $bp;
564
565
- return $wpdb->get_col( "SELECT DISTINCT component FROM {$bp->activity->table_name} ORDER BY component ASC" );
566
}
567
568
function get_sitewide_items_for_feed( $limit = 35 ) {
@@ -671,5 +678,3 @@ class BP_Activity_Activity {
671
return $wpdb->get_var( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET hide_sitewide = 1 WHERE user_id = %d", $user_id ) );
672
}
673
}
674
-
675
- ?>
50
$this->mptt_left = $row->mptt_left;
51
$this->mptt_right = $row->mptt_right;
52
$this->is_spam = $row->is_spam;
53
+
54
bp_activity_update_meta_cache( $this->id );
55
}
56
}
57
58
function save() {
59
+ global $wpdb, $bp, $current_user;
60
61
$this->id = apply_filters_ref_array( 'bp_activity_id_before_save', array( $this->id, &$this ) );
62
$this->item_id = apply_filters_ref_array( 'bp_activity_item_id_before_save', array( $this->item_id, &$this ) );
83
$this->primary_link = bp_loggedin_user_domain();
84
85
// If we have an existing ID, update the activity item, otherwise insert it.
86
+ if ( $this->id )
87
$q = $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET user_id = %d, component = %s, type = %s, action = %s, content = %s, primary_link = %s, date_recorded = %s, item_id = %d, secondary_item_id = %d, hide_sitewide = %d, is_spam = %d WHERE id = %d", $this->user_id, $this->component, $this->type, $this->action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide, $this->is_spam, $this->id );
88
+ else
89
$q = $wpdb->prepare( "INSERT INTO {$bp->activity->table_name} ( user_id, component, type, action, content, primary_link, date_recorded, item_id, secondary_item_id, hide_sitewide, is_spam ) VALUES ( %d, %s, %s, %s, %s, %s, %s, %d, %d, %d, %d )", $this->user_id, $this->component, $this->type, $this->action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide, $this->is_spam );
90
91
if ( false === $wpdb->query( $q ) )
92
return false;
93
94
// If this is a new activity item, set the $id property
95
+ if ( empty( $this->id ) )
96
$this->id = $wpdb->insert_id;
97
98
// If an existing activity item, prevent any changes to the content generating new @mention notifications.
99
+ else
100
add_filter( 'bp_activity_at_name_do_notifications', '__return_false' );
101
102
do_action_ref_array( 'bp_activity_after_save', array( &$this ) );
103
207
208
// Define the preferred order for indexes
209
$indexes = apply_filters( 'bp_activity_preferred_index_order', array( 'user_id', 'item_id', 'secondary_item_id', 'date_recorded', 'component', 'type', 'hide_sitewide', 'is_spam' ) );
210
+
211
foreach( $indexes as $key => $index ) {
212
if ( false !== strpos( $where_sql, $index ) ) {
213
$the_index = $index;
261
}
262
}
263
}
264
+
265
// Get activity meta
266
$activity_ids = array();
267
foreach ( (array) $activities as $activity ) {
268
$activity_ids[] = $activity->id;
269
}
270
+
271
if ( !empty( $activity_ids ) ) {
272
bp_activity_update_meta_cache( $activity_ids );
273
}
297
* @param string MySQL column sort; ASC or DESC. (Optional; default is DESC)
298
* @param bool $display_comments Retrieve an activity item's associated comments or not. (Optional; default is fals