BuddyPress - Version 1.5

Version Description

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

Download this release

Release Info

Developer johnjamesjacoby
Plugin Icon 128x128 BuddyPress
Version 1.5
Comparing to
See all releases

Code changes from version 1.2.10 to 1.5

Files changed (382) hide show
  1. bp-activity.php +0 -1216
  2. bp-activity/bp-activity-actions.php +530 -0
  3. bp-activity/bp-activity-classes.php +190 -190
  4. bp-activity/bp-activity-filters.php +158 -34
  5. bp-activity/bp-activity-functions.php +1437 -0
  6. bp-activity/bp-activity-loader.php +315 -0
  7. bp-activity/bp-activity-notifications.php +129 -49
  8. bp-activity/bp-activity-screens.php +308 -0
  9. bp-activity/bp-activity-template.php +2696 -0
  10. bp-activity/bp-activity-templatetags.php +0 -1074
  11. bp-activity/feeds/bp-activity-favorites-feed.php +17 -6
  12. bp-activity/feeds/bp-activity-friends-feed.php +17 -12
  13. bp-activity/feeds/bp-activity-group-feed.php +9 -3
  14. bp-activity/feeds/bp-activity-mentions-feed.php +9 -3
  15. bp-activity/feeds/bp-activity-mygroups-feed.php +9 -3
  16. bp-activity/feeds/bp-activity-personal-feed.php +9 -3
  17. bp-activity/feeds/bp-activity-sitewide-feed.php +8 -3
  18. bp-blogs.php +0 -821
  19. bp-blogs/bp-blogs-actions.php +16 -0
  20. bp-blogs/bp-blogs-activity.php +94 -0
  21. bp-blogs/bp-blogs-buddybar.php +63 -0
  22. bp-blogs/bp-blogs-cache.php +37 -0
  23. bp-blogs/bp-blogs-classes.php +28 -59
  24. bp-blogs/bp-blogs-functions.php +566 -0
  25. bp-blogs/bp-blogs-loader.php +196 -0
  26. bp-blogs/bp-blogs-screens.php +38 -0
  27. bp-blogs/{bp-blogs-templatetags.php → bp-blogs-template.php} +171 -76
  28. bp-blogs/bp-blogs-widgets.php +13 -5
  29. bp-core.php +0 -2224
  30. bp-core/admin/bp-core-admin.php +637 -0
  31. bp-core/admin/bp-core-schema.php +300 -0
  32. bp-core/admin/bp-core-update.php +1328 -0
  33. bp-core/bp-core-admin.php +0 -251
  34. bp-core/bp-core-adminbar.php +196 -259
  35. bp-core/bp-core-avatars.php +403 -125
  36. bp-core/bp-core-buddybar.php +627 -0
  37. bp-core/bp-core-cache.php +51 -0
  38. bp-core/bp-core-catchuri.php +316 -152
  39. bp-core/bp-core-classes.php +732 -130
  40. bp-core/bp-core-component.php +358 -0
  41. bp-core/bp-core-cssjs.php +42 -42
  42. bp-core/bp-core-filters.php +134 -62
  43. bp-core/bp-core-functions.php +1454 -0
  44. bp-core/bp-core-hooks.php +114 -0
  45. bp-core/bp-core-loader.php +234 -0
  46. bp-core/bp-core-notifications.php +0 -95
  47. bp-core/bp-core-settings.php +0 -197
  48. bp-core/bp-core-template.php +1661 -0
  49. bp-core/bp-core-templatetags.php +0 -2107
  50. bp-core/bp-core-widgets.php +103 -24
  51. bp-core/bp-core-wpabstraction.php +117 -83
  52. bp-core/css/admin-bar-rtl.css +1 -0
  53. bp-core/css/admin-bar-rtl.dev.css +27 -0
  54. bp-core/css/admin-bar.css +1 -0
  55. bp-core/css/admin-bar.dev.css +58 -0
  56. bp-core/css/admin.css +1 -0
  57. bp-core/css/admin.dev.css +160 -0
  58. bp-core/css/buddybar-rtl.css +1 -0
  59. bp-core/css/buddybar-rtl.dev.css +77 -0
  60. bp-core/css/buddybar.css +1 -0
  61. bp-themes/bp-default/_inc/css/adminbar.css → bp-core/css/buddybar.dev.css +73 -88
  62. bp-core/css/widget-members.css +0 -22
  63. bp-core/deprecated/1.5.php +521 -0
  64. bp-core/images/60pc_black.png +0 -0
  65. bp-core/images/admin-bar-sprite-rtl.png +0 -0
  66. bp-core/images/admin-bar-sprite.png +0 -0
  67. bp-core/images/admin-menu-arrow.gif +0 -0
  68. bp-core/images/completed.gif +0 -0
  69. bp-core/images/find.png +0 -0
  70. bp-core/images/icons32.png +0 -0
  71. bp-core/images/installed.gif +0 -0
  72. bp-core/images/logo-column-header.png +0 -0
  73. bp-core/images/logo.png +0 -0
  74. bp-core/js/admin-bar.js +0 -0
  75. bp-core/js/update.dev.js +11 -0
  76. bp-core/js/update.js +1 -0
  77. bp-core/js/widget-members.dev.js +49 -0
  78. bp-core/js/widget-members.js +1 -48
  79. bp-forums.php +0 -556
  80. bp-forums/bbpress/bb-admin/admin-ajax.php +25 -4
  81. bp-forums/bbpress/bb-admin/admin-header.php +6 -0
  82. bp-forums/bbpress/bb-admin/delete-post.php +4 -1
  83. bp-forums/bbpress/bb-admin/export.php +1 -2
  84. bp-forums/bbpress/bb-admin/images/favicon.ico +0 -0
  85. bp-forums/bbpress/bb-admin/includes/class.bb-install.php +3 -3
  86. bp-forums/bbpress/bb-admin/includes/defaults.bb-schema.php +1 -1
  87. bp-forums/bbpress/bb-admin/includes/functions.bb-admin.php +296 -16
  88. bp-forums/bbpress/bb-admin/includes/functions.bb-plugin.php +2 -2
  89. bp-forums/bbpress/bb-admin/includes/functions.bb-recount.php +268 -69
  90. bp-forums/bbpress/bb-admin/includes/functions.bb-upgrade.php +17 -0
  91. bp-forums/bbpress/bb-admin/index.php +73 -51
  92. bp-forums/bbpress/bb-admin/install.php +2 -2
  93. bp-forums/bbpress/bb-admin/js/common.js +8 -2
  94. bp-forums/bbpress/bb-admin/options-discussion.php +32 -7
  95. bp-forums/bbpress/bb-admin/options-permalinks.php +3 -3
  96. bp-forums/bbpress/bb-admin/options-reading.php +16 -8
  97. bp-forums/bbpress/bb-admin/options-wordpress.php +2 -0
  98. bp-forums/bbpress/bb-admin/options-writing.php +14 -8
  99. bp-forums/bbpress/bb-admin/posts.php +83 -7
  100. bp-forums/bbpress/bb-admin/style-rtl.css +12 -3
  101. bp-forums/bbpress/bb-admin/style.css +84 -6
  102. bp-forums/bbpress/bb-admin/tag-destroy.php +11 -13
  103. bp-forums/bbpress/bb-admin/tag-merge.php +18 -15
  104. bp-forums/bbpress/bb-admin/tag-rename.php +10 -9
  105. bp-forums/bbpress/bb-admin/tools-recount.php +26 -11
  106. bp-forums/bbpress/bb-admin/topics.php +98 -11
  107. bp-forums/bbpress/bb-admin/user-add-new.php +49 -0
  108. bp-forums/bbpress/bb-admin/users.php +59 -13
  109. bp-forums/bbpress/bb-config-sample.php +0 -1
  110. bp-forums/bbpress/bb-edit.php +32 -10
  111. bp-forums/bbpress/bb-includes/action.subscribe.php +29 -0
  112. bp-forums/bbpress/bb-includes/backpress/class.bp-sql-schema-parser.php +2 -2
  113. bp-forums/bbpress/bb-includes/backpress/class.bp-user.php +1 -1
  114. bp-forums/bbpress/bb-includes/backpress/class.ixr.php +291 -126
  115. bp-forums/bbpress/bb-includes/backpress/class.mailer-smtp.php +2 -2
  116. bp-forums/bbpress/bb-includes/backpress/class.passwordhash.php +6 -6
  117. bp-forums/bbpress/bb-includes/backpress/class.wp-ajax-response.php +1 -1
  118. bp-forums/bbpress/bb-includes/backpress/class.wp-auth.php +10 -3
  119. bp-forums/bbpress/bb-includes/backpress/class.wp-dependencies.php +8 -4
  120. bp-forums/bbpress/bb-includes/backpress/class.wp-error.php +1 -1
  121. bp-forums/bbpress/bb-includes/backpress/class.wp-http-ixr-client.php +97 -0
  122. bp-forums/bbpress/bb-includes/backpress/class.wp-object-cache-memcached.php +6 -2
  123. bp-forums/bbpress/bb-includes/backpress/class.wp-pass.php +1 -1
  124. bp-forums/bbpress/bb-includes/backpress/class.wp-scripts.php +8 -3
  125. bp-forums/bbpress/bb-includes/backpress/class.wp-styles.php +8 -3
  126. bp-forums/bbpress/bb-includes/backpress/class.wp-taxonomy.php +15 -5
  127. bp-forums/bbpress/bb-includes/backpress/class.wp-users.php +6 -2
  128. bp-forums/bbpress/bb-includes/backpress/functions.core.php +16 -4
  129. bp-forums/bbpress/bb-includes/backpress/functions.formatting.php +196 -51
  130. bp-forums/bbpress/bb-includes/backpress/functions.plugin-api.php +100 -26
  131. bp-forums/bbpress/bb-includes/backpress/functions.shortcodes.php +3 -2
  132. bp-forums/bbpress/bb-includes/backpress/functions.wp-cron.php +8 -5
  133. bp-forums/bbpress/bb-includes/backpress/functions.wp-scripts.php +9 -4
  134. bp-forums/bbpress/bb-includes/backpress/functions.wp-styles.php +36 -9
  135. bp-forums/bbpress/bb-includes/backpress/interface.bp-options.php +0 -1
  136. bp-forums/bbpress/bb-includes/backpress/license.txt +339 -0
  137. bp-forums/bbpress/bb-includes/class.bb-dir-map.php +1 -1
  138. bp-forums/bbpress/bb-includes/class.bb-query.php +35 -27
  139. bp-forums/bbpress/bb-includes/class.bb-walker.php +1 -1
  140. bp-forums/bbpress/bb-includes/defaults.bb-filters.php +25 -5
  141. bp-forums/bbpress/bb-includes/functions.bb-capabilities.php +2 -0
  142. bp-forums/bbpress/bb-includes/functions.bb-core.php +20 -8
  143. bp-forums/bbpress/bb-includes/functions.bb-deprecated.php +11 -0
  144. bp-forums/bbpress/bb-includes/functions.bb-formatting.php +78 -4
  145. bp-forums/bbpress/bb-includes/functions.bb-forums.php +11 -11
  146. bp-forums/bbpress/bb-includes/functions.bb-l10n.php +1 -1
  147. bp-forums/bbpress/bb-includes/functions.bb-meta.php +16 -8
  148. bp-forums/bbpress/bb-includes/functions.bb-pluggable.php +6 -1
  149. bp-forums/bbpress/bb-includes/functions.bb-posts.php +242 -16
  150. bp-forums/bbpress/bb-includes/functions.bb-script-loader.php +8 -8
  151. bp-forums/bbpress/bb-includes/functions.bb-template.php +270 -32
  152. bp-forums/bbpress/bb-includes/functions.bb-topic-tags.php +39 -15
  153. bp-forums/bbpress/bb-includes/functions.bb-topics.php +26 -19
  154. bp-forums/bbpress/bb-includes/functions.bb-users.php +24 -6
  155. bp-forums/bbpress/bb-includes/js/jquery/interface.js +0 -1
  156. bp-forums/bbpress/bb-includes/js/jquery/jquery.js +151 -30
  157. bp-forums/bbpress/bb-includes/js/topic.js +7 -3
  158. bp-forums/bbpress/bb-load.php +4 -2
  159. bp-forums/bbpress/bb-login.php +2 -2
  160. bp-forums/bbpress/bb-plugins/akismet.php +49 -16
  161. bp-forums/bbpress/bb-plugins/bozo.php +13 -8
  162. bp-forums/bbpress/bb-post.php +46 -16
  163. bp-forums/bbpress/bb-settings.php +37 -14
  164. bp-forums/bbpress/bb-templates/kakumei-blue/functions.php +6 -0
  165. bp-forums/bbpress/bb-templates/kakumei/edit-form.php +25 -11
  166. bp-forums/bbpress/bb-templates/kakumei/functions.php +6 -0
  167. bp-forums/bbpress/bb-templates/kakumei/login-form.php +6 -6
  168. bp-forums/bbpress/bb-templates/kakumei/login.php +6 -6
  169. bp-forums/bbpress/bb-templates/kakumei/post-form-anonymous.php +31 -0
  170. bp-forums/bbpress/bb-templates/kakumei/post-form.php +24 -10
  171. bp-forums/bbpress/bb-templates/kakumei/profile-edit.php +40 -25
  172. bp-forums/bbpress/bb-templates/kakumei/profile.php +4 -4
  173. bp-forums/bbpress/bb-templates/kakumei/rss2.php +11 -13
  174. bp-forums/bbpress/bb-templates/kakumei/search.php +23 -13
  175. bp-forums/bbpress/bb-templates/kakumei/stats.php +17 -12
  176. bp-forums/bbpress/bb-templates/kakumei/style.css +22 -3
  177. bp-forums/bbpress/favorites.php +0 -1
  178. bp-forums/bbpress/profile-edit.php +12 -8
  179. bp-forums/bbpress/rss.php +33 -37
  180. bp-forums/bbpress/search.php +14 -8
  181. bp-forums/bbpress/tag-add.php +9 -7
  182. bp-forums/bbpress/tag-remove.php +12 -9
  183. bp-forums/bbpress/tags.php +0 -5
  184. bp-forums/bbpress/xmlrpc.php +1 -1
  185. bp-forums/bp-forums-actions.php +5 -0
  186. bp-forums/bp-forums-admin.php +164 -60
  187. bp-forums/bp-forums-bbpress-sa.php +428 -0
  188. bp-forums/bp-forums-bbpress.php +3 -222
  189. bp-forums/bp-forums-filters.php +108 -12
  190. bp-forums/bp-forums-functions.php +660 -0
  191. bp-forums/bp-forums-loader.php +250 -0
  192. bp-forums/bp-forums-screens.php +127 -0
  193. bp-forums/{bp-forums-templatetags.php → bp-forums-template.php} +514 -161
  194. bp-friends.php +0 -660
  195. bp-friends/bp-friends-actions.php +81 -0
  196. bp-friends/bp-friends-activity.php +115 -0
  197. bp-friends/bp-friends-cache.php +38 -0
  198. bp-friends/bp-friends-classes.php +33 -27
  199. bp-friends/bp-friends-functions.php +288 -0
  200. bp-friends/bp-friends-loader.php +210 -0
  201. bp-friends/bp-friends-notifications.php +21 -15
  202. bp-friends/bp-friends-screens.php +97 -0
  203. bp-friends/{bp-friends-templatetags.php → bp-friends-template.php} +137 -38
  204. bp-groups.php +0 -2707
  205. bp-groups/bp-groups-actions.php +312 -0
  206. bp-groups/bp-groups-activity.php +307 -0
  207. bp-groups/bp-groups-adminbar.php +117 -0
  208. bp-groups/bp-groups-buddybar.php +54 -0
  209. bp-groups/bp-groups-cache.php +52 -0
  210. bp-groups/bp-groups-classes.php +327 -287
  211. bp-groups/bp-groups-filters.php +90 -43
  212. bp-groups/bp-groups-forums.php +276 -0
  213. bp-groups/bp-groups-functions.php +969 -0
  214. bp-groups/bp-groups-loader.php +469 -0
  215. bp-groups/bp-groups-notifications.php +60 -109
  216. bp-groups/bp-groups-screens.php +866 -0
  217. bp-groups/{bp-groups-templatetags.php → bp-groups-template.php} +825 -239
  218. bp-groups/bp-groups-widgets.php +68 -17
  219. bp-groups/js/widget-groups.dev.js +49 -0
  220. bp-groups/js/widget-groups.js +1 -48
  221. bp-languages/buddypress.pot +3027 -2069
  222. bp-loader.php +107 -71
  223. bp-members/bp-members-actions.php +169 -0
  224. bp-members/bp-members-adminbar.php +225 -0
  225. bp-members/bp-members-buddybar.php +135 -0
  226. bp-members/bp-members-filters.php +48 -0
  227. bp-members/bp-members-functions.php +705 -0
  228. bp-members/bp-members-loader.php +193 -0
  229. bp-members/bp-members-notifications.php +131 -0
  230. bp-members/bp-members-screens.php +48 -0
  231. bp-core/bp-core-signup.php → bp-members/bp-members-signup.php +220 -188
  232. bp-members/bp-members-template.php +1200 -0
  233. bp-messages.php +0 -600
  234. bp-messages/bp-messages-actions.php +110 -0
  235. bp-messages/bp-messages-cache.php +20 -0
  236. bp-messages/bp-messages-classes.php +88 -68
  237. bp-messages/bp-messages-cssjs.php +23 -11
  238. bp-messages/bp-messages-filters.php +5 -3
  239. bp-messages/bp-messages-functions.php +261 -0
  240. bp-messages/bp-messages-loader.php +253 -0
  241. bp-messages/bp-messages-notifications.php +20 -11
  242. bp-messages/bp-messages-screens.php +177 -0
  243. bp-messages/{bp-messages-templatetags.php → bp-messages-template.php} +161 -65
  244. bp-messages/css/autocomplete/jquery.autocompletefb.css +1 -85
  245. bp-messages/css/autocomplete/jquery.autocompletefb.dev.css +85 -0
  246. bp-messages/js/autocomplete/jquery.autocomplete.dev.js +730 -0
  247. bp-messages/js/autocomplete/jquery.autocomplete.js +1 -718
  248. bp-messages/js/autocomplete/jquery.autocompletefb.dev.js +76 -0
  249. bp-messages/js/autocomplete/jquery.autocompletefb.js +2 -54
  250. bp-messages/js/autocomplete/jquery.bgiframe.dev.js +39 -0
  251. bp-messages/js/autocomplete/{jquery.bgiframe.min.js → jquery.bgiframe.js} +0 -0
  252. bp-messages/js/autocomplete/jquery.dimensions.dev.js +117 -0
  253. bp-messages/js/autocomplete/jquery.dimensions.js +3 -106
  254. bp-messages/js/autocomplete/license.bgiframe.txt +19 -19
  255. bp-settings/bp-settings-actions.php +167 -0
  256. bp-settings/bp-settings-functions.php +4 -0
  257. bp-settings/bp-settings-loader.php +184 -0
  258. bp-settings/bp-settings-screens.php +4 -0
  259. bp-settings/bp-settings-template.php +60 -0
  260. bp-themes/bp-default/404.php +10 -20
  261. bp-themes/bp-default/_inc/ajax.php +197 -81
  262. bp-themes/bp-default/_inc/css/default-rtl.css +769 -0
  263. bp-themes/bp-default/_inc/css/default.css +2210 -1620
  264. bp-themes/bp-default/_inc/css/reset.css +0 -64
  265. bp-themes/bp-default/_inc/css/responsive-rtl.css +54 -0
  266. bp-themes/bp-default/_inc/css/responsive.css +200 -0
  267. bp-themes/bp-default/_inc/global.js +112 -104
  268. bp-themes/bp-default/_inc/options.php +0 -55
  269. bp-themes/bp-default/activity/activity-loop.php +31 -10
  270. bp-themes/bp-default/activity/comment.php +52 -0
  271. bp-themes/bp-default/activity/entry.php +90 -42
  272. bp-themes/bp-default/activity/index.php +87 -37
  273. bp-themes/bp-default/activity/post-form.php +39 -27
  274. bp-themes/bp-default/archive.php +10 -19
  275. bp-themes/bp-default/attachment.php +47 -19
  276. bp-themes/bp-default/blogs/blogs-loop.php +37 -18
  277. bp-themes/bp-default/blogs/create.php +23 -13
  278. bp-themes/bp-default/blogs/index.php +56 -21
  279. bp-themes/bp-default/comments.php +68 -173
  280. bp-themes/bp-default/editor-style-rtl.css +43 -0
  281. bp-themes/bp-default/editor-style.css +272 -0
  282. bp-themes/bp-default/footer.php +10 -1
  283. bp-themes/bp-default/forums/forums-loop.php +67 -40
  284. bp-themes/bp-default/forums/index.php +116 -72
  285. bp-themes/bp-default/forums/single/edit.php +93 -0
  286. bp-themes/bp-default/forums/single/forum-header.php +35 -0
  287. bp-themes/bp-default/forums/single/forum.php +65 -0
  288. bp-themes/bp-default/forums/single/topic.php +195 -0
  289. bp-themes/bp-default/functions.php +623 -249
  290. bp-themes/bp-default/groups/create.php +123 -67
  291. bp-themes/bp-default/groups/groups-loop.php +39 -18
  292. bp-themes/bp-default/groups/index.php +59 -22
  293. bp-themes/bp-default/groups/single/activity.php +9 -8
  294. bp-themes/bp-default/groups/single/admin.php +95 -40
  295. bp-themes/bp-default/groups/single/forum.php +46 -10
  296. bp-themes/bp-default/groups/single/forum/edit.php +46 -22
  297. bp-themes/bp-default/groups/single/forum/topic.php +55 -19
  298. bp-themes/bp-default/groups/single/group-header.php +34 -20
  299. bp-themes/bp-default/groups/single/home.php +44 -35
  300. bp-themes/bp-default/groups/single/members.php +53 -17
  301. bp-themes/bp-default/groups/single/plugins.php +6 -6
  302. bp-themes/bp-default/groups/single/request-membership.php +1 -1
  303. bp-themes/bp-default/groups/single/send-invites.php +3 -3
  304. bp-themes/bp-default/header.php +23 -77
  305. bp-themes/bp-default/index.php +17 -13
  306. bp-themes/bp-default/license.txt +280 -0
  307. bp-themes/bp-default/links.php +2 -2
  308. bp-themes/bp-default/members/index.php +58 -23
  309. bp-themes/bp-default/members/members-loop.php +38 -17
  310. bp-themes/bp-default/members/single/activity.php +63 -36
  311. bp-themes/bp-default/members/single/activity/permalink.php +3 -3
  312. bp-themes/bp-default/members/single/blogs.php +27 -11
  313. bp-themes/bp-default/members/single/forums.php +47 -0
  314. bp-themes/bp-default/members/single/forums/topics.php +7 -0
  315. bp-themes/bp-default/members/single/friends.php +37 -19
  316. bp-themes/bp-default/members/single/friends/requests.php +34 -2
  317. bp-themes/bp-default/members/single/groups.php +37 -21
  318. bp-themes/bp-default/members/single/groups/invites.php +6 -3
  319. bp-themes/bp-default/members/single/home.php +51 -31
  320. bp-themes/bp-default/members/single/member-header.php +38 -16
  321. bp-themes/bp-default/members/single/messages.php +30 -15
  322. bp-themes/bp-default/members/single/messages/compose.php +3 -4
  323. bp-themes/bp-default/members/single/messages/messages-loop.php +3 -3
  324. bp-themes/bp-default/members/single/messages/notices-loop.php +2 -2
  325. bp-themes/bp-default/members/single/messages/single.php +17 -5
  326. bp-themes/bp-default/members/single/plugins.php +38 -17
  327. bp-themes/bp-default/members/single/profile.php +36 -12
  328. bp-themes/bp-default/members/single/profile/change-avatar.php +2 -3
  329. bp-themes/bp-default/members/single/profile/edit.php +49 -33
  330. bp-themes/bp-default/members/single/profile/profile-loop.php +25 -36
  331. bp-themes/bp-default/members/single/profile/profile-wp.php +73 -0
  332. bp-themes/bp-default/members/single/settings.php +38 -0
  333. bp-themes/bp-default/members/single/settings/delete-account.php +82 -0
  334. bp-themes/bp-default/members/single/settings/general.php +89 -0
  335. bp-themes/bp-default/members/single/settings/notifications.php +82 -0
  336. bp-themes/bp-default/onecolumn-page.php +49 -0
  337. bp-themes/bp-default/page.php +7 -5
  338. bp-themes/bp-default/readme.txt +22 -0
  339. bp-themes/bp-default/registration/activate.php +4 -8
  340. bp-themes/bp-default/registration/register.php +23 -64
  341. bp-themes/bp-default/rtl.css +24 -743
  342. bp-themes/bp-default/search.php +11 -17
  343. bp-themes/bp-default/searchform.php +1 -1
  344. bp-themes/bp-default/sidebar-footer.php +50 -0
  345. bp-themes/bp-default/sidebar.php +16 -16
  346. bp-themes/bp-default/single.php +15 -16
  347. bp-themes/bp-default/style.css +24 -26
  348. bp-xprofile.php +0 -1024
  349. bp-xprofile/admin/css/admin.css +1 -92
  350. bp-xprofile/admin/css/admin.dev.css +266 -0
  351. bp-xprofile/admin/images/cross.gif +0 -0
  352. bp-xprofile/admin/images/move-x.gif +0 -0
  353. bp-xprofile/admin/images/move.gif +0 -0
  354. bp-xprofile/admin/images/move.png +0 -0
  355. bp-xprofile/admin/images/plus.gif +0 -0
  356. bp-xprofile/admin/images/tick.gif +0 -0
  357. bp-xprofile/admin/js/admin.dev.js +218 -0
  358. bp-xprofile/admin/js/admin.js +1 -136
  359. bp-xprofile/bp-xprofile-actions.php +44 -0
  360. bp-xprofile/bp-xprofile-activity.php +134 -0
  361. bp-xprofile/bp-xprofile-admin.php +332 -156
  362. bp-xprofile/bp-xprofile-buddybar.php +4 -0
  363. bp-xprofile/bp-xprofile-cache.php +30 -0
  364. bp-xprofile/bp-xprofile-classes.php +432 -305
  365. bp-xprofile/bp-xprofile-cssjs.php +21 -15
  366. bp-xprofile/bp-xprofile-filters.php +74 -17
  367. bp-xprofile/bp-xprofile-functions.php +605 -0
  368. bp-xprofile/bp-xprofile-loader.php +234 -0
  369. bp-xprofile/bp-xprofile-screens.php +177 -0
  370. bp-xprofile/{bp-xprofile-templatetags.php → bp-xprofile-template.php} +231 -116
  371. favicon.ico +0 -0
  372. humans.txt +54 -0
  373. license.txt +280 -281
  374. readme.txt +33 -68
  375. screenshot-1.gif +0 -0
  376. screenshot-2.gif +0 -0
  377. screenshot-3.gif +0 -0
  378. screenshot-4.gif +0 -0
  379. screenshot-5.gif +0 -0
  380. screenshot-6.gif +0 -0
  381. screenshot-7.gif +0 -0
  382. screenshot-8.gif +0 -0
bp-activity.php DELETED
@@ -1,1216 +0,0 @@
1
- <?php
2
-
3
- define ( 'BP_ACTIVITY_DB_VERSION', '2100' );
4
-
5
- /* Define the slug for the component */
6
- if ( !defined( 'BP_ACTIVITY_SLUG' ) )
7
- define ( 'BP_ACTIVITY_SLUG', 'activity' );
8
-
9
- require ( BP_PLUGIN_DIR . '/bp-activity/bp-activity-classes.php' );
10
- require ( BP_PLUGIN_DIR . '/bp-activity/bp-activity-templatetags.php' );
11
- require ( BP_PLUGIN_DIR . '/bp-activity/bp-activity-filters.php' );
12
-
13
- function bp_activity_install() {
14
- global $wpdb, $bp;
15
-
16
- if ( !empty($wpdb->charset) )
17
- $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
18
-
19
- /* Rename the old user activity cached table if needed. */
20
- if ( $wpdb->get_var( "SHOW TABLES LIKE '%{$wpdb->base_prefix}bp_activity_user_activity_cached%'" ) )
21
- $wpdb->query( "RENAME TABLE {$wpdb->base_prefix}bp_activity_user_activity_cached TO {$bp->activity->table_name}" );
22
-
23
- /* Rename fields from pre BP 1.2 */
24
- if ( $wpdb->get_var( "SHOW TABLES LIKE '%{$bp->activity->table_name}%'" ) ) {
25
- if ( $wpdb->get_var( "SHOW COLUMNS FROM {$bp->activity->table_name} LIKE 'component_action'" ) )
26
- $wpdb->query( "ALTER TABLE {$bp->activity->table_name} CHANGE component_action type varchar(75) NOT NULL" );
27
-
28
- if ( $wpdb->get_var( "SHOW COLUMNS FROM {$bp->activity->table_name} LIKE 'component_name'" ) )
29
- $wpdb->query( "ALTER TABLE {$bp->activity->table_name} CHANGE component_name component varchar(75) NOT NULL" );
30
- }
31
-
32
- /**
33
- * Build the tables
34
- */
35
- $sql[] = "CREATE TABLE {$bp->activity->table_name} (
36
- id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
37
- user_id bigint(20) NOT NULL,
38
- component varchar(75) NOT NULL,
39
- type varchar(75) NOT NULL,
40
- action text NOT NULL,
41
- content longtext NOT NULL,
42
- primary_link varchar(150) NOT NULL,
43
- item_id varchar(75) NOT NULL,
44
- secondary_item_id varchar(75) DEFAULT NULL,
45
- date_recorded datetime NOT NULL,
46
- hide_sitewide bool DEFAULT 0,
47
- mptt_left int(11) NOT NULL DEFAULT 0,
48
- mptt_right int(11) NOT NULL DEFAULT 0,
49
- KEY date_recorded (date_recorded),
50
- KEY user_id (user_id),
51
- KEY item_id (item_id),
52
- KEY secondary_item_id (secondary_item_id),
53
- KEY component (component),
54
- KEY type (type),
55
- KEY mptt_left (mptt_left),
56
- KEY mptt_right (mptt_right),
57
- KEY hide_sitewide (hide_sitewide)
58
- ) {$charset_collate};";
59
-
60
- $sql[] = "CREATE TABLE {$bp->activity->table_name_meta} (
61
- id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
62
- activity_id bigint(20) NOT NULL,
63
- meta_key varchar(255) DEFAULT NULL,
64
- meta_value longtext DEFAULT NULL,
65
- KEY activity_id (activity_id),
66
- KEY meta_key (meta_key)
67
- ) {$charset_collate};";
68
-
69
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
70
- dbDelta($sql);
71
-
72
- update_site_option( 'bp-activity-db-version', BP_ACTIVITY_DB_VERSION );
73
- }
74
-
75
- function bp_activity_setup_globals() {
76
- global $bp, $current_blog;
77
-
78
- /* Internal identifier */
79
- $bp->activity->id = 'activity';
80
-
81
- $bp->activity->slug = BP_ACTIVITY_SLUG;
82
-
83
- $bp->activity->table_name = $bp->table_prefix . 'bp_activity';
84
- $bp->activity->table_name_meta = $bp->table_prefix . 'bp_activity_meta';
85
-
86
- $bp->activity->format_notification_function = 'bp_activity_format_notifications';
87
-
88
- /* Register this in the active components array */
89
- $bp->active_components[$bp->activity->slug] = $bp->activity->id;
90
-
91
- do_action( 'bp_activity_setup_globals' );
92
- }
93
- add_action( 'bp_setup_globals', 'bp_activity_setup_globals' );
94
-
95
- function bp_activity_check_installed() {
96
- global $bp;
97
-
98
- if ( get_site_option( 'bp-activity-db-version' ) < BP_ACTIVITY_DB_VERSION )
99
- bp_activity_install();
100
- }
101
- add_action( is_multisite() ? 'network_admin_menu' : 'admin_menu', 'bp_activity_check_installed' );
102
-
103
- function bp_activity_setup_root_component() {
104
- /* Register 'activity' as a root component (for RSS feed use) */
105
- bp_core_add_root_component( BP_ACTIVITY_SLUG );
106
- }
107
- add_action( 'bp_setup_root_components', 'bp_activity_setup_root_component' );
108
-
109
- function bp_activity_setup_nav() {
110
- global $bp;
111
-
112
- /* Add 'Activity' to the main navigation */
113
- bp_core_new_nav_item( array( 'name' => __( 'Activity', 'buddypress' ), 'slug' => $bp->activity->slug, 'position' => 10, 'screen_function' => 'bp_activity_screen_my_activity', 'default_subnav_slug' => 'just-me', 'item_css_id' => $bp->activity->id ) );
114
-
115
- $user_domain = ( !empty( $bp->displayed_user->domain ) ) ? $bp->displayed_user->domain : $bp->loggedin_user->domain;
116
- $user_login = ( !empty( $bp->displayed_user->userdata->user_login ) ) ? $bp->displayed_user->userdata->user_login : $bp->loggedin_user->userdata->user_login;
117
- $activity_link = $user_domain . $bp->activity->slug . '/';
118
-
119
- /* Add the subnav items to the activity nav item if we are using a theme that supports this */
120
- bp_core_new_subnav_item( array( 'name' => __( 'Personal', 'buddypress' ), 'slug' => 'just-me', 'parent_url' => $activity_link, 'parent_slug' => $bp->activity->slug, 'screen_function' => 'bp_activity_screen_my_activity', 'position' => 10 ) );
121
-
122
- if ( bp_is_active( 'friends' ) )
123
- bp_core_new_subnav_item( array( 'name' => __( 'Friends', 'buddypress' ), 'slug' => BP_FRIENDS_SLUG, 'parent_url' => $activity_link, 'parent_slug' => $bp->activity->slug, 'screen_function' => 'bp_activity_screen_friends', 'position' => 20, 'item_css_id' => 'activity-friends' ) );
124
-
125
- if ( bp_is_active( 'groups' ) )
126
- bp_core_new_subnav_item( array( 'name' => __( 'Groups', 'buddypress' ), 'slug' => BP_GROUPS_SLUG, 'parent_url' => $activity_link, 'parent_slug' => $bp->activity->slug, 'screen_function' => 'bp_activity_screen_groups', 'position' => 30, 'item_css_id' => 'activity-groups' ) );
127
-
128
- bp_core_new_subnav_item( array( 'name' => __( 'Favorites', 'buddypress' ), 'slug' => 'favorites', 'parent_url' => $activity_link, 'parent_slug' => $bp->activity->slug, 'screen_function' => 'bp_activity_screen_favorites', 'position' => 40, 'item_css_id' => 'activity-favs' ) );
129
- bp_core_new_subnav_item( array( 'name' => sprintf( __( '@%s Mentions', 'buddypress' ), $user_login ), 'slug' => 'mentions', 'parent_url' => $activity_link, 'parent_slug' => $bp->activity->slug, 'screen_function' => 'bp_activity_screen_mentions', 'position' => 50, 'item_css_id' => 'activity-mentions' ) );
130
-
131
- if ( $bp->current_component == $bp->activity->slug ) {
132
- if ( bp_is_my_profile() ) {
133
- $bp->bp_options_title = __( 'My Activity', 'buddypress' );
134
- } else {
135
- $bp->bp_options_avatar = bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => 'thumb' ) );
136
- $bp->bp_options_title = $bp->displayed_user->fullname;
137
- }
138
- }
139
-
140
- do_action( 'bp_activity_setup_nav' );
141
- }
142
- add_action( 'bp_setup_nav', 'bp_activity_setup_nav' );
143
-
144
- function bp_activity_directory_activity_setup() {
145
- global $bp;
146
-
147
- if ( $bp->current_component == $bp->activity->slug && empty( $bp->current_action ) ) {
148
- $bp->is_directory = true;
149
-
150
- do_action( 'bp_activity_directory_activity_setup' );
151
- bp_core_load_template( apply_filters( 'bp_activity_directory_activity_setup', 'activity/index' ) );
152
- }
153
- }
154
- add_action( 'wp', 'bp_activity_directory_activity_setup', 2 );
155
-
156
-
157
- /********************************************************************************
158
- * Screen Functions
159
- *
160
- * Screen functions are the controllers of BuddyPress. They will execute when their
161
- * specific URL is caught. They will first save or manipulate data using business
162
- * functions, then pass on the user to a template file.
163
- */
164
-
165
- function bp_activity_screen_my_activity() {
166
- do_action( 'bp_activity_screen_my_activity' );
167
- bp_core_load_template( apply_filters( 'bp_activity_template_my_activity', 'members/single/home' ) );
168
- }
169
-
170
- function bp_activity_screen_friends() {
171
- global $bp;
172
-
173
- if ( !bp_is_active( 'friends' ) )
174
- return false;
175
-
176
- if ( !is_super_admin() )
177
- $bp->is_item_admin = false;
178
-
179
- do_action( 'bp_activity_screen_friends' );
180
- bp_core_load_template( apply_filters( 'bp_activity_template_friends_activity', 'members/single/home' ) );
181
- }
182
-
183
- function bp_activity_screen_groups() {
184
- global $bp;
185
-
186
- if ( !bp_is_active( 'groups' ) )
187
- return false;
188
-
189
- if ( !is_super_admin() )
190
- $bp->is_item_admin = false;
191
-
192
- do_action( 'bp_activity_screen_groups' );
193
- bp_core_load_template( apply_filters( 'bp_activity_template_groups_activity', 'members/single/home' ) );
194
- }
195
-
196
- function bp_activity_screen_favorites() {
197
- global $bp;
198
-
199
- if ( !is_super_admin() )
200
- $bp->is_item_admin = false;
201
-
202
- do_action( 'bp_activity_screen_favorites' );
203
- bp_core_load_template( apply_filters( 'bp_activity_template_favorite_activity', 'members/single/home' ) );
204
- }
205
-
206
- function bp_activity_screen_mentions() {
207
- global $bp;
208
-
209
- if ( !is_super_admin() )
210
- $bp->is_item_admin = false;
211
-
212
- do_action( 'bp_activity_screen_mentions' );
213
- bp_core_load_template( apply_filters( 'bp_activity_template_mention_activity', 'members/single/home' ) );
214
- }
215
-
216
- function bp_activity_screen_single_activity_permalink() {
217
- global $bp;
218
-
219
- if ( !$bp->displayed_user->id || $bp->current_component != $bp->activity->slug )
220
- return false;
221
-
222
- if ( empty( $bp->current_action ) || !is_numeric( $bp->current_action ) )
223
- return false;
224
-
225
- /* Get the activity details */
226
- $activity = bp_activity_get_specific( array( 'activity_ids' => $bp->current_action, 'show_hidden' => true ) );
227
-
228
- if ( !$activity = $activity['activities'][0] )
229
- bp_core_redirect( $bp->root_domain );
230
-
231
- $has_access = true;
232
- /* Redirect based on the type of activity */
233
- if ( $activity->component == $bp->groups->id ) {
234
- if ( !function_exists( 'groups_get_group' ) )
235
- bp_core_redirect( $bp->root_domain );
236
-
237
- if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) ) {
238
- /* Check to see if the group is not public, if so, check the user has access to see this activity */
239
- if ( 'public' != $group->status ) {
240
- if ( !groups_is_user_member( $bp->loggedin_user->id, $group->id ) )
241
- $has_access = false;
242
- }
243
- }
244
- }
245
-
246
- $has_access = apply_filters( 'bp_activity_permalink_access', $has_access, &$activity );
247
-
248
- do_action( 'bp_activity_screen_single_activity_permalink', $activity, $has_access );
249
-
250
- if ( !$has_access ) {
251
- bp_core_add_message( __( 'You do not have access to this activity.', 'buddypress' ), 'error' );
252
-
253
- if ( is_user_logged_in() )
254
- bp_core_redirect( $bp->loggedin_user->domain );
255
- else
256
- bp_core_redirect( site_url( 'wp-login.php?redirect_to=' . esc_url( $bp->root_domain . '/' . $bp->activity->slug . '/p/' . $bp->current_action ) ) );
257
- }
258
-
259
- bp_core_load_template( apply_filters( 'bp_activity_template_profile_activity_permalink', 'members/single/activity/permalink' ) );
260
- }
261
- /* This screen is not attached to a nav item, so we need to add an action for it. */
262
- add_action( 'wp', 'bp_activity_screen_single_activity_permalink', 3 );
263
-
264
- function bp_activity_screen_notification_settings() {
265
- global $bp; ?>
266
- <table class="notification-settings zebra" id="activity-notification-settings">
267
- <thead>
268
- <tr>
269
- <th class="icon"></th>
270
- <th class="title"><?php _e( 'Activity', 'buddypress' ) ?></th>
271
- <th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
272
- <th class="no"><?php _e( 'No', 'buddypress' )?></th>
273
- </tr>
274
- </thead>
275
-
276
- <tbody>
277
- <tr>
278
- <td></td>
279
- <td><?php printf( __( 'A member mentions you in an update using "@%s"', 'buddypress' ), bp_core_get_username( $bp->loggedin_user->id, $bp->loggedin_user->userdata->user_nicename, $bp->loggedin_user->userdata->user_login ) ) ?></td>
280
- <td class="yes"><input type="radio" name="notifications[notification_activity_new_mention]" value="yes" <?php if ( !get_user_meta( $bp->loggedin_user->id, 'notification_activity_new_mention', true ) || 'yes' == get_user_meta( $bp->loggedin_user->id, 'notification_activity_new_mention', true ) ) { ?>checked="checked" <?php } ?>/></td>
281
- <td class="no"><input type="radio" name="notifications[notification_activity_new_mention]" value="no" <?php if ( 'no' == get_user_meta( $bp->loggedin_user->id, 'notification_activity_new_mention', true ) ) { ?>checked="checked" <?php } ?>/></td>
282
- </tr>
283
- <tr>
284
- <td></td>
285
- <td><?php printf( __( "A member replies to an update or comment you've posted", 'buddypress' ), $current_user->user_login ) ?></td>
286
- <td class="yes"><input type="radio" name="notifications[notification_activity_new_reply]" value="yes" <?php if ( !get_user_meta( $bp->loggedin_user->id, 'notification_activity_new_reply', true ) || 'yes' == get_user_meta( $bp->loggedin_user->id, 'notification_activity_new_reply', true ) ) { ?>checked="checked" <?php } ?>/></td>
287
- <td class="no"><input type="radio" name="notifications[notification_activity_new_reply]" value="no" <?php if ( 'no' == get_user_meta( $bp->loggedin_user->id, 'notification_activity_new_reply', true ) ) { ?>checked="checked" <?php } ?>/></td>
288
- </tr>
289
-
290
- <?php do_action( 'bp_activity_screen_notification_settings' ) ?>
291
- </tbody>
292
- </table>
293
- <?php
294
- }
295
- add_action( 'bp_notification_settings', 'bp_activity_screen_notification_settings', 1 );
296
-
297
- /********************************************************************************
298
- * Action Functions
299
- *
300
- * Action functions are exactly the same as screen functions, however they do not
301
- * have a template screen associated with them. Usually they will send the user
302
- * back to the default screen after execution.
303
- */
304
-
305
- function bp_activity_action_permalink_router() {
306
- global $bp;
307
-
308
- if ( $bp->current_component != $bp->activity->slug || $bp->current_action != 'p' )
309
- return false;
310
-
311
- if ( empty( $bp->action_variables[0] ) || !is_numeric( $bp->action_variables[0] ) )
312
- return false;
313
-
314
- /* Get the activity details */
315
- $activity = bp_activity_get_specific( array( 'activity_ids' => $bp->action_variables[0], 'show_hidden' => true ) );
316
-
317
- if ( !$activity = $activity['activities'][0] )
318
- bp_core_redirect( $bp->root_domain );
319
-
320
- $redirect = false;
321
- /* Redirect based on the type of activity */
322
- if ( $activity->component == $bp->groups->id ) {
323
- if ( $activity->user_id )
324
- $redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . $bp->activity->slug . '/' . $activity->id . '/';
325
- else {
326
- if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) )
327
- $redirect = bp_get_group_permalink( $group ) . $bp->activity->slug . '/' . $activity->id . '/';
328
- }
329
- } else
330
- $redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . $bp->activity->slug . '/' . $activity->id;
331
-
332
- $redirect = apply_filters( 'bp_activity_permalink_redirect_url', $redirect, &$activity );
333
-
334
- if ( !$redirect )
335
- bp_core_redirect( $bp->root_domain );
336
-
337
- /* Redirect to the actual activity permalink page */
338
- bp_core_redirect( $redirect );
339
- }
340
- add_action( 'wp', 'bp_activity_action_permalink_router', 3 );
341
-
342
- function bp_activity_action_delete_activity() {
343
- global $bp;
344
-
345
- if ( $bp->current_component != $bp->activity->slug || $bp->current_action != 'delete' )
346
- return false;
347
-
348
- if ( empty( $bp->action_variables[0] ) || !is_numeric( $bp->action_variables[0] ) )
349
- return false;
350
-
351
- /* Check the nonce */
352
- check_admin_referer( 'bp_activity_delete_link' );
353
-
354
- $activity_id = $bp->action_variables[0];
355
- $activity = new BP_Activity_Activity( $activity_id );
356
-
357
- /* Check access */
358
- if ( !is_super_admin() && $activity->user_id != $bp->loggedin_user->id )
359
- return false;
360
-
361
- /* Call the action before the delete so plugins can still fetch information about it */
362
- do_action( 'bp_activity_action_delete_activity', $activity_id, $activity->user_id );
363
-
364
- /* Now delete the activity item */
365
- if ( bp_activity_delete( array( 'id' => $activity_id, 'user_id' => $activity->user_id ) ) )
366
- bp_core_add_message( __( 'Activity deleted', 'buddypress' ) );
367
- else
368
- bp_core_add_message( __( 'There was an error when deleting that activity', 'buddypress' ), 'error' );
369
-
370
- bp_core_redirect( wp_get_referer() );
371
- }
372
- add_action( 'wp', 'bp_activity_action_delete_activity', 3 );
373
-
374
- function bp_activity_action_post_update() {
375
- global $bp;
376
-
377
- if ( !is_user_logged_in() || $bp->current_component != $bp->activity->slug || $bp->current_action != 'post' )
378
- return false;
379
-
380
- /* Check the nonce */
381
- check_admin_referer( 'post_update', '_wpnonce_post_update' );
382
-
383
- $content = apply_filters( 'bp_activity_post_update_content', $_POST['whats-new'] );
384
- $object = apply_filters( 'bp_activity_post_update_object', $_POST['whats-new-post-object'] );
385
- $item_id = apply_filters( 'bp_activity_post_update_item_id', $_POST['whats-new-post-in'] );
386
-
387
- if ( empty( $content ) ) {
388
- bp_core_add_message( __( 'Please enter some content to post.', 'buddypress' ), 'error' );
389
- bp_core_redirect( wp_get_referer() );
390
- }
391
-
392
- if ( !(int)$item_id ) {
393
- $activity_id = bp_activity_post_update( array( 'content' => $content ) );
394
-
395
- } else if ( 'groups' == $object && function_exists( 'groups_post_update' ) ) {
396
- if ( (int)$item_id ) {
397
- $activity_id = groups_post_update( array( 'content' => $content, 'group_id' => $item_id ) );
398
- }
399
- } else
400
- $activity_id = apply_filters( 'bp_activity_custom_update', $object, $item_id, $content );
401
-
402
- if ( !empty( $activity_id ) )
403
- bp_core_add_message( __( 'Update Posted!', 'buddypress' ) );
404
- else
405
- bp_core_add_message( __( 'There was an error when posting your update, please try again.', 'buddypress' ), 'error' );
406
-
407
- bp_core_redirect( wp_get_referer() );
408
- }
409
- add_action( 'wp', 'bp_activity_action_post_update', 3 );
410
-
411
- function bp_activity_action_post_comment() {
412
- global $bp;
413
-
414
- if ( !is_user_logged_in() || $bp->current_component != $bp->activity->slug || $bp->current_action != 'reply' )
415
- return false;
416
-
417
- /* Check the nonce */
418
- check_admin_referer( 'new_activity_comment', '_wpnonce_new_activity_comment' );
419
-
420
- $activity_id = apply_filters( 'bp_activity_post_comment_activity_id', $_POST['comment_form_id'] );
421
- $content = apply_filters( 'bp_activity_post_comment_content', $_POST['ac_input_' . $activity_id] );
422
-
423
- if ( empty( $content ) ) {
424
- bp_core_add_message( __( 'Please do not leave the comment area blank.', 'buddypress' ), 'error' );
425
- bp_core_redirect( wp_get_referer() . '#ac-form-' . $activity_id );
426
- }
427
-
428
- $comment_id = bp_activity_new_comment( array(
429
- 'content' => $content,
430
- 'activity_id' => $activity_id,
431
- 'parent_id' => $parent_id
432
- ));
433
-
434
- if ( !empty( $comment_id ) )
435
- bp_core_add_message( __( 'Reply Posted!', 'buddypress' ) );
436
- else
437
- bp_core_add_message( __( 'There was an error posting that reply, please try again.', 'buddypress' ), 'error' );
438
-
439
- bp_core_redirect( wp_get_referer() . '#ac-form-' . $activity_id );
440
- }
441
- add_action( 'wp', 'bp_activity_action_post_comment', 3 );
442
-
443
- function bp_activity_action_mark_favorite() {
444
- global $bp;
445
-
446
- if ( !is_user_logged_in() || $bp->current_component != $bp->activity->slug || $bp->current_action != 'favorite' )
447
- return false;
448
-
449
- /* Check the nonce */
450
- check_admin_referer( 'mark_favorite' );
451
-
452
- if ( bp_activity_add_user_favorite( $bp->action_variables[0] ) )
453
- bp_core_add_message( __( 'Activity marked as favorite.', 'buddypress' ) );
454
- else
455
- bp_core_add_message( __( 'There was an error marking that activity as a favorite, please try again.', 'buddypress' ), 'error' );
456
-
457
- bp_core_redirect( wp_get_referer() . '#activity-' . $bp->action_variables[0] );
458
- }
459
- add_action( 'wp', 'bp_activity_action_mark_favorite', 3 );
460
-
461
- function bp_activity_action_remove_favorite() {
462
- global $bp;
463
-
464
- if ( !is_user_logged_in() || $bp->current_component != $bp->activity->slug || $bp->current_action != 'unfavorite' )
465
- return false;
466
-
467
- /* Check the nonce */
468
- check_admin_referer( 'unmark_favorite' );
469
-
470
- if ( bp_activity_remove_user_favorite( $bp->action_variables[0] ) )
471
- bp_core_add_message( __( 'Activity removed as favorite.', 'buddypress' ) );
472
- else
473
- bp_core_add_message( __( 'There was an error removing that activity as a favorite, please try again.', 'buddypress' ), 'error' );
474
-
475
- bp_core_redirect( wp_get_referer() . '#activity-' . $bp->action_variables[0] );
476
- }
477
- add_action( 'wp', 'bp_activity_action_remove_favorite', 3 );
478
-
479
- function bp_activity_action_sitewide_feed() {
480
- global $bp, $wp_query;
481
-
482
- if ( $bp->current_component != $bp->activity->slug || $bp->current_action != 'feed' || $bp->displayed_user->id || $bp->groups->current_group )
483
- return false;
484
-
485
- $wp_query->is_404 = false;
486
- status_header( 200 );
487
-
488
- include_once( 'bp-activity/feeds/bp-activity-sitewide-feed.php' );
489
- die;
490
- }
491
- add_action( 'wp', 'bp_activity_action_sitewide_feed', 3 );
492
-
493
- function bp_activity_action_personal_feed() {
494
- global $bp, $wp_query;
495
-
496
- if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'feed' )
497
- return false;
498
-
499
- $wp_query->is_404 = false;
500
- status_header( 200 );
501
-
502
- include_once( 'bp-activity/feeds/bp-activity-personal-feed.php' );
503
- die;
504
- }
505
- add_action( 'wp', 'bp_activity_action_personal_feed', 3 );
506
-
507
- function bp_activity_action_friends_feed() {
508
- global $bp, $wp_query;
509
-
510
- if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'friends' || $bp->action_variables[0] != 'feed' )
511
- return false;
512
-
513
- $wp_query->is_404 = false;
514
- status_header( 200 );
515
-
516
- include_once( 'bp-activity/feeds/bp-activity-friends-feed.php' );
517
- die;
518
- }
519
- add_action( 'wp', 'bp_activity_action_friends_feed', 3 );
520
-
521
- function bp_activity_action_my_groups_feed() {
522
- global $bp, $wp_query;
523
-
524
- if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'groups' || $bp->action_variables[0] != 'feed' )
525
- return false;
526
-
527
- $wp_query->is_404 = false;
528
- status_header( 200 );
529
-
530
- include_once( 'bp-activity/feeds/bp-activity-mygroups-feed.php' );
531
- die;
532
- }
533
- add_action( 'wp', 'bp_activity_action_my_groups_feed', 3 );
534
-
535
- function bp_activity_action_mentions_feed() {
536
- global $bp, $wp_query;
537
-
538
- if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'mentions' || $bp->action_variables[0] != 'feed' )
539
- return false;
540
-
541
- $wp_query->is_404 = false;
542
- status_header( 200 );
543
-
544
- include_once( 'bp-activity/feeds/bp-activity-mentions-feed.php' );
545
- die;
546
- }
547
- add_action( 'wp', 'bp_activity_action_mentions_feed', 3 );
548
-
549
- function bp_activity_action_favorites_feed() {
550
- global $bp, $wp_query;
551
-
552
- if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'favorites' || $bp->action_variables[0] != 'feed' )
553
- return false;
554
-
555
- $wp_query->is_404 = false;
556
- status_header( 200 );
557
-
558
- include_once( 'bp-activity/feeds/bp-activity-favorites-feed.php' );
559
- die;
560
- }
561
- add_action( 'wp', 'bp_activity_action_favorites_feed', 3 );
562
-
563
- /********************************************************************************
564
- * Business Functions
565
- *
566
- * Business functions are where all the magic happens in BuddyPress. They will
567
- * handle the actual saving or manipulation of information. Usually they will
568
- * hand off to a database class for data access, then return
569
- * true or false on success or failure.
570
- */
571
-
572
- function bp_activity_get( $args = '' ) {
573
- $defaults = array(
574
- 'max' => false, // Maximum number of results to return
575
- 'page' => 1, // page 1 without a per_page will result in no pagination.
576
- 'per_page' => false, // results per page
577
- 'sort' => 'DESC', // sort ASC or DESC
578
- 'display_comments' => false, // false for no comments. 'stream' for within stream display, 'threaded' for below each activity item
579
-
580
- 'search_terms' => false, // Pass search terms as a string
581
- 'show_hidden' => false, // Show activity items that are hidden site-wide?
582
-
583
- /**
584
- * Pass filters as an array -- all filter items can be multiple values comma separated:
585
- * array(
586
- * 'user_id' => false, // user_id to filter on
587
- * 'object' => false, // object to filter on e.g. groups, profile, status, friends
588
- * 'action' => false, // action to filter on e.g. activity_update, profile_updated
589
- * 'primary_id' => false, // object ID to filter on e.g. a group_id or forum_id or blog_id etc.
590
- * 'secondary_id' => false, // secondary object ID to filter on e.g. a post_id
591
- * );
592
- */
593
- 'filter' => array()
594
- );
595
-
596
- $r = wp_parse_args( $args, $defaults );
597
- extract( $r, EXTR_SKIP );
598
-
599
- /* Attempt to return a cached copy of the first page of sitewide activity. */
600
- if ( 1 == (int)$page && empty( $max ) && empty( $search_terms ) && empty( $filter ) && 'DESC' == $sort ) {
601
- if ( !$activity = wp_cache_get( 'bp_activity_sitewide_front', 'bp' ) ) {
602
- $activity = BP_Activity_Activity::get( $max, $page, $per_page, $sort, $search_terms, $filter, $display_comments, $show_hidden );
603
- wp_cache_set( 'bp_activity_sitewide_front', $activity, 'bp' );
604
- }
605
- } else
606
- $activity = BP_Activity_Activity::get( $max, $page, $per_page, $sort, $search_terms, $filter, $display_comments, $show_hidden );
607
-
608
- return apply_filters( 'bp_activity_get', $activity, &$r );
609
- }
610
-
611
- function bp_activity_get_specific( $args = '' ) {
612
- $defaults = array(
613
- 'activity_ids' => false, // A single activity_id or array of IDs.
614
- 'page' => 1, // page 1 without a per_page will result in no pagination.
615
- 'per_page' => false, // results per page
616
- 'max' => false, // Maximum number of results to return
617
- 'sort' => 'DESC', // sort ASC or DESC
618
- 'display_comments' => false, // true or false to display threaded comments for these specific activity items
619
- 'show_hidden' => false
620
- );
621
-
622
- $r = wp_parse_args( $args, $defaults );
623
- extract( $r, EXTR_SKIP );
624
-
625
- return apply_filters( 'bp_activity_get_specific', BP_Activity_Activity::get_specific( $activity_ids, $max, $page, $per_page, $sort, $display_comments, $show_hidden ) );
626
- }
627
-
628
- function bp_activity_add( $args = '' ) {
629
- global $bp;
630
-
631
- $defaults = array(
632
- 'id' => false, // Pass an existing activity ID to update an existing entry.
633
-
634
- 'action' => '', // The activity action - e.g. "Jon Doe posted an update"
635
- 'content' => '', // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!"
636
-
637
- 'component' => false, // The name/ID of the component e.g. groups, profile, mycomponent
638
- 'type' => false, // The activity type e.g. activity_update, profile_updated
639
- 'primary_link' => '', // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink)
640
-
641
- 'user_id' => $bp->loggedin_user->id, // Optional: The user to record the activity for, can be false if this activity is not for a user.
642
- 'item_id' => false, // Optional: The ID of the specific item being recorded, e.g. a blog_id
643
- 'secondary_item_id' => false, // Optional: A second ID used to further filter e.g. a comment_id
644
- 'recorded_time' => bp_core_current_time(), // The GMT time that this activity was recorded
645
- 'hide_sitewide' => false // Should this be hidden on the sitewide activity stream?
646
- );
647
-
648
- $params = wp_parse_args( $args, $defaults );
649
- extract( $params, EXTR_SKIP );
650
-
651
- /* Make sure we are backwards compatible */
652
- if ( empty( $component ) && !empty( $component_name ) )
653
- $component = $component_name;
654
-
655
- if ( empty( $type ) && !empty( $component_action ) )
656
- $type = $component_action;
657
-
658
- $activity = new BP_Activity_Activity( $id );
659
-
660
- $activity->user_id = $user_id;
661
- $activity->component = $component;
662
- $activity->type = $type;
663
- $activity->action = $action;
664
- $activity->content = $content;
665
- $activity->primary_link = $primary_link;
666
- $activity->item_id = $item_id;
667
- $activity->secondary_item_id = $secondary_item_id;
668
- $activity->date_recorded = $recorded_time;
669
- $activity->hide_sitewide = $hide_sitewide;
670
-
671
- if ( !$activity->save() )
672
- return false;
673
-
674
- /* If this is an activity comment, rebuild the tree */
675
- if ( 'activity_comment' == $activity->type )
676
- BP_Activity_Activity::rebuild_activity_comment_tree( $activity->item_id );
677
-
678
- wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
679
- do_action( 'bp_activity_add', $params );
680
-
681
- return $activity->id;
682
- }
683
-
684
- function bp_activity_post_update( $args = '' ) {
685
- global $bp;
686
-
687
- $defaults = array(
688
- 'content' => false,
689
- 'user_id' => $bp->loggedin_user->id
690
- );
691
-
692
- $r = wp_parse_args( $args, $defaults );
693
- extract( $r, EXTR_SKIP );
694
-
695
- if ( empty( $content ) || !strlen( trim( $content ) ) )
696
- return false;
697
-
698
- /* Record this on the user's profile */
699
- $from_user_link = bp_core_get_userlink( $user_id );
700
- $activity_action = sprintf( __( '%s posted an update:', 'buddypress' ), $from_user_link );
701
- $activity_content = $content;
702
-
703
- $primary_link = bp_core_get_userlink( $user_id, false, true );
704
-
705
- /* Now write the values */
706
- $activity_id = bp_activity_add( array(
707
- 'user_id' => $user_id,
708
- 'action' => apply_filters( 'bp_activity_new_update_action', $activity_action ),
709
- 'content' => apply_filters( 'bp_activity_new_update_content', $activity_content ),
710
- 'primary_link' => apply_filters( 'bp_activity_new_update_primary_link', $primary_link ),
711
- 'component' => $bp->activity->id,
712
- 'type' => 'activity_update'
713
- ) );
714
-
715
- /* Add this update to the "latest update" usermeta so it can be fetched anywhere. */
716
- update_user_meta( $bp->loggedin_user->id, 'bp_latest_update', array( 'id' => $activity_id, 'content' => wp_filter_kses( $content ) ) );
717
-
718
- /* Require the notifications code so email notifications can be set on the 'bp_activity_posted_update' action. */
719
- require_once( BP_PLUGIN_DIR . '/bp-activity/bp-activity-notifications.php' );
720
-
721
- do_action( 'bp_activity_posted_update', $content, $user_id, $activity_id );
722
-
723
- return $activity_id;
724
- }
725
-
726
- function bp_activity_new_comment( $args = '' ) {
727
- global $bp;
728
-
729
- $defaults = array(
730
- 'id' => false,
731
- 'content' => false,
732
- 'user_id' => $bp->loggedin_user->id,
733
- 'activity_id' => false, // ID of the root activity item
734
- 'parent_id' => false // ID of a parent comment (optional)
735
- );
736
-
737
- $params = wp_parse_args( $args, $defaults );
738
- extract( $params, EXTR_SKIP );
739
-
740
- if ( empty($content) || empty($user_id) || empty($activity_id) )
741
- return false;
742
-
743
- if ( empty($parent_id) )
744
- $parent_id = $activity_id;
745
-
746
- /* Check to see if the parent activity is hidden, and if so, hide this comment publically. */
747
- $activity = new BP_Activity_Activity( $activity_id );
748
- $is_hidden = ( (int)$activity->hide_sitewide ) ? 1 : 0;
749
-
750
- /* Insert the activity comment */
751
- $comment_id = bp_activity_add( array(
752
- 'id' => $id,
753
- 'action' => apply_filters( 'bp_activity_comment_action', sprintf( __( '%s posted a new activity comment:', 'buddypress' ), bp_core_get_userlink( $user_id ) ) ),
754
- 'content' => apply_filters( 'bp_activity_comment_content', $content ),
755
- 'component' => $bp->activity->id,
756
- 'type' => 'activity_comment',
757
- 'user_id' => $user_id,
758
- 'item_id' => $activity_id,
759
- 'secondary_item_id' => $parent_id,
760
- 'hide_sitewide' => $is_hidden
761
- ) );
762
-
763
- /* Send an email notification if settings allow */
764
- require_once( BP_PLUGIN_DIR . '/bp-activity/bp-activity-notifications.php' );
765
- bp_activity_new_comment_notification( $comment_id, $user_id, $params );
766
-
767
- /* Clear the comment cache for this activity */
768
- wp_cache_delete( 'bp_activity_comments_' . $parent_id );
769
-
770
- do_action( 'bp_activity_comment_posted', $comment_id, $params );
771
-
772
- return $comment_id;
773
- }
774
-
775
- /**
776
- * bp_activity_get_activity_id()
777
- *
778
- * Fetch the activity_id for an existing activity entry in the DB.
779
- *
780
- * @package BuddyPress Activity
781
- */
782
- function bp_activity_get_activity_id( $args = '' ) {
783
- $defaults = array(
784
- 'user_id' => false,
785
- 'component' => false,
786
- 'type' => false,
787
- 'item_id' => false,
788
- 'secondary_item_id' => false,
789
- 'action' => false,
790
- 'content' => false,
791
- 'date_recorded' => false,
792
- );
793
-
794
- $r = wp_parse_args( $args, $defaults );
795
- extract( $r, EXTR_SKIP );
796
-
797
- return apply_filters( 'bp_activity_get_activity_id', BP_Activity_Activity::get_id( $user_id, $component, $type, $item_id, $secondary_item_id, $action, $content, $date_recorded ) );
798
- }
799
-
800
- /***
801
- * Deleting Activity
802
- *
803
- * If you're looking to hook into one action that provides the ID(s) of
804
- * the activity/activities deleted, then use:
805
- *
806
- * add_action( 'bp_activity_deleted_activities', 'my_function' );
807
- *
808
- * The action passes one parameter that is a single activity ID or an
809
- * array of activity IDs depending on the number deleted.
810
- *
811
- * If you are deleting an activity comment please use bp_activity_delete_comment();
812
- */
813
-
814
- function bp_activity_delete( $args = '' ) {
815
- global $bp;
816
-
817
- /* Pass one or more the of following variables to delete by those variables */
818
- $defaults = array(
819
- 'id' => false,
820
- 'action' => false,
821
- 'content' => false,
822
- 'component' => false,
823
- 'type' => false,
824
- 'primary_link' => false,
825
- 'user_id' => false,
826
- 'item_id' => false,
827
- 'secondary_item_id' => false,
828
- 'date_recorded' => false,
829
- 'hide_sitewide' => false
830
- );
831
-
832
- $args = wp_parse_args( $args, $defaults );
833
-
834
- if ( !$activity_ids_deleted = BP_Activity_Activity::delete( $args ) )
835
- return false;
836
-
837
- /* Check if the user's latest update has been deleted */
838
- if ( empty( $args['user_id'] ) )
839
- $user_id = $bp->loggedin_user->id;
840
- else
841
- $user_id = $args['user_id'];
842
-
843
- $latest_update = get_user_meta( $user_id, 'bp_latest_update', true );
844
- if ( !empty( $latest_update ) ) {
845
- if ( in_array( (int)$latest_update['id'], (array)$activity_ids_deleted ) )
846
- delete_user_meta( $user_id, 'bp_latest_update' );
847
- }
848
-
849
- do_action( 'bp_activity_delete', $args );
850
- do_action( 'bp_activity_deleted_activities', $activity_ids_deleted );
851
-
852
- wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
853
-
854
- return true;
855
- }
856
- /* The following functions have been deprecated in place of bp_activity_delete() */
857
- function bp_activity_delete_by_item_id( $args = '' ) {
858
- global $bp;
859
-
860
- $defaults = array( 'item_id' => false, 'component' => false, 'type' => false, 'user_id' => false, 'secondary_item_id' => false );
861
- $r = wp_parse_args( $args, $defaults );
862
- extract( $r, EXTR_SKIP );
863
-
864
- return bp_activity_delete( array( 'item_id' => $item_id, 'component' => $component, 'type' => $type, 'user_id' => $user_id, 'secondary_item_id' => $secondary_item_id ) );
865
- }
866
-
867
- function bp_activity_delete_by_activity_id( $activity_id ) {
868
- return bp_activity_delete( array( 'id' => $activity_id ) );
869
- }
870
-
871
- function bp_activity_delete_by_content( $user_id, $content, $component, $type ) {
872
- return bp_activity_delete( array( 'user_id' => $user_id, 'content' => $content, 'component' => $component, 'type' => $type ) );
873
- }
874
-
875
- function bp_activity_delete_for_user_by_component( $user_id, $component ) {
876
- return bp_activity_delete( array( 'user_id' => $user_id, 'component' => $component ) );
877
- }
878
- /* End deprecation */
879
-
880
- function bp_activity_delete_comment( $activity_id, $comment_id ) {
881
- /***
882
- * You may want to hook into this filter if you want to override this function and
883
- * handle the deletion of child comments differently. Make sure you return false.
884
- */
885
- if ( !apply_filters( 'bp_activity_delete_comment_pre', true, $activity_id, $comment_id ) )
886
- return false;
887
-
888
- /* Delete any children of this comment. */
889
- bp_activity_delete_children( $activity_id, $comment_id );
890
-
891
- /* Delete the actual comment */
892
- if ( !bp_activity_delete( array( 'id' => $comment_id, 'type' => 'activity_comment' ) ) )
893
- return false;
894
-
895
- /* Recalculate the comment tree */
896
- BP_Activity_Activity::rebuild_activity_comment_tree( $activity_id );
897
-
898
- do_action( 'bp_activity_delete_comment', $activity_id, $comment_id );
899
-
900
- return true;
901
- }
902
- function bp_activity_delete_children( $activity_id, $comment_id) {
903
- /* Recursively delete all children of this comment. */
904
- if ( $children = BP_Activity_Activity::get_child_comments( $comment_id ) ) {
905
- foreach( (array)$children as $child )
906
- bp_activity_delete_children( $activity_id, $child->id );
907
- }
908
- bp_activity_delete( array( 'secondary_item_id' => $comment_id, 'type' => 'activity_comment', 'item_id' => $activity_id ) );
909
- }
910
-
911
- function bp_activity_get_permalink( $activity_id, $activity_obj = false ) {
912
- global $bp;
913
-
914
- if ( !$activity_obj )
915
- $activity_obj = new BP_Activity_Activity( $activity_id );
916
-
917
- if ( 'new_blog_post' == $activity_obj->type || 'new_blog_comment' == $activity_obj->type || 'new_forum_topic' == $activity_obj->type || 'new_forum_post' == $activity_obj->type )
918
- $link = $activity_obj->primary_link;
919
- else {
920
- if ( 'activity_comment' == $activity_obj->type )
921
- $link = $bp->root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $activity_obj->item_id . '/';
922
- else
923
- $link = $bp->root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $activity_obj->id . '/';
924
- }
925
-
926
- return apply_filters( 'bp_activity_get_permalink', $link );
927
- }
928
-
929
- function bp_activity_hide_user_activity( $user_id ) {
930
- return BP_Activity_Activity::hide_all_for_user( $user_id );
931
- }
932
-
933
- /**
934
- * bp_activity_thumbnail_content_images()
935
- *
936
- * Take content, remove all images and replace them with one thumbnail image.
937
- *
938
- * @package BuddyPress Activity
939
- * @param $content str - The content to work with
940
- * @return $content str - The content with images stripped and replaced with a single thumb.
941
- */
942
- function bp_activity_thumbnail_content_images( $content ) {
943
- preg_match_all( '/<img[^>]*>/Ui', $content, $matches );
944
- $content = preg_replace('/<img[^>]*>/Ui', '', $content );
945
-
946
- if ( !empty( $matches ) ) {
947
- /* Get the SRC value */
948
- preg_match( '/<img.*?(src\=[\'|"]{0,1}.*?[\'|"]{0,1})[\s|>]{1}/i', $matches[0][0], $src );
949
-
950
- /* Get the width and height */
951
- preg_match( '/<img.*?(height\=[\'|"]{0,1}.*?[\'|"]{0,1})[\s|>]{1}/i', $matches[0][0], $height );
952
- preg_match( '/<img.*?(width\=[\'|"]{0,1}.*?[\'|"]{0,1})[\s|>]{1}/i', $matches[0][0], $width );
953
-
954
- if ( !empty( $src ) ) {
955
- $src = substr( substr( str_replace( 'src=', '', $src[1] ), 0, -1 ), 1 );
956
- $height = substr( substr( str_replace( 'height=', '', $height[1] ), 0, -1 ), 1 );
957
- $width = substr( substr( str_replace( 'width=', '', $width[1] ), 0, -1 ), 1 );
958
-
959
- if ( empty( $width ) || empty( $height ) ) {
960
- $width = 100;
961
- $height = 100;
962
- }
963
-
964
- $ratio = (int)$width / (int)$height;
965
- $new_height = 100;
966
- $new_width = $new_height * $ratio;
967
-
968
- $content = '<img src="' . esc_attr( $src) . '" width="' . $new_width . '" height="' . $new_height . '" alt="' . __( 'Thumbnail', 'buddypress' ) . '" class="align-left thumbnail" />' . $content;
969
- }
970
- }
971
-
972
- return apply_filters( 'bp_activity_thumbnail_content_images', $content, $matches );
973
- }
974
-
975
- function bp_activity_set_action( $component_id, $key, $value ) {
976
- global $bp;
977
-
978
- if ( empty( $component_id ) || empty( $key ) || empty( $value ) )
979
- return false;
980
-
981
- $bp->activity->actions->{$component_id}->{$key} = apply_filters( 'bp_activity_set_action', array(
982
- 'key' => $key,
983
- 'value' => $value
984
- ), $component_id, $key, $value );
985
- }
986
-
987
- function bp_activity_get_action( $component_id, $key ) {
988
- global $bp;
989
-
990
- if ( empty( $component_id ) || empty( $key ) )
991
- return false;
992
-
993
- return apply_filters( 'bp_activity_get_action', $bp->activity->actions->{$component_id}->{$key}, $component_id, $key );
994
- }
995
-
996
- function bp_activity_get_user_favorites( $user_id ) {
997
- $my_favs = maybe_unserialize( get_user_meta( $user_id, 'bp_favorite_activities', true ) );
998
- $existing_favs = bp_activity_get_specific( array( 'activity_ids' => $my_favs, 'show_hidden' => true ) );
999
-
1000
- foreach( (array)$existing_favs['activities'] as $fav )
1001
- $new_favs[] = $fav->id;
1002
-
1003
- $new_favs = array_unique( (array)$new_favs );
1004
- update_user_meta( $user_id, 'bp_favorite_activities', $new_favs );
1005
-
1006
- return apply_filters( 'bp_activity_get_user_favorites', $new_favs );
1007
- }
1008
-
1009
- function bp_activity_add_user_favorite( $activity_id, $user_id = false ) {
1010
- global $bp;
1011
-
1012
- if ( !$user_id )
1013
- $user_id = $bp->loggedin_user->id;
1014
-
1015
- /* Update the user's personal favorites */
1016
- $my_favs = maybe_unserialize( get_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', true ) );
1017
- $my_favs[] = $activity_id;
1018
-
1019
- /* Update the total number of users who have favorited this activity */
1020
- $fav_count = bp_activity_get_meta( $activity_id, 'favorite_count' );
1021
-
1022
- if ( !empty( $fav_count ) )
1023
- $fav_count = (int)$fav_count + 1;
1024
- else
1025
- $fav_count = 1;
1026
-
1027
- update_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', $my_favs );
1028
- bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count );
1029
-
1030
- do_action( 'bp_activity_add_user_favorite', $activity_id, $user_id );
1031
-
1032
- return true;
1033
- }
1034
-
1035
- function bp_activity_remove_user_favorite( $activity_id, $user_id = false ) {
1036
- global $bp;
1037
-
1038
- if ( !$user_id )
1039
- $user_id = $bp->loggedin_user->id;
1040
-
1041
- /* Remove the fav from the user's favs */
1042
- $my_favs = maybe_unserialize( get_user_meta( $user_id, 'bp_favorite_activities', true ) );
1043
- $my_favs = array_flip( (array) $my_favs );
1044
- unset( $my_favs[$activity_id] );
1045
- $my_favs = array_unique( array_flip( $my_favs ) );
1046
-
1047
- /* Update the total number of users who have favorited this activity */
1048
- $fav_count = bp_activity_get_meta( $activity_id, 'favorite_count' );
1049
-
1050
- if ( !empty( $fav_count ) ) {
1051
- $fav_count = (int)$fav_count - 1;
1052
- bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count );
1053
- }
1054
-
1055
- update_user_meta( $user_id, 'bp_favorite_activities', $my_favs );
1056
-
1057
- do_action( 'bp_activity_remove_user_favorite', $activity_id, $user_id );
1058
-
1059
- return true;
1060
- }
1061
-
1062
- function bp_activity_check_exists_by_content( $content ) {
1063
- return apply_filters( 'bp_activity_check_exists_by_content', BP_Activity_Activity::check_exists_by_content( $content ) );
1064
- }
1065
-
1066
- function bp_activity_get_last_updated() {
1067
- return apply_filters( 'bp_activity_get_last_updated', BP_Activity_Activity::get_last_updated() );
1068
- }
1069
-
1070
- function bp_activity_total_favorites_for_user( $user_id = false ) {
1071
- global $bp;
1072
-
1073
- if ( !$user_id )
1074
- $user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id;
1075
-
1076
- return BP_Activity_Activity::total_favorite_count( $user_id );
1077
- }
1078
-
1079
- /********************************************************************************
1080
- * Activity Meta Functions
1081
- *
1082
- * Meta functions allow you to store extra data for a particular item.
1083
- */
1084
-
1085
- function bp_activity_delete_meta( $activity_id, $meta_key = false, $meta_value = false ) {
1086
- global $wpdb, $bp;
1087
-
1088
- if ( !is_numeric( $activity_id ) )
1089
- return false;
1090
-
1091
- $meta_key = preg_replace( '|[^a-z0-9_]|i', '', $meta_key );
1092
-
1093
- if ( is_array( $meta_value ) || is_object( $meta_value ) )
1094
- $meta_value = serialize( $meta_value );
1095
-
1096
- $meta_value = trim( $meta_value );
1097
-
1098
- if ( !$meta_key ) {
1099
- $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id = %d", $activity_id ) );
1100
- } else if ( $meta_value ) {
1101
- $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id = %d AND meta_key = %s AND meta_value = %s", $activity_id, $meta_key, $meta_value ) );
1102
- } else {
1103
- $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id = %d AND meta_key = %s", $activity_id, $meta_key ) );
1104
- }
1105
-
1106
- wp_cache_delete( 'bp_activity_meta_' . $meta_key . '_' . $activity_id, 'bp' );
1107
-
1108
- return true;
1109
- }
1110
-
1111
- function bp_activity_get_meta( $activity_id, $meta_key = '' ) {
1112
- global $wpdb, $bp;
1113
-
1114
- $activity_id = (int)$activity_id;
1115
-
1116
- if ( !$activity_id )
1117
- return false;
1118
-
1119
- if ( !empty($meta_key) ) {
1120
- $meta_key = preg_replace( '|[^a-z0-9_]|i', '', $meta_key );
1121
-
1122
- if ( !$metas = wp_cache_get( 'bp_activity_meta_' . $meta_key . '_' . $activity_id, 'bp' ) ) {
1123
- $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM {$bp->activity->table_name_meta} WHERE activity_id = %d AND meta_key = %s", $activity_id, $meta_key ) );
1124
- wp_cache_set( 'bp_activity_meta_' . $meta_key . '_' . $activity_id, $metas, 'bp' );
1125
- }
1126
- } else
1127
- $metas = $wpdb->get_col( $wpdb->prepare( "SELECT meta_value FROM {$bp->activity->table_name_meta} WHERE activity_id = %d", $activity_id ) );
1128
-
1129
- if ( empty($metas) )
1130
- return false;
1131
-
1132
- $metas = array_map( 'maybe_unserialize', (array)$metas );
1133
-
1134
- if ( 1 == count($metas) )
1135
- return $metas[0];
1136
- else
1137
- return $metas;
1138
- }
1139
-
1140
- function bp_activity_update_meta( $activity_id, $meta_key, $meta_value ) {
1141
- global $wpdb, $bp;
1142
-
1143
- if ( !is_numeric( $activity_id ) )
1144
- return false;
1145
-
1146
- $meta_key = preg_replace( '|[^a-z0-9_]|i', '', $meta_key );
1147
-
1148
- if ( is_string( $meta_value ) )
1149
- $meta_value = stripslashes( $wpdb->escape( $meta_value ) );
1150
-
1151
- $meta_value = maybe_serialize( $meta_value );
1152
-
1153
- if ( empty( $meta_value ) ) {
1154
- return bp_activity_delete_meta( $activity_id, $meta_key );
1155
- }
1156
-
1157
- $cur = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name_meta} WHERE activity_id = %d AND meta_key = %s", $activity_id, $meta_key ) );
1158
-
1159
- if ( !$cur ) {
1160
- $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->activity->table_name_meta} ( activity_id, meta_key, meta_value ) VALUES ( %d, %s, %s )", $activity_id, $meta_key, $meta_value ) );
1161
- } else if ( $cur->meta_value != $meta_value ) {
1162
- $wpdb->query( $wpdb->prepare( "UPDATE {$bp->activity->table_name_meta} SET meta_value = %s WHERE activity_id = %d AND meta_key = %s", $meta_value, $activity_id, $meta_key ) );
1163
- } else {
1164
- return false;
1165
- }
1166
-
1167
- wp_cache_set( 'bp_activity_meta_' . $meta_key . '_' . $activity_id, $meta_value, 'bp' );
1168
-
1169
- return true;
1170
- }
1171
-
1172
- function bp_activity_remove_data( $user_id ) {
1173
- // Clear the user's activity from the sitewide stream and clear their activity tables
1174
- bp_activity_delete( array( 'user_id' => $user_id ) );
1175
-
1176
- // Remove any usermeta
1177
- delete_user_meta( $user_id, 'bp_latest_update' );
1178
- delete_user_meta( $user_id, 'bp_favorite_activities' );
1179
-
1180
- do_action( 'bp_activity_remove_data', $user_id );
1181
- }
1182
- add_action( 'wpmu_delete_user', 'bp_activity_remove_data' );
1183
- add_action( 'delete_user', 'bp_activity_remove_data' );
1184
- add_action( 'make_spam_user', 'bp_activity_remove_data' );
1185
-
1186
- /**
1187
- * updates_register_activity_actions()
1188
- *
1189
- * Register the activity stream actions for updates
1190
- *
1191
- * @global array $bp
1192
- */
1193
- function updates_register_activity_actions() {
1194
- global $bp;
1195
-
1196
- bp_activity_set_action( $bp->activity->id, 'activity_update', __( 'Posted an update', 'buddypress' ) );
1197
-
1198
- do_action( 'updates_register_activity_actions' );
1199
- }
1200
- add_action( 'bp_register_activity_actions', 'updates_register_activity_actions' );
1201
-
1202
- /********************************************************************************
1203
- * Custom Actions
1204
- *
1205
- * Functions to set up custom BuddyPress actions that all other components can
1206
- * hook in to.
1207
- */
1208
-
1209
- /* Allow core components and dependent plugins to register activity actions */
1210
- function bp_register_activity_actions() {
1211
- do_action( 'bp_register_activity_actions' );
1212
- }
1213
- add_action( 'bp_loaded', 'bp_register_activity_actions', 8 );
1214
-
1215
-
1216
- ?>
bp-activity/bp-activity-actions.php ADDED
@@ -0,0 +1,530 @@
1
+ <?php
2
+
3
+ /**
4
+ * Action functions are exactly the same as screen functions, however they do
5
+ * not have a template screen associated with them. Usually they will send the
6
+ * user back to the default screen after execution.
7
+ *
8
+ * @package BuddyPress
9
+ * @subpackage ActivityActions
10
+ */
11
+
12
+ // Exit if accessed directly
13
+ if ( !defined( 'ABSPATH' ) ) exit;
14
+
15
+ /**
16
+ * Allow core components and dependent plugins to register activity actions
17
+ *
18
+ * @since 1.2.0
19
+ *
20
+ * @uses do_action() To call 'bp_register_activity_actions' hook.
21
+ */
22
+ function bp_register_activity_actions() {
23
+ do_action( 'bp_register_activity_actions' );
24
+ }
25
+ add_action( 'bp_init', 'bp_register_activity_actions', 8 );
26
+
27
+ /**
28
+ * Allow core components and dependent plugins to register activity actions
29
+ *
30
+ * @since 1.2.0
31
+ *
32
+ * @global object $bp BuddyPress global settings
33
+ * @uses bp_is_activity_component()
34
+ * @uses bp_is_current_action()
35
+ * @uses bp_action_variable()
36
+ * @uses bp_activity_get_specific()
37
+ * @uses bp_is_active()
38
+ * @uses bp_core_get_user_domain()
39
+ * @uses groups_get_group()
40
+ * @uses bp_get_group_permalink()
41
+ * @uses apply_filters_ref_array() To call the 'bp_activity_permalink_redirect_url' hook
42
+ * @uses bp_core_redirect()
43
+ * @uses bp_get_root_domain()
44
+ *
45
+ * @return bool False on failure
46
+ */
47
+ function bp_activity_action_permalink_router() {
48
+ global $bp;
49
+
50
+ // Not viewing activity
51
+ if ( !bp_is_activity_component() || !bp_is_current_action( 'p' ) )
52
+ return false;
53
+
54
+ // No activity to display
55
+ if ( !bp_action_variable( 0 ) || !is_numeric( bp_action_variable( 0 ) ) )
56
+ return false;
57
+
58
+ // Get the activity details
59
+ $activity = bp_activity_get_specific( array( 'activity_ids' => bp_action_variable( 0 ), 'show_hidden' => true ) );
60
+
61
+ // 404 if activity does not exist
62
+ if ( empty( $activity['activities'][0] ) ) {
63
+ bp_do_404();
64
+ return;
65
+
66
+ } else {
67
+ $activity = $activity['activities'][0];
68
+ }
69
+
70
+ // Do not redirect at default
71
+ $redirect = false;
72
+
73
+ // Redirect based on the type of activity
74
+ if ( bp_is_active( 'groups' ) && $activity->component == $bp->groups->id ) {
75
+
76
+ // Activity is a user update
77
+ if ( !empty( $activity->user_id ) ) {
78
+ $redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id . '/';
79
+
80
+ // Activity is something else
81
+ } else {
82
+
83
+ // Set redirect to group activity stream
84
+ if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) ) {
85
+ $redirect = bp_get_group_permalink( $group ) . bp_get_activity_slug() . '/' . $activity->id . '/';
86
+ }
87
+ }
88
+
89
+ // Set redirect to users' activity stream
90
+ } else {
91
+ $redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id;
92
+ }
93
+
94
+ // Allow redirect to be filtered
95
+ if ( !$redirect = apply_filters_ref_array( 'bp_activity_permalink_redirect_url', array( $redirect, &$activity ) ) )
96
+ bp_core_redirect( bp_get_root_domain() );
97
+
98
+ // Redirect to the actual activity permalink page
99
+ bp_core_redirect( $redirect );
100
+ }
101
+ add_action( 'bp_actions', 'bp_activity_action_permalink_router' );
102
+
103
+ /**
104
+ * Delete specific activity item and redirect to previous page.
105
+ *
106
+ * @since 1.1.0
107
+ *
108
+ * @param int $activity_id Activity id to be deleted. Defaults to 0.
109
+ *
110
+ * @global object $bp BuddyPress global settings
111
+ * @uses bp_is_activity_component()
112
+ * @uses bp_is_current_action()
113
+ * @uses bp_action_variable()
114
+ * @uses check_admin_referer()
115
+ * @uses bp_activity_user_can_delete()
116
+ * @uses do_action() Calls 'bp_activity_before_action_delete_activity' hook to allow actions to be taken before the activity is deleted.
117
+ * @uses bp_activity_delete()
118
+ * @uses bp_core_add_message()
119
+ * @uses do_action() Calls 'bp_activity_action_delete_activity' hook to allow actions to be taken after the activity is deleted.
120
+ * @uses bp_core_redirect()
121
+ *
122
+ * @return bool False on failure
123
+ */
124
+ function bp_activity_action_delete_activity( $activity_id = 0 ) {
125
+ global $bp;
126
+
127
+ // Not viewing activity or action is not delete
128
+ if ( !bp_is_activity_component() || !bp_is_current_action( 'delete' ) )
129
+ return false;
130