BuddyPress - Version 1.1.3

Version Description

Download this release

Release Info

Developer apeatling
Plugin Icon 128x128 BuddyPress
Version 1.1.3
Comparing to
See all releases

Code changes from version 1.1.2 to 1.1.3

Files changed (362) hide show
  1. bp-activity.php +58 -52
  2. bp-activity/bp-activity-classes.php +80 -80
  3. bp-activity/bp-activity-filters.php +2 -2
  4. bp-activity/bp-activity-templatetags.php +55 -58
  5. bp-activity/bp-activity-widgets.php +10 -10
  6. bp-activity/deprecated/bp-activity-deprecated.php +17 -17
  7. bp-activity/deprecated/css/structure.css +0 -0
  8. bp-activity/deprecated/images/rss.png +0 -0
  9. bp-activity/feeds/bp-activity-friends-feed.php +0 -0
  10. bp-activity/feeds/bp-activity-personal-feed.php +0 -0
  11. bp-activity/feeds/bp-activity-sitewide-feed.php +0 -0
  12. bp-blogs.php +109 -105
  13. bp-blogs/admin-tabs/admin.css +0 -0
  14. bp-blogs/admin-tabs/bp-blogs-comments-tab.php +0 -0
  15. bp-blogs/admin-tabs/bp-blogs-posts-tab.php +0 -0
  16. bp-blogs/admin-tabs/bp-blogs-tab.php +0 -0
  17. bp-blogs/bp-blogs-classes.php +17 -17
  18. bp-blogs/bp-blogs-templatetags.php +1 -1
  19. bp-blogs/bp-blogs-widgets.php +0 -0
  20. bp-blogs/deprecated/bp-blogs-deprecated.php +0 -0
  21. bp-blogs/deprecated/css/structure.css +0 -0
  22. bp-blogs/deprecated/js/directory-blogs.js +0 -0
  23. bp-core.php +216 -218
  24. bp-core/bp-core-activation.php +77 -35
  25. bp-core/bp-core-admin.php +50 -50
  26. bp-core/bp-core-adminbar.php +58 -58
  27. bp-core/bp-core-avatars.php +98 -82
  28. bp-core/bp-core-catchuri.php +29 -29
  29. bp-core/bp-core-classes.php +84 -84
  30. bp-core/bp-core-cssjs.php +22 -22
  31. bp-core/bp-core-notifications.php +16 -16
  32. bp-core/bp-core-settings.php +38 -38
  33. bp-core/bp-core-signup.php +43 -47
  34. bp-core/bp-core-templatetags.php +296 -287
  35. bp-core/bp-core-widgets.php +30 -30
  36. bp-core/css/widget-members.css +0 -0
  37. bp-core/deprecated/bp-core-deprecated.php +104 -154
  38. bp-core/deprecated/css/admin-bar.css +0 -0
  39. bp-core/deprecated/css/structure.css +0 -0
  40. bp-core/deprecated/images/accept_button_side.gif +0 -0
  41. bp-core/deprecated/images/add_button_side.gif +0 -0
  42. bp-core/deprecated/images/add_friend_button.gif +0 -0
  43. bp-core/deprecated/images/admin-menu-arrow.gif +0 -0
  44. bp-core/deprecated/images/admin_bar_back.gif +0 -0
  45. bp-core/deprecated/images/admin_bar_logo.gif +0 -0
  46. bp-core/deprecated/images/ajax-loader.gif +0 -0
  47. bp-core/deprecated/images/blog.png +0 -0
  48. bp-core/deprecated/images/button_back.gif +0 -0
  49. bp-core/deprecated/images/check_button_side.gif +0 -0
  50. bp-core/deprecated/images/loading_button_side.gif +0 -0
  51. bp-core/deprecated/images/logout_bullet.gif +0 -0
  52. bp-core/deprecated/images/member.png +0 -0
  53. bp-core/deprecated/images/nav_bullet.gif +0 -0
  54. bp-core/deprecated/images/reject_button_side.gif +0 -0
  55. bp-core/deprecated/images/remove_button_side.gif +0 -0
  56. bp-core/deprecated/images/remove_friend_button.gif +0 -0
  57. bp-core/deprecated/images/requested_friend_button.gif +0 -0
  58. bp-core/deprecated/images/view_button_side.gif +0 -0
  59. bp-core/deprecated/js/directory-members.js +0 -0
  60. bp-core/deprecated/js/general.js +0 -0
  61. bp-core/deprecated/js/jquery/jquery.livequery.pack.js +0 -0
  62. bp-core/deprecated/js/jquery/jquery.tablednd.js +0 -0
  63. bp-core/images/Jcrop.gif +0 -0
  64. bp-core/images/admin_menu_icon.png +0 -0
  65. bp-core/images/mystery-man.jpg +0 -0
  66. bp-core/js/admin-bar.js +0 -0
  67. bp-core/js/widget-members.js +0 -0
  68. bp-forums.php +64 -64
  69. bp-forums/bb-config.php +0 -0
  70. bp-forums/bbpress/bb-admin/admin-base.php +1 -5
  71. bp-forums/bbpress/bb-admin/admin.php +1 -9
  72. bp-forums/bbpress/bb-admin/includes/class.bb-install.php +0 -3
  73. bp-forums/bbpress/bb-admin/includes/defaults.bb-schema.php +27 -43
  74. bp-forums/bbpress/bb-admin/includes/functions.bb-admin.php +2 -21
  75. bp-forums/bbpress/bb-admin/includes/functions.bb-recount.php +0 -262
  76. bp-forums/bbpress/bb-admin/includes/functions.bb-upgrade.php +7 -20
  77. bp-forums/bbpress/bb-admin/index.php +18 -22
  78. bp-forums/bbpress/bb-admin/tools-recount.php +132 -27
  79. bp-forums/bbpress/bb-cron.php +14 -11
  80. bp-forums/bbpress/bb-includes/backpress/functions.formatting.php +4 -6
  81. bp-forums/bbpress/bb-includes/backpress/functions.kses.php +64 -705
  82. bp-forums/bbpress/bb-includes/class.bp-options.php +3 -0
  83. bp-forums/bbpress/bb-includes/functions.bb-core.php +31 -66
  84. bp-forums/bbpress/bb-includes/functions.bb-deprecated.php +2 -5
  85. bp-forums/bbpress/bb-includes/functions.bb-meta.php +1 -1
  86. bp-forums/bbpress/bb-includes/functions.bb-pluggable.php +14 -15
  87. bp-forums/bbpress/bb-includes/functions.bb-posts.php +0 -1
  88. bp-forums/bbpress/bb-includes/functions.bb-template.php +9 -8
  89. bp-forums/bbpress/bb-includes/functions.bb-users.php +40 -78
  90. bp-forums/bbpress/bb-includes/js/jquery/interface.js +1 -2
  91. bp-forums/bbpress/bb-login.php +60 -104
  92. bp-forums/bbpress/bb-templates/kakumei-blue/style.css +0 -2
  93. bp-forums/bbpress/bb-templates/kakumei/favorites.php +1 -1
  94. bp-forums/bbpress/bb-templates/kakumei/forum.php +2 -2
  95. bp-forums/bbpress/bb-templates/kakumei/front-page.php +2 -2
  96. bp-forums/bbpress/bb-templates/kakumei/post-form.php +2 -2
  97. bp-forums/bbpress/bb-templates/kakumei/style.css +1 -16
  98. bp-forums/bbpress/bb-templates/kakumei/tag-single.php +1 -1
  99. bp-forums/bbpress/bb-templates/kakumei/view.php +2 -2
  100. bp-forums/bbpress/rss.php +1 -1
  101. bp-forums/bp-forums-admin.php +30 -30
  102. bp-forums/bp-forums-bbpress.php +17 -17
  103. bp-forums/bp-forums-filters.php +2 -2
  104. bp-forums/bp-forums-templatetags.php +111 -111
  105. bp-forums/deprecated/images/closed.png +0 -0
  106. bp-friends.php +125 -126
  107. bp-friends/bp-friends-classes.php +79 -79
  108. bp-friends/bp-friends-notifications.php +13 -13
  109. bp-friends/bp-friends-templatetags.php +50 -50
  110. bp-friends/deprecated/bp-friends-deprecated.php +0 -0
  111. bp-friends/deprecated/css/structure.css +0 -0
  112. bp-friends/deprecated/images/ajax-loader.gif +0 -0
  113. bp-friends/deprecated/js/general.js +0 -0
  114. bp-groups.php +463 -459
  115. bp-groups/bp-groups-admin.php +10 -10
  116. bp-groups/bp-groups-classes.php +325 -316
  117. bp-groups/bp-groups-filters.php +5 -5
  118. bp-groups/bp-groups-notifications.php +40 -40
  119. bp-groups/bp-groups-templatetags.php +284 -284
  120. bp-groups/bp-groups-widgets.php +19 -19
  121. bp-groups/deprecated/bp-groups-deprecated.php +108 -108
  122. bp-groups/deprecated/css/structure.css +0 -0
  123. bp-groups/deprecated/images/ajax-loader.gif +0 -0
  124. bp-groups/deprecated/images/none-thumbnail.gif +0 -0
  125. bp-groups/deprecated/images/none.gif +0 -0
  126. bp-groups/deprecated/js/directory-groups.js +0 -0
  127. bp-groups/deprecated/js/general.js +0 -0
  128. bp-groups/js/widget-groups.js +0 -0
  129. bp-languages/buddypress.pot +0 -0
  130. bp-loader.php +6 -6
  131. bp-messages.php +84 -84
  132. bp-messages/bp-messages-classes.php +131 -131
  133. bp-messages/bp-messages-cssjs.php +5 -5
  134. bp-messages/bp-messages-filters.php +0 -0
  135. bp-messages/bp-messages-notifications.php +11 -11
  136. bp-messages/bp-messages-templatetags.php +89 -89
  137. bp-messages/css/autocomplete/jquery.autocompletefb.css +0 -0
  138. bp-messages/deprecated/bp-messages-deprecated.php +41 -41
  139. bp-messages/deprecated/css/structure.css +0 -0
  140. bp-messages/deprecated/images/ajax-loader.gif +0 -0
  141. bp-messages/deprecated/images/email.gif +0 -0
  142. bp-messages/deprecated/images/email_draft.gif +0 -0
  143. bp-messages/deprecated/images/email_open.gif +0 -0
  144. bp-messages/deprecated/images/email_sent.gif +0 -0
  145. bp-messages/deprecated/images/loading.gif +0 -0
  146. bp-messages/deprecated/images/nav_bullet.gif +0 -0
  147. bp-messages/deprecated/images/warning.gif +0 -0
  148. bp-messages/deprecated/js/general.js +0 -0
  149. bp-messages/js/autocomplete/jquery.autocomplete.js +0 -0
  150. bp-messages/js/autocomplete/jquery.autocompletefb.js +0 -0
  151. bp-messages/js/autocomplete/jquery.bgiframe.min.js +0 -0
  152. bp-messages/js/autocomplete/jquery.dimensions.js +0 -0
  153. bp-status.php +24 -24
  154. bp-status/bp-status-filters.php +0 -0
  155. bp-status/bp-status-templatetags.php +21 -21
  156. bp-status/bp-status-widgets.php +0 -0
  157. bp-themes/bp-default/_inc/css/adminbar.css +2 -2
  158. bp-themes/bp-default/_inc/css/screen.css +176 -173
  159. bp-themes/bp-default/_inc/images/accept_button.gif +0 -0
  160. bp-themes/bp-default/_inc/images/accept_button_side.gif +0 -0
  161. bp-themes/bp-default/_inc/images/activity_bullet.gif +0 -0
  162. bp-themes/bp-default/_inc/images/add_button_side.gif +0 -0
  163. bp-themes/bp-default/_inc/images/add_friend_button.gif +0 -0
  164. bp-themes/bp-default/_inc/images/add_friend_icon.gif +0 -0
  165. bp-themes/bp-default/_inc/images/admin-menu-arrow.gif +0 -0
  166. bp-themes/bp-default/_inc/images/admin_bar_back.gif +0 -0
  167. bp-themes/bp-default/_inc/images/admin_bar_logo.gif +0 -0
  168. bp-themes/bp-default/_inc/images/admin_menu_icon.png +0 -0
  169. bp-themes/bp-default/_inc/images/ajax-loader.gif +0 -0
  170. bp-themes/bp-default/_inc/images/arrowback_icon.gif +0 -0
  171. bp-themes/bp-default/_inc/images/background.gif +0 -0
  172. bp-themes/bp-default/_inc/images/background_blog.gif +0 -0
  173. bp-themes/bp-default/_inc/images/blog.png +0 -0
  174. bp-themes/bp-default/_inc/images/blog_bullet.gif +0 -0
  175. bp-themes/bp-default/_inc/images/blogadmin_icon.gif +0 -0
  176. bp-themes/bp-default/_inc/images/bp_logo.gif +0 -0
  177. bp-themes/bp-default/_inc/images/button_back.gif +0 -0
  178. bp-themes/bp-default/_inc/images/centercol_header_back.gif +0 -0
  179. bp-themes/bp-default/_inc/images/check_button_side.gif +0 -0
  180. bp-themes/bp-default/_inc/images/closed.png +0 -0
  181. bp-themes/bp-default/_inc/images/comments_icon.gif +0 -0
  182. bp-themes/bp-default/_inc/images/content_back.gif +0 -0
  183. bp-themes/bp-default/_inc/images/content_header.gif +0 -0
  184. bp-themes/bp-default/_inc/images/create_account_button.gif +0 -0
  185. bp-themes/bp-default/_inc/images/cross_bullet.gif +0 -0
  186. bp-themes/bp-default/_inc/images/error_back.gif +0 -0
  187. bp-themes/bp-default/_inc/images/error_icon.gif +0 -0
  188. bp-themes/bp-default/_inc/images/forum_bullet.gif +0 -0
  189. bp-themes/bp-default/_inc/images/friends_bullet.gif +0 -0
  190. bp-themes/bp-default/_inc/images/group_header.gif +0 -0
  191. bp-themes/bp-default/_inc/images/groups_bullet.gif +0 -0
  192. bp-themes/bp-default/_inc/images/info_icon.gif +0 -0
  193. bp-themes/bp-default/_inc/images/invite_bullet.gif +0 -0
  194. bp-themes/bp-default/_inc/images/item_list_back.gif +0 -0
  195. bp-themes/bp-default/_inc/images/leftcol_header_back.gif +0 -0
  196. bp-themes/bp-default/_inc/images/leftmenu_group_header.gif +0 -0
  197. bp-themes/bp-default/_inc/images/loading_button_side.gif +0 -0
  198. bp-themes/bp-default/_inc/images/logo.gif +0 -0
  199. bp-themes/bp-default/_inc/images/logout_bullet.gif +0 -0
  200. bp-themes/bp-default/_inc/images/member.png +0 -0
  201. bp-themes/bp-default/_inc/images/message_thread_back.gif +0 -0
  202. bp-themes/bp-default/_inc/images/message_thread_unread_back.gif +0 -0
  203. bp-themes/bp-default/_inc/images/messages_bullet.gif +0 -0
  204. bp-themes/bp-default/_inc/images/mystery-man.jpg +0 -0
  205. bp-themes/bp-default/_inc/images/nav_bullet.gif +0 -0
  206. bp-themes/bp-default/_inc/images/navitem_selected_back.gif +0 -0
  207. bp-themes/bp-default/_inc/images/notice_back.gif +0 -0
  208. bp-themes/bp-default/_inc/images/optionnavitem_selected_back.gif +0 -0
  209. bp-themes/bp-default/_inc/images/optionsbar_header_arrow.gif +0 -0
  210. bp-themes/bp-default/_inc/images/optionsbar_header_noarrow.gif +0 -0
  211. bp-themes/bp-default/_inc/images/profile_bullet.gif +0 -0
  212. bp-themes/bp-default/_inc/images/quotes_background.gif +0 -0
  213. bp-themes/bp-default/_inc/images/reject_button.gif +0 -0
  214. bp-themes/bp-default/_inc/images/reject_button_side.gif +0 -0
  215. bp-themes/bp-default/_inc/images/remove_button_side.gif +0 -0
  216. bp-themes/bp-default/_inc/images/remove_friend_button.gif +0 -0
  217. bp-themes/bp-default/_inc/images/request_bullet.gif +0 -0
  218. bp-themes/bp-default/_inc/images/requested_friend_button.gif +0 -0
  219. bp-themes/bp-default/_inc/images/rightcol_header_back.gif +0 -0
  220. bp-themes/bp-default/_inc/images/rss.png +0 -0
  221. bp-themes/bp-default/_inc/images/settings_bullet.gif +0 -0
  222. bp-themes/bp-default/_inc/images/sidebar_header.gif +0 -0
  223. bp-themes/bp-default/_inc/images/status_bullet.gif +0 -0
  224. bp-themes/bp-default/_inc/images/tag_icon.gif +0 -0
  225. bp-themes/bp-default/_inc/images/topoption_selected_back.gif +0 -0
  226. bp-themes/bp-default/_inc/images/updated_back.gif +0 -0
  227. bp-themes/bp-default/_inc/images/updated_icon.gif +0 -0
  228. bp-themes/bp-default/_inc/images/userbar_header.gif +0 -0
  229. bp-themes/bp-default/_inc/images/userbar_selected_arrow.gif +0 -0
  230. bp-themes/bp-default/_inc/images/view_button_side.gif +0 -0
  231. bp-themes/bp-default/_inc/images/welcome_header_back.gif +0 -0
  232. bp-themes/bp-default/_inc/images/wire_bullet.gif +0 -0
  233. bp-themes/bp-default/screenshot.png +0 -0
  234. bp-themes/bp-default/style.css +2 -2
  235. bp-themes/bp-sn-parent/404.php +7 -7
  236. bp-themes/bp-sn-parent/_inc/ajax.php +0 -0
  237. bp-themes/bp-sn-parent/_inc/css/adminbar.css +0 -0
  238. bp-themes/bp-sn-parent/_inc/css/components.css +0 -0
  239. bp-themes/bp-sn-parent/_inc/css/fonts/12px.css +2 -1
  240. bp-themes/bp-sn-parent/_inc/css/fonts/14px.css +0 -0
  241. bp-themes/bp-sn-parent/_inc/css/fonts/18px.css +0 -0
  242. bp-themes/bp-sn-parent/_inc/css/fonts/20px.css +0 -0
  243. bp-themes/bp-sn-parent/_inc/css/fonts/22px.css +0 -0
  244. bp-themes/bp-sn-parent/_inc/css/layout/blog-dir-pages/2c-center.css +0 -0
  245. bp-themes/bp-sn-parent/_inc/css/layout/blog-dir-pages/2c-left.css +0 -0
  246. bp-themes/bp-sn-parent/_inc/css/layout/blog-dir-pages/2c-right.css +0 -0
  247. bp-themes/bp-sn-parent/_inc/css/layout/home-page/1c.css +0 -0
  248. bp-themes/bp-sn-parent/_inc/css/layout/home-page/2c-center.css +0 -0
  249. bp-themes/bp-sn-parent/_inc/css/layout/home-page/2c-left.css +0 -0
  250. bp-themes/bp-sn-parent/_inc/css/layout/home-page/2c-right.css +0 -0
  251. bp-themes/bp-sn-parent/_inc/css/layout/home-page/3c-center.css +0 -0
  252. bp-themes/bp-sn-parent/_inc/css/layout/home-page/3c-left.css +0 -0
  253. bp-themes/bp-sn-parent/_inc/css/layout/home-page/3c-right.css +0 -0
  254. bp-themes/bp-sn-parent/_inc/css/layout/internal-pages/1c.css +0 -0
  255. bp-themes/bp-sn-parent/_inc/css/layout/internal-pages/2c-left.css +0 -0
  256. bp-themes/bp-sn-parent/_inc/css/layout/internal-pages/2c-right.css +0 -0
  257. bp-themes/bp-sn-parent/_inc/css/layout/internal-pages/3c-left.css +0 -0
  258. bp-themes/bp-sn-parent/_inc/css/layout/internal-pages/3c-right.css +0 -0
  259. bp-themes/bp-sn-parent/_inc/css/screen.css +0 -0
  260. bp-themes/bp-sn-parent/_inc/images/admin_bar_logo.gif +0 -0
  261. bp-themes/bp-sn-parent/_inc/images/ajax-loader.gif +0 -0
  262. bp-themes/bp-sn-parent/_inc/images/closed_topic.png +0 -0
  263. bp-themes/bp-sn-parent/_inc/images/mystery-man.jpg +0 -0
  264. bp-themes/bp-sn-parent/_inc/js/ajax.js +193 -184
  265. bp-themes/bp-sn-parent/_inc/js/jquery-livequery.js +0 -0
  266. bp-themes/bp-sn-parent/activity/just-me.php +11 -11
  267. bp-themes/bp-sn-parent/activity/my-friends.php +8 -8
  268. bp-themes/bp-sn-parent/archive.php +11 -11
  269. bp-themes/bp-sn-parent/attachment.php +7 -7
  270. bp-themes/bp-sn-parent/blogs/create.php +3 -3
  271. bp-themes/bp-sn-parent/blogs/my-blogs.php +6 -6
  272. bp-themes/bp-sn-parent/blogs/recent-comments.php +4 -4
  273. bp-themes/bp-sn-parent/blogs/recent-posts.php +13 -13
  274. bp-themes/bp-sn-parent/comments.php +4 -5
  275. bp-themes/bp-sn-parent/directories/blogs/blogs-loop.php +12 -12
  276. bp-themes/bp-sn-parent/directories/blogs/index.php +25 -25
  277. bp-themes/bp-sn-parent/directories/forums/forums-loop.php +17 -17
  278. bp-themes/bp-sn-parent/directories/forums/index.php +31 -31
  279. bp-themes/bp-sn-parent/directories/groups/groups-loop.php +12 -12
  280. bp-themes/bp-sn-parent/directories/groups/index.php +29 -29
  281. bp-themes/bp-sn-parent/directories/members/index.php +24 -24
  282. bp-themes/bp-sn-parent/directories/members/members-loop.php +10 -10
  283. bp-themes/bp-sn-parent/footer.php +6 -6
  284. bp-themes/bp-sn-parent/friends/friends-loop.php +24 -24
  285. bp-themes/bp-sn-parent/friends/index.php +5 -5
  286. bp-themes/bp-sn-parent/friends/requests.php +22 -22
  287. bp-themes/bp-sn-parent/functions.php +13 -13
  288. bp-themes/bp-sn-parent/groups/create.php +59 -59
  289. bp-themes/bp-sn-parent/groups/group-loop.php +18 -18
  290. bp-themes/bp-sn-parent/groups/index.php +4 -4
  291. bp-themes/bp-sn-parent/groups/invites.php +11 -11
  292. bp-themes/bp-sn-parent/groups/single/admin.php +97 -98
  293. bp-themes/bp-sn-parent/groups/single/forum/edit.php +0 -0
  294. bp-themes/bp-sn-parent/groups/single/forum/index.php +0 -0
  295. bp-themes/bp-sn-parent/groups/single/forum/topic.php +0 -0
  296. bp-themes/bp-sn-parent/groups/single/home.php +62 -62
  297. bp-themes/bp-sn-parent/groups/single/leave-confirm.php +10 -10
  298. bp-themes/bp-sn-parent/groups/single/members.php +23 -23
  299. bp-themes/bp-sn-parent/groups/single/menu.php +0 -0
  300. bp-themes/bp-sn-parent/groups/single/request-membership.php +7 -7
  301. bp-themes/bp-sn-parent/groups/single/send-invite.php +25 -25
  302. bp-themes/bp-sn-parent/groups/single/wire.php +9 -9
  303. bp-themes/bp-sn-parent/header.php +31 -32
  304. bp-themes/bp-sn-parent/home.php +7 -7
  305. bp-themes/bp-sn-parent/index.php +8 -8
  306. bp-themes/bp-sn-parent/links.php +2 -2
  307. bp-themes/bp-sn-parent/messages/compose.php +8 -8
  308. bp-themes/bp-sn-parent/messages/index.php +15 -15
  309. bp-themes/bp-sn-parent/messages/notices.php +13 -13
  310. bp-themes/bp-sn-parent/messages/sentbox.php +14 -14
  311. bp-themes/bp-sn-parent/messages/view.php +39 -39
  312. bp-themes/bp-sn-parent/optionsbar.php +4 -4
  313. bp-themes/bp-sn-parent/page.php +10 -10
  314. bp-themes/bp-sn-parent/plugin-template.php +1 -1
  315. bp-themes/bp-sn-parent/profile/change-avatar.php +22 -22
  316. bp-themes/bp-sn-parent/profile/edit.php +42 -42
  317. bp-themes/bp-sn-parent/profile/index.php +23 -23
  318. bp-themes/bp-sn-parent/profile/profile-header.php +2 -2
  319. bp-themes/bp-sn-parent/profile/profile-loop.php +20 -20
  320. bp-themes/bp-sn-parent/profile/profile-menu.php +7 -7
  321. bp-themes/bp-sn-parent/registration/activate.php +18 -18
  322. bp-themes/bp-sn-parent/registration/register.php +73 -73
  323. bp-themes/bp-sn-parent/screenshot.png +0 -0
  324. bp-themes/bp-sn-parent/search.php +7 -7
  325. bp-themes/bp-sn-parent/searchform.php +0 -0
  326. bp-themes/bp-sn-parent/sidebar.php +3 -3
  327. bp-themes/bp-sn-parent/single.php +8 -8
  328. bp-themes/bp-sn-parent/status/post-form.php +4 -4
  329. bp-themes/bp-sn-parent/style.css +2 -2
  330. bp-themes/bp-sn-parent/userbar.php +9 -9
  331. bp-themes/bp-sn-parent/wire/latest.php +0 -0
  332. bp-themes/bp-sn-parent/wire/post-form.php +0 -0
  333. bp-themes/bp-sn-parent/wire/post-list.php +0 -0
  334. bp-wire.php +0 -0
  335. bp-wire/bp-wire-classes.php +41 -41
  336. bp-wire/bp-wire-filters.php +2 -2
  337. bp-wire/bp-wire-templatetags.php +40 -40
  338. bp-wire/deprecated/bp-wire-deprecated.php +11 -11
  339. bp-wire/deprecated/css/structure.css +0 -0
  340. bp-wire/deprecated/images/ajax-loader.gif +0 -0
  341. bp-xprofile.php +162 -162
  342. bp-xprofile/admin/css/admin.css +0 -0
  343. bp-xprofile/admin/images/move.gif +0 -0
  344. bp-xprofile/admin/images/tick.gif +0 -0
  345. bp-xprofile/admin/js/admin.js +0 -0
  346. bp-xprofile/bp-xprofile-admin.php +59 -59
  347. bp-xprofile/bp-xprofile-classes.php +174 -174
  348. bp-xprofile/bp-xprofile-cssjs.php +0 -0
  349. bp-xprofile/bp-xprofile-filters.php +6 -6
  350. bp-xprofile/bp-xprofile-notifications.php +8 -8
  351. bp-xprofile/bp-xprofile-templatetags.php +109 -109
  352. bp-xprofile/deprecated/bp-xprofile-deprecated.php +158 -158
  353. bp-xprofile/deprecated/css/signup.css +0 -0
  354. bp-xprofile/deprecated/css/structure.css +0 -0
  355. bp-xprofile/deprecated/images/cross.gif +0 -0
  356. bp-xprofile/deprecated/images/nav_bullet.gif +0 -0
  357. bp-xprofile/deprecated/images/none-thumbnail.gif +0 -0
  358. bp-xprofile/deprecated/images/none.gif +0 -0
  359. bp-xprofile/deprecated/js/general.js +0 -0
  360. favicon.ico +0 -0
  361. license.txt +0 -0
  362. readme.txt +4 -4
bp-activity.php CHANGED
@@ -13,14 +13,14 @@ require ( BP_PLUGIN_DIR . '/bp-activity/bp-activity-filters.php' );
13
14
/* Include deprecated functions if settings allow */
15
if ( !defined( 'BP_IGNORE_DEPRECATED' ) )
16
- require ( BP_PLUGIN_DIR . '/bp-activity/deprecated/bp-activity-deprecated.php' );
17
-
18
function bp_activity_install() {
19
global $wpdb, $bp;
20
-
21
if ( !empty($wpdb->charset) )
22
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
23
-
24
$sql[] = "CREATE TABLE {$bp->activity->table_name} (
25
id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
26
user_id bigint(20) NOT NULL,
@@ -40,11 +40,11 @@ function bp_activity_install() {
40
41
require_once( ABSPATH . 'wp-admin/upgrade-functions.php' );
42
dbDelta($sql);
43
-
44
/* Drop the old sitewide and user activity tables */
45
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}bp_activity_user_activity" );
46
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}bp_activity_sitewide" );
47
-
48
/* TODO: Rename the old user activity cached table */
49
//$wpdb->query( "RENAME TABLE {$wpdb->base_prefix}bp_activity_user_activity_cached TO {$bp->activity->table_name}" );
50
@@ -56,21 +56,21 @@ function bp_activity_setup_globals() {
56
57
/* Internal identifier */
58
$bp->activity->id = 'activity';
59
-
60
$bp->activity->table_name = $wpdb->base_prefix . 'bp_activity_user_activity_cached';
61
$bp->activity->slug = BP_ACTIVITY_SLUG;
62
-
63
/* Register this in the active components array */
64
$bp->active_components[$bp->activity->slug] = $bp->activity->id;
65
-
66
do_action( 'bp_activity_setup_globals' );
67
}
68
add_action( 'plugins_loaded', 'bp_activity_setup_globals', 5 );
69
add_action( 'admin_menu', 'bp_activity_setup_globals', 2 );
70
71
- function bp_activity_check_installed() {
72
global $wpdb, $bp;
73
-
74
if ( get_site_option('bp-activity-db-version') < BP_ACTIVITY_DB_VERSION )
75
bp_activity_install();
76
}
@@ -80,7 +80,7 @@ function bp_activity_setup_root_component() {
80
/* Register 'activity' as a root component (for RSS feed use) */
81
bp_core_add_root_component( BP_ACTIVITY_SLUG );
82
}
83
- add_action( 'plugins_loaded', 'bp_activity_setup_root_component', 2 );
84
85
function bp_activity_setup_nav() {
86
global $bp;
@@ -99,7 +99,7 @@ function bp_activity_setup_nav() {
99
$bp->bp_options_title = __( 'My Activity', 'buddypress' );
100
} else {
101
$bp->bp_options_avatar = bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => 'thumb' ) );
102
- $bp->bp_options_title = $bp->displayed_user->fullname;
103
}
104
}
105
@@ -119,12 +119,18 @@ add_action( 'admin_menu', 'bp_activity_setup_nav' );
119
120
function bp_activity_screen_my_activity() {
121
do_action( 'bp_activity_screen_my_activity' );
122
- bp_core_load_template( apply_filters( 'bp_activity_template_my_activity', 'activity/just-me' ) );
123
}
124
125
function bp_activity_screen_friends_activity() {
126
do_action( 'bp_activity_screen_friends_activity' );
127
- bp_core_load_template( apply_filters( 'bp_activity_template_friends_activity', 'activity/my-friends' ) );
128
}
129
130
@@ -147,25 +153,25 @@ function bp_activity_action_delete_activity() {
147
148
/* Check the nonce */
149
check_admin_referer( 'bp_activity_delete_link' );
150
-
151
$activity_id = $bp->action_variables[0];
152
-
153
/* Check access */
154
if ( !is_site_admin() ) {
155
$activity = new BP_Activity_Activity( $activity_id );
156
-
157
if ( $activity->user_id != $bp->loggedin_user->id )
158
return false;
159
}
160
-
161
/* Now delete the activity item */
162
if ( bp_activity_delete_by_activity_id( $activity_id ) )
163
bp_core_add_message( __( 'Activity deleted', 'buddypress' ) );
164
else
165
bp_core_add_message( __( 'There was an error when deleting that activity', 'buddypress' ), 'error' );
166
-
167
do_action( 'bp_activity_action_delete_activity', $activity_id );
168
-
169
bp_core_redirect( $_SERVER['HTTP_REFERER'] );
170
}
171
add_action( 'wp', 'bp_activity_action_delete_activity', 3 );
@@ -186,11 +192,11 @@ function bp_activity_action_sitewide_feed() {
186
add_action( 'wp', 'bp_activity_action_sitewide_feed', 3 );
187
188
function bp_activity_action_personal_feed() {
189
- global $bp, $wp_query;
190
191
if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'feed' )
192
return false;
193
-
194
$wp_query->is_404 = false;
195
status_header( 200 );
196
@@ -205,11 +211,11 @@ function bp_activity_action_friends_feed() {
205
if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'my-friends' || $bp->action_variables[0] != 'feed' )
206
return false;
207
208
- $wp_query->is_404 = false;
209
status_header( 200 );
210
211
include_once( 'bp-activity/feeds/bp-activity-friends-feed.php' );
212
- die;
213
}
214
add_action( 'wp', 'bp_activity_action_friends_feed', 3 );
215
@@ -225,13 +231,13 @@ add_action( 'wp', 'bp_activity_action_friends_feed', 3 );
225
226
function bp_activity_add( $args = '' ) {
227
global $bp, $wpdb;
228
-
229
$defaults = array(
230
'content' => false, // The content of the activity item
231
'primary_link' => false, // The primary URL for this item in RSS feeds
232
'component_name' => false, // The name/ID of the component e.g. groups, profile, mycomponent
233
'component_action' => false, // The component action e.g. new_wire_post, profile_updated
234
-
235
'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.
236
'item_id' => false, // Optional: The ID of the specific item being recorded, e.g. a blog_id, or wire_post_id
237
'secondary_item_id' => false, // Optional: A second ID used to further filter e.g. a comment_id
@@ -241,7 +247,7 @@ function bp_activity_add( $args = '' ) {
241
242
$r = wp_parse_args( $args, $defaults );
243
extract( $r, EXTR_SKIP );
244
-
245
/* Insert the "time-since" placeholder */
246
if ( $content )
247
$content = bp_activity_add_timesince_placeholder( $content );
@@ -256,12 +262,12 @@ function bp_activity_add( $args = '' ) {
256
$activity->secondary_item_id = $secondary_item_id;
257
$activity->date_recorded = $recorded_time;
258
$activity->hide_sitewide = $hide_sitewide;
259
-
260
if ( !$activity->save() )
261
return false;
262
263
do_action( 'bp_activity_add', $args );
264
-
265
return true;
266
}
267
@@ -295,7 +301,7 @@ function bp_activity_delete_by_activity_id( $activity_id ) {
295
296
do_action( 'bp_activity_delete_by_activity_id', $activity_id );
297
298
- return true;
299
}
300
301
function bp_activity_delete_by_content( $user_id, $content, $component_name, $component_action ) {
@@ -315,13 +321,13 @@ function bp_activity_delete_for_user_by_component( $user_id, $component_name ) {
315
return false;
316
317
do_action( 'bp_activity_delete_for_user_by_component', $user_id, $component_name );
318
-
319
return true;
320
}
321
322
function bp_activity_add_timesince_placeholder( $content ) {
323
/* Check a time-since span doesn't already exist */
324
- if ( false === strpos( $content, '<span class="time-since">' ) ) {
325
if ( !$pos = strpos( $content, '<blockquote' ) ) {
326
if ( !$pos = strpos( $content, '<div' ) ) {
327
if ( !$pos = strpos( $content, '<ul' ) ) {
@@ -330,37 +336,37 @@ function bp_activity_add_timesince_placeholder( $content ) {
330
}
331
}
332
}
333
-
334
if ( (int) $pos ) {
335
$before = substr( $content, 0, (int) $pos );
336
$after = substr( $content, (int) $pos, strlen( $content ) );
337
-
338
$content = $before . ' <span class="time-since">%s</span>' . $after;
339
}
340
341
return apply_filters( 'bp_activity_add_timesince_placeholder', $content );
342
}
343
344
- function bp_activity_set_action( $component_id, $key, $value ) {
345
- global $bp;
346
347
- if ( empty( $component_id ) || empty( $key ) || empty( $value ) )
348
- return false;
349
350
- $bp->activity->actions->{$component_id}->{$key} = apply_filters( 'bp_activity_set_action', array(
351
- 'key' => $key,
352
- 'value' => $value
353
- ), $component_id, $key, $value );
354
- }
355
356
- function bp_activity_get_action( $component_id, $key ) {
357
- global $bp;
358
359
- if ( empty( $component_id ) || empty( $key ) )
360
- return false;
361
362
- return apply_filters( 'bp_activity_get_action', $bp->activity->actions->{$component_id}->{$key}, $component_id, $key );
363
- }
364
365
function bp_activity_check_exists_by_content( $content ) {
366
/* Insert the "time-since" placeholder to match the existing content in the DB */
@@ -388,7 +394,7 @@ function bp_activity_get_friends_activity( $user_id, $max_items = 30, $max_items
388
function bp_activity_remove_data( $user_id ) {
389
// Clear the user's activity from the sitewide stream and clear their activity tables
390
BP_Activity_Activity::delete_for_user( $user_id );
391
-
392
do_action( 'bp_activity_remove_data', $user_id );
393
}
394
add_action( 'wpmu_delete_user', 'bp_activity_remove_data' );
@@ -397,7 +403,7 @@ add_action( 'make_spam_user', 'bp_activity_remove_data' );
397
398
/* Ordering function - don't call this directly */
399
function bp_activity_order_by_date( $a, $b ) {
400
- return apply_filters( 'bp_activity_order_by_date', strcasecmp( $b['date_recorded'], $a['date_recorded'] ) );
401
}
402
403
?>
13
14
/* Include deprecated functions if settings allow */
15
if ( !defined( 'BP_IGNORE_DEPRECATED' ) )
16
+ require ( BP_PLUGIN_DIR . '/bp-activity/deprecated/bp-activity-deprecated.php' );
17
+
18
function bp_activity_install() {
19
global $wpdb, $bp;
20
+
21
if ( !empty($wpdb->charset) )
22
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
23
+
24
$sql[] = "CREATE TABLE {$bp->activity->table_name} (
25
id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
26
user_id bigint(20) NOT NULL,
40
41
require_once( ABSPATH . 'wp-admin/upgrade-functions.php' );
42
dbDelta($sql);
43
+
44
/* Drop the old sitewide and user activity tables */
45
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}bp_activity_user_activity" );
46
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}bp_activity_sitewide" );
47
+
48
/* TODO: Rename the old user activity cached table */
49
//$wpdb->query( "RENAME TABLE {$wpdb->base_prefix}bp_activity_user_activity_cached TO {$bp->activity->table_name}" );
50
56
57
/* Internal identifier */
58
$bp->activity->id = 'activity';
59
+
60
$bp->activity->table_name = $wpdb->base_prefix . 'bp_activity_user_activity_cached';
61
$bp->activity->slug = BP_ACTIVITY_SLUG;
62
+
63
/* Register this in the active components array */
64
$bp->active_components[$bp->activity->slug] = $bp->activity->id;
65
+
66
do_action( 'bp_activity_setup_globals' );
67
}
68
add_action( 'plugins_loaded', 'bp_activity_setup_globals', 5 );
69
add_action( 'admin_menu', 'bp_activity_setup_globals', 2 );
70
71
+ function bp_activity_check_installed() {
72
global $wpdb, $bp;
73
+
74
if ( get_site_option('bp-activity-db-version') < BP_ACTIVITY_DB_VERSION )
75
bp_activity_install();
76
}
80
/* Register 'activity' as a root component (for RSS feed use) */
81
bp_core_add_root_component( BP_ACTIVITY_SLUG );
82
}
83
+ add_action( 'plugins_loaded', 'bp_activity_setup_root_component' );
84
85
function bp_activity_setup_nav() {
86
global $bp;
99
$bp->bp_options_title = __( 'My Activity', 'buddypress' );
100
} else {
101
$bp->bp_options_avatar = bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => 'thumb' ) );
102
+ $bp->bp_options_title = $bp->displayed_user->fullname;
103
}
104
}
105
119
120
function bp_activity_screen_my_activity() {
121
do_action( 'bp_activity_screen_my_activity' );
122
+ bp_core_load_template( apply_filters( 'bp_activity_template_my_activity', 'activity/just-me' ) );
123
}
124
125
function bp_activity_screen_friends_activity() {
126
+ global $bp;
127
+
128
+ /* Make sure delete links do not show for friends activity items */
129
+ if ( !is_site_admin() )
130
+ $bp->is_item_admin = false;
131
+
132
do_action( 'bp_activity_screen_friends_activity' );
133
+ bp_core_load_template( apply_filters( 'bp_activity_template_friends_activity', 'activity/my-friends' ) );
134
}
135
136
153
154
/* Check the nonce */
155
check_admin_referer( 'bp_activity_delete_link' );
156
+
157
$activity_id = $bp->action_variables[0];
158
+
159
/* Check access */
160
if ( !is_site_admin() ) {
161
$activity = new BP_Activity_Activity( $activity_id );
162
+
163
if ( $activity->user_id != $bp->loggedin_user->id )
164
return false;
165
}
166
+
167
/* Now delete the activity item */
168
if ( bp_activity_delete_by_activity_id( $activity_id ) )
169
bp_core_add_message( __( 'Activity deleted', 'buddypress' ) );
170
else
171
bp_core_add_message( __( 'There was an error when deleting that activity', 'buddypress' ), 'error' );
172
+
173
do_action( 'bp_activity_action_delete_activity', $activity_id );
174
+
175
bp_core_redirect( $_SERVER['HTTP_REFERER'] );
176
}
177
add_action( 'wp', 'bp_activity_action_delete_activity', 3 );
192
add_action( 'wp', 'bp_activity_action_sitewide_feed', 3 );
193
194
function bp_activity_action_personal_feed() {
195
+ global $bp, $wp_query;
196
197
if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'feed' )
198
return false;
199
+
200
$wp_query->is_404 = false;
201
status_header( 200 );
202
211
if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'my-friends' || $bp->action_variables[0] != 'feed' )
212
return false;
213
214
+ $wp_query->is_404 = false;
215
status_header( 200 );
216
217
include_once( 'bp-activity/feeds/bp-activity-friends-feed.php' );
218
+ die;
219
}
220
add_action( 'wp', 'bp_activity_action_friends_feed', 3 );
221
231
232
function bp_activity_add( $args = '' ) {
233
global $bp, $wpdb;
234
+
235
$defaults = array(
236
'content' => false, // The content of the activity item
237
'primary_link' => false, // The primary URL for this item in RSS feeds
238
'component_name' => false, // The name/ID of the component e.g. groups, profile, mycomponent
239
'component_action' => false, // The component action e.g. new_wire_post, profile_updated
240
+
241
'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.
242
'item_id' => false, // Optional: The ID of the specific item being recorded, e.g. a blog_id, or wire_post_id
243
'secondary_item_id' => false, // Optional: A second ID used to further filter e.g. a comment_id
247
248
$r = wp_parse_args( $args, $defaults );
249
extract( $r, EXTR_SKIP );
250
+
251
/* Insert the "time-since" placeholder */
252
if ( $content )
253
$content = bp_activity_add_timesince_placeholder( $content );
262
$activity->secondary_item_id = $secondary_item_id;
263
$activity->date_recorded = $recorded_time;
264
$activity->hide_sitewide = $hide_sitewide;
265
+
266
if ( !$activity->save() )
267
return false;
268
269
do_action( 'bp_activity_add', $args );
270
+
271
return true;
272
}
273
301
302
do_action( 'bp_activity_delete_by_activity_id', $activity_id );
303
304
+ return true;
305
}
306
307
function bp_activity_delete_by_content( $user_id, $content, $component_name, $component_action ) {
321
return false;
322
323
do_action( 'bp_activity_delete_for_user_by_component', $user_id, $component_name );
324
+
325
return true;
326
}
327
328
function bp_activity_add_timesince_placeholder( $content ) {
329
/* Check a time-since span doesn't already exist */
330
+ if ( false === strpos( $content, '<span class="time-since">' ) ) {
331
if ( !$pos = strpos( $content, '<blockquote' ) ) {
332
if ( !$pos = strpos( $content, '<div' ) ) {
333
if ( !$pos = strpos( $content, '<ul' ) ) {
336
}
337
}
338
}
339
+
340
if ( (int) $pos ) {
341
$before = substr( $content, 0, (int) $pos );
342
$after = substr( $content, (int) $pos, strlen( $content ) );
343
+
344
$content = $before . ' <span class="time-since">%s</span>' . $after;
345
}
346
347
return apply_filters( 'bp_activity_add_timesince_placeholder', $content );
348
}
349
350
+ function bp_activity_set_action( $component_id, $key, $value ) {
351
+ global $bp;
352
353
+ if ( empty( $component_id ) || empty( $key ) || empty( $value ) )
354
+ return false;
355
356
+ $bp->activity->actions->{$component_id}->{$key} = apply_filters( 'bp_activity_set_action', array(
357
+ 'key' => $key,
358
+ 'value' => $value
359
+ ), $component_id, $key, $value );
360
+ }
361
362
+ function bp_activity_get_action( $component_id, $key ) {
363
+ global $bp;
364
365
+ if ( empty( $component_id ) || empty( $key ) )
366
+ return false;
367
368
+ return apply_filters( 'bp_activity_get_action', $bp->activity->actions->{$component_id}->{$key}, $component_id, $key );
369
+ }
370
371
function bp_activity_check_exists_by_content( $content ) {
372
/* Insert the "time-since" placeholder to match the existing content in the DB */
394
function bp_activity_remove_data( $user_id ) {
395
// Clear the user's activity from the sitewide stream and clear their activity tables
396
BP_Activity_Activity::delete_for_user( $user_id );
397
+
398
do_action( 'bp_activity_remove_data', $user_id );
399
}
400
add_action( 'wpmu_delete_user', 'bp_activity_remove_data' );
403
404
/* Ordering function - don't call this directly */
405
function bp_activity_order_by_date( $a, $b ) {
406
+ return apply_filters( 'bp_activity_order_by_date', strcasecmp( $b['date_recorded'], $a['date_recorded'] ) );
407
}
408
409
?>
bp-activity/bp-activity-classes.php CHANGED
@@ -10,21 +10,21 @@ Class BP_Activity_Activity {
10
var $component_action;
11
var $date_recorded;
12
var $hide_sitewide = false;
13
-
14
function bp_activity_activity( $id = false ) {
15
global $bp;
16
-
17
if ( $id ) {
18
$this->id = $id;
19
$this->populate();
20
}
21
}
22
-
23
function populate() {
24
global $wpdb, $bp;
25
-
26
$activity = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE id = %d", $this->id ) );
27
-
28
$this->id = $activity->id;
29
$this->item_id = $activity->item_id;
30
$this->secondary_item_id = $activity->secondary_item_id;
@@ -36,15 +36,15 @@ Class BP_Activity_Activity {
36
$this->date_recorded = $activity->date_recorded;
37
$this->hide_sitewide = $activity->hide_sitewide;
38
}
39
-
40
function save() {
41
global $wpdb, $bp, $current_user;
42
-
43
do_action( 'bp_activity_before_save', $this );
44
45
if ( !$this->component_name || !$this->component_action )
46
return false;
47
-
48
/***
49
* Before v1.1 of BuddyPress, activity content was calculated at a later point. This is no longer the
50
* case, to to be backwards compatible we need to fetch content here to continue.
@@ -53,18 +53,18 @@ Class BP_Activity_Activity {
53
if ( function_exists( $bp->{$this->component_name}->format_activity_function ) ) {
54
if ( !$fetched_content = call_user_func( $bp->{$this->component_name}->format_activity_function, $this->item_id, $this->user_id, $this->component_action, $this->secondary_item_id, $this->for_secondary_user ) )
55
return false;
56
-
57
$this->content = $fetched_content['content'];
58
$this->primary_link = $fetched_content['primary_link'];
59
}
60
}
61
-
62
if ( !$this->primary_link )
63
$this->primary_link = $bp->loggedin_user->domain;
64
-
65
if ( $existing_activity_id = $this->exists() )
66
BP_Activity_Activity::delete_by_activity_id( $existing_activity_id );
67
-
68
/* If we have an existing ID, update the activity item, otherwise insert it. */
69
if ( $this->id ) {
70
if ( $wpdb->query( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET user_id = %d, component_name = %s, component_action = %s, content = %s, primary_link = %s, date_recorded = FROM_UNIXTIME(%d), item_id = %s, secondary_item_id = %s, hide_sitewide = %d WHERE id = %d", $this->user_id, $this->component_name, $this->component_action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide, $this->id ) ) ) {
@@ -80,103 +80,103 @@ Class BP_Activity_Activity {
80
81
return false;
82
}
83
-
84
function exists() {
85
global $wpdb, $bp;
86
-
87
/* This doesn't seem to be working correctly at the moment, so it is disabled [TODO] */
88
return false;
89
-
90
/* If we have an item id, try and match on that, if not do a content match */
91
if ( $this->item_id ) {
92
if ( $this->secondary_item_id )
93
$secondary_sql = $wpdb->prepare( " AND secondary_item_id = %s", $secondary_item_id );
94
-
95
- return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE user_id = %d AND item_id = %s{$secondary_sql} AND component_name = %s AND component_action = %s", $this->user_id, $this->item_id, $this->component_name, $this->component_action ) );
96
} else {
97
- return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE user_id = %d AND content = %s AND component_name = %s AND component_action = %s", $this->user_id, $this->content, $this->component_name, $this->component_action ) );
98
}
99
}
100
-
101
- /* Static Functions */
102
103
function delete( $item_id, $component_name, $component_action, $user_id = false, $secondary_item_id = false ) {
104
global $wpdb, $bp;
105
106
if ( $secondary_item_id )
107
$secondary_sql = $wpdb->prepare( "AND secondary_item_id = %s", $secondary_item_id );
108
-
109
if ( $component_action )
110
$component_action_sql = $wpdb->prepare( "AND component_action = %s", $component_action );
111
-
112
if ( $user_id )
113
$user_sql = $wpdb->prepare( "AND user_id = %d", $user_id );
114
115
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE item_id = %s {$secondary_sql} AND component_name = %s {$component_action_sql} {$user_sql}", $item_id, $component_name ) );
116
}
117
-
118
function delete_by_item_id( $item_id, $component_name, $component_action, $user_id = false, $secondary_item_id = false ) {
119
return BP_Activity_Activity::delete( $item_id, $component_name, $component_action, $user_id, $secondary_item_id );
120
}
121
122
function delete_by_activity_id( $activity_id ) {
123
global $bp, $wpdb;
124
-
125
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE id = %d", $activity_id ) );
126
}
127
-
128
function delete_by_content( $user_id, $content, $component_name, $component_action ) {
129
global $bp, $wpdb;
130
-
131
- return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE user_id = %d AND content = %s AND component_name = %s AND component_action = %s", $user_id, $content, $component_name, $component_action ) );
132
}
133
-
134
function delete_for_user_by_component( $user_id, $component_name ) {
135
global $bp, $wpdb;
136
-
137
- return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE user_id = %d AND component_name = %s", $user_id, $component_name ) );
138
}
139
-
140
function delete_for_user( $user_id ) {
141
global $wpdb, $bp;
142
143
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE user_id = %d", $user_id ) );
144
}
145
-
146
function get_activity_for_user( $user_id, $max_items, $limit, $page, $filter ) {
147
global $wpdb, $bp;
148
-
149
if ( $limit && $page )
150
$pag_sql = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
151
152
if ( $max_items )
153
$max_sql = $wpdb->prepare( "LIMIT %d", $max_items );
154
-
155
/* Sort out filtering */
156
if ( $filter )
157
$filter_sql = BP_Activity_Activity::get_filter_sql( $filter );
158
-
159
if ( $limit && $page && $max_items )
160
$activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE user_id = %d $filter_sql ORDER BY date_recorded DESC $pag_sql", $user_id ) );
161
else
162
$activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE user_id = %d $filter_sql ORDER BY date_recorded DESC $pag_sql $max_sql", $user_id ) );
163
-
164
- $total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->activity->table_name} WHERE user_id = %d $filter_sql ORDER BY date_recorded DESC $max_sql", $user_id ) );
165
-
166
return array( 'activities' => $activities, 'total' => (int)$total_activities );
167
}
168
-
169
function get_activity_for_friends( $user_id, $max_items, $max_items_per_friend, $limit, $page, $filter ) {
170
global $wpdb, $bp;
171
-
172
// TODO: Max items per friend not yet implemented.
173
-
174
if ( !function_exists('friends_get_friend_user_ids') )
175
return false;
176
177
if ( $limit && $page )
178
$pag_sql = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
179
-
180
if ( $max_items )
181
$max_sql = $wpdb->prepare( "LIMIT %d", $max_items );
182
@@ -188,28 +188,28 @@ Class BP_Activity_Activity {
188
189
if ( !$friend_ids )
190
return false;
191
-
192
$friend_ids = implode( ',', $friend_ids );
193
-
194
if ( $limit && $page && $max_items )
195
- $activities = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT id, user_id, content, primary_link, date_recorded, component_name, component_action FROM {$bp->activity->table_name} WHERE user_id IN ({$friend_ids}) $filter_sql ORDER BY date_recorded DESC $pag_sql" ) );
196
else
197
- $activities = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT id, user_id, content, primary_link, date_recorded, component_name, component_action FROM {$bp->activity->table_name} WHERE user_id IN ({$friend_ids}) $filter_sql ORDER BY date_recorded DESC $pag_sql $max_sql" ) );
198
199
- $total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(user_id) FROM {$bp->activity->table_name} WHERE user_id IN ({$friend_ids}) $filter_sql ORDER BY date_recorded DESC $max_sql" ) );
200
-
201
return array( 'activities' => $activities, 'total' => (int)$total_activities );
202
}
203
-
204
function get_sitewide_activity( $max, $limit, $page, $filter ) {
205
global $wpdb, $bp;
206
-
207
if ( $limit && $page )
208
$pag_sql = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
209
-
210
if ( $max )
211
$max_sql = $wpdb->prepare( "LIMIT %d", $max );
212
-
213
/* Sort out filtering */
214
if ( $filter )
215
$filter_sql = BP_Activity_Activity::get_filter_sql( $filter );
@@ -219,20 +219,20 @@ Class BP_Activity_Activity {
219
else
220
$activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE hide_sitewide = 0 $filter_sql ORDER BY date_recorded DESC $pag_sql $max_sql" ) );
221
222
- $total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->activity->table_name} WHERE hide_sitewide = 0 $filter_sql ORDER BY date_recorded DESC $max_sql" ) );
223
224
return array( 'activities' => $activities, 'total' => (int)$total_activities );
225
}
226
-
227
function get_recorded_component_names() {
228
global $wpdb, $bp;
229
-
230
return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT component_name FROM {$bp->activity->table_name} ORDER BY component_name ASC" ) );
231
}
232
-
233
function get_sitewide_items_for_feed( $limit = 35 ) {
234
global $wpdb, $bp;
235
-
236
$activities = bp_activity_get_sitewide_activity( $limit );
237
for ( $i = 0; $i < count($activities); $i++ ) {
238
$title = explode( '<span', $activities[$i]['content'] );
@@ -243,89 +243,89 @@ Class BP_Activity_Activity {
243
$activity_feed[$i]['pubdate'] = $activities[$i]['date_recorded'];
244
}
245
246
- return $activity_feed;
247
}
248
-
249
function get_filter_sql( $filter_array ) {
250
global $wpdb;
251
-
252
if ( !empty( $filter_array['object'] ) ) {
253
$object_filter = explode( ',', $filter_array['object'] );
254
$object_sql = ' AND ( ';
255
-
256
$counter = 1;
257
foreach( (array) $object_filter as $object ) {
258
$object_sql .= $wpdb->prepare( "component_name = %s", trim( $object ) );
259
-
260
if ( $counter != count( $object_filter ) )
261
$object_sql .= ' || ';
262
-
263
$counter++;
264
}
265
-
266
$object_sql .= ' )';
267
}
268
269
if ( !empty( $filter_array['action'] ) ) {
270
$action_filter = explode( ',', $filter_array['action'] );
271
$action_sql = ' AND ( ';
272
-
273
$counter = 1;
274
foreach( (array) $action_filter as $action ) {
275
$action_sql .= $wpdb->prepare( "component_action = %s", trim( $action ) );
276
-
277
if ( $counter != count( $action_filter ) )
278
$action_sql .= ' || ';
279
-
280
$counter++;
281
}
282
-
283
$action_sql .= ' )';
284
}
285
286
if ( !empty( $filter_array['primary_id'] ) ) {
287
$pid_filter = explode( ',', $filter_array['primary_id'] );
288
$pid_sql = ' AND ( ';
289
-
290
$counter = 1;
291
foreach( (array) $pid_filter as $pid ) {
292
$pid_sql .= $wpdb->prepare( "item_id = %s", trim( $pid ) );
293
-
294
if ( $counter != count( $pid_filter ) )
295
$pid_sql .= ' || ';
296
-
297
$counter++;
298
}
299
-
300
$pid_sql .= ' )';
301
}
302
303
if ( !empty( $filter_array['secondary_id'] ) ) {
304
$sid_filter = explode( ',', $filter_array['secondary_id'] );
305
$sid_sql = ' AND ( ';
306
-
307
$counter = 1;
308
foreach( (array) $sid_filter as $sid ) {
309
$sid_sql .= $wpdb->prepare( "secondary_item_id = %s", trim( $sid ) );
310
-
311
if ( $counter != count( $sid_filter ) )
312
$sid_sql .= ' || ';
313
-
314
$counter++;
315
}
316
-
317
$sid_sql .= ' )';
318
}
319
-
320
return $object_sql . $action_sql . $pid_sql . $sid_sql;
321
}
322
-
323
function get_last_updated() {
324
global $bp, $wpdb;
325
-
326
return $wpdb->get_var( $wpdb->prepare( "SELECT date_recorded FROM {$bp->activity->table_name} ORDER BY date_recorded ASC LIMIT 1" ) );
327
}
328
-
329
function check_exists_by_content( $content ) {
330
global $wpdb, $bp;
331
10
var $component_action;
11
var $date_recorded;
12
var $hide_sitewide = false;
13
+
14
function bp_activity_activity( $id = false ) {
15
global $bp;
16
+
17
if ( $id ) {
18
$this->id = $id;
19
$this->populate();
20
}
21
}
22
+
23
function populate() {
24
global $wpdb, $bp;
25
+
26
$activity = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE id = %d", $this->id ) );
27
+
28
$this->id = $activity->id;
29
$this->item_id = $activity->item_id;
30
$this->secondary_item_id = $activity->secondary_item_id;
36
$this->date_recorded = $activity->date_recorded;
37
$this->hide_sitewide = $activity->hide_sitewide;
38
}
39
+
40
function save() {
41
global $wpdb, $bp, $current_user;
42
+
43
do_action( 'bp_activity_before_save', $this );
44
45
if ( !$this->component_name || !$this->component_action )
46
return false;
47
+
48
/***
49
* Before v1.1 of BuddyPress, activity content was calculated at a later point. This is no longer the
50
* case, to to be backwards compatible we need to fetch content here to continue.
53
if ( function_exists( $bp->{$this->component_name}->format_activity_function ) ) {
54
if ( !$fetched_content = call_user_func( $bp->{$this->component_name}->format_activity_function, $this->item_id, $this->user_id, $this->component_action, $this->secondary_item_id, $this->for_secondary_user ) )
55
return false;
56
+
57
$this->content = $fetched_content['content'];
58
$this->primary_link = $fetched_content['primary_link'];
59
}
60
}
61
+
62
if ( !$this->primary_link )
63
$this->primary_link = $bp->loggedin_user->domain;
64
+
65
if ( $existing_activity_id = $this->exists() )
66
BP_Activity_Activity::delete_by_activity_id( $existing_activity_id );
67
+
68
/* If we have an existing ID, update the activity item, otherwise insert it. */
69
if ( $this->id ) {
70
if ( $wpdb->query( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET user_id = %d, component_name = %s, component_action = %s, content = %s, primary_link = %s, date_recorded = FROM_UNIXTIME(%d), item_id = %s, secondary_item_id = %s, hide_sitewide = %d WHERE id = %d", $this->user_id, $this->component_name, $this->component_action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide, $this->id ) ) ) {
80
81
return false;
82
}
83
+
84
function exists() {
85
global $wpdb, $bp;
86
+
87
/* This doesn't seem to be working correctly at the moment, so it is disabled [TODO] */
88
return false;
89
+
90
/* If we have an item id, try and match on that, if not do a content match */
91
if ( $this->item_id ) {
92
if ( $this->secondary_item_id )
93
$secondary_sql = $wpdb->prepare( " AND secondary_item_id = %s", $secondary_item_id );
94
+
95
+ return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE user_id = %d AND item_id = %s{$secondary_sql} AND component_name = %s AND component_action = %s", $this->user_id, $this->item_id, $this->component_name, $this->component_action ) );
96
} else {
97
+ return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE user_id = %d AND content = %s AND component_name = %s AND component_action = %s", $this->user_id, $this->content, $this->component_name, $this->component_action ) );
98
}
99
}
100
+
101
+ /* Static Functions */
102
103
function delete( $item_id, $component_name, $component_action, $user_id = false, $secondary_item_id = false ) {
104
global $wpdb, $bp;
105
106
if ( $secondary_item_id )
107
$secondary_sql = $wpdb->prepare( "AND secondary_item_id = %s", $secondary_item_id );
108
+
109
if ( $component_action )
110
$component_action_sql = $wpdb->prepare( "AND component_action = %s", $component_action );
111
+
112
if ( $user_id )
113
$user_sql = $wpdb->prepare( "AND user_id = %d", $user_id );
114
115
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE item_id = %s {$secondary_sql} AND component_name = %s {$component_action_sql} {$user_sql}", $item_id, $component_name ) );
116
}
117
+
118
function delete_by_item_id( $item_id, $component_name, $component_action, $user_id = false, $secondary_item_id = false ) {
119
return BP_Activity_Activity::delete( $item_id, $component_name, $component_action, $user_id, $secondary_item_id );
120
}
121
122
function delete_by_activity_id( $activity_id ) {
123
global $bp, $wpdb;
124
+
125
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE id = %d", $activity_id ) );
126
}
127
+
128
function delete_by_content( $user_id, $content, $component_name, $component_action ) {
129
global $bp, $wpdb;
130
+
131
+ return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE user_id = %d AND content = %s AND component_name = %s AND component_action = %s", $user_id, $content, $component_name, $component_action ) );
132
}
133
+
134
function delete_for_user_by_component( $user_id, $component_name ) {
135
global $bp, $wpdb;
136
+
137
+ return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE user_id = %d AND component_name = %s", $user_id, $component_name ) );
138
}
139
+
140
function delete_for_user( $user_id ) {
141
global $wpdb, $bp;
142
143
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE user_id = %d", $user_id ) );
144
}
145
+
146
function get_activity_for_user( $user_id, $max_items, $limit, $page, $filter ) {
147
global $wpdb, $bp;
148
+
149
if ( $limit && $page )
150
$pag_sql = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
151
152
if ( $max_items )
153
$max_sql = $wpdb->prepare( "LIMIT %d", $max_items );
154
+
155
/* Sort out filtering */
156
if ( $filter )
157
$filter_sql = BP_Activity_Activity::get_filter_sql( $filter );
158
+
159
if ( $limit && $page && $max_items )
160
$activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE user_id = %d $filter_sql ORDER BY date_recorded DESC $pag_sql", $user_id ) );
161
else
162
$activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE user_id = %d $filter_sql ORDER BY date_recorded DESC $pag_sql $max_sql", $user_id ) );
163
+
164
+ $total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->activity->table_name} WHERE user_id = %d $filter_sql ORDER BY date_recorded DESC $max_sql", $user_id ) );
165
+
166
return array( 'activities' => $activities, 'total' => (int)$total_activities );
167
}
168
+
169
function get_activity_for_friends( $user_id, $max_items, $max_items_per_friend, $limit, $page, $filter ) {
170
global $wpdb, $bp;
171
+
172
// TODO: Max items per friend not yet implemented.
173
+
174
if ( !function_exists('friends_get_friend_user_ids') )
175
return false;
176
177
if ( $limit && $page )
178
$pag_sql = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
179
+
180
if ( $max_items )
181
$max_sql = $wpdb->prepare( "LIMIT %d", $max_items );
182
188
189
if ( !$friend_ids )
190
return false;
191
+
192
$friend_ids = implode( ',', $friend_ids );
193
+
194
if ( $limit && $page && $max_items )
195
+ $activities = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT id, user_id, content, primary_link, date_recorded, component_name, component_action FROM {$bp->activity->table_name} WHERE user_id IN ({$friend_ids}) $filter_sql ORDER BY date_recorded DESC $pag_sql" ) );
196
else
197
+ $activities = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT id, user_id, content, primary_link, date_recorded, component_name, component_action FROM {$bp->activity->table_name} WHERE user_id IN ({$friend_ids}) $filter_sql ORDER BY date_recorded DESC $pag_sql $max_sql" ) );
198
+
199
+ $total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT user_id) FROM {$bp->activity->table_name} WHERE user_id IN ({$friend_ids}) $filter_sql ORDER BY date_recorded DESC $max_sql" ) );
200
201
return array( 'activities' => $activities, 'total' => (int)$total_activities );
202
}
203
+
204
function get_sitewide_activity( $max, $limit, $page, $filter ) {
205
global $wpdb, $bp;
206
+
207
if ( $limit && $page )
208
$pag_sql = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
209
+
210
if ( $max )
211
$max_sql = $wpdb->prepare( "LIMIT %d", $max );
212
+
213
/* Sort out filtering */
214
if ( $filter )
215
$filter_sql = BP_Activity_Activity::get_filter_sql( $filter );
219
else
220
$activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE hide_sitewide = 0 $filter_sql ORDER BY date_recorded DESC $pag_sql $max_sql" ) );
221
222
+ $total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->activity->table_name} WHERE hide_sitewide = 0 $filter_sql ORDER BY date_recorded DESC $max_sql" ) );
223
224
return array( 'activities' => $activities, 'total' => (int)$total_activities );
225
}
226
+
227
function get_recorded_component_names() {
228
global $wpdb, $bp;
229
+
230
return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT component_name FROM {$bp->activity->table_name} ORDER BY component_name ASC" ) );
231
}
232
+
233
function get_sitewide_items_for_feed( $limit = 35 ) {
234
global $wpdb, $bp;
235
+
236
$activities = bp_activity_get_sitewide_activity( $limit );
237
for ( $i = 0; $i < count($activities); $i++ ) {
238
$title = explode( '<span', $activities[$i]['content'] );
243
$activity_feed[$i]['pubdate'] = $activities[$i]['date_recorded'];
244
}
245
246
+ return $activity_feed;
247
}
248
+
249
function get_filter_sql( $filter_array ) {
250
global $wpdb;
251
+
252
if ( !empty( $filter_array['object'] ) ) {
253
$object_filter = explode( ',', $filter_array['object'] );
254
$object_sql = ' AND ( ';
255
+
256
$counter = 1;
257
foreach( (array) $object_filter as $object ) {
258
$object_sql .= $wpdb->prepare( "component_name = %s", trim( $object ) );
259
+
260
if ( $counter != count( $object_filter ) )
261
$object_sql .= ' || ';
262
+
263
$counter++;
264
}
265
+
266
$object_sql .= ' )';
267
}
268
269
if ( !empty( $filter_array['action'] ) ) {
270
$action_filter = explode( ',', $filter_array['action'] );
271
$action_sql = ' AND ( ';
272
+
273
$counter = 1;
274
foreach( (array) $action_filter as $action ) {
275
$action_sql .= $wpdb->prepare( "component_action = %s", trim( $action ) );
276
+
277
if ( $counter != count( $action_filter ) )
278
$action_sql .= ' || ';
279
+
280
$counter++;
281
}
282
+
283
$action_sql .= ' )';
284
}
285
286
if ( !empty( $filter_array['primary_id'] ) ) {
287
$pid_filter = explode( ',', $filter_array['primary_id'] );
288
$pid_sql = ' AND ( ';
289
+
290
$counter = 1;
291
foreach( (array) $pid_filter as $pid ) {
292
$pid_sql .= $wpdb->prepare( "item_id = %s", trim( $pid ) );
293
+
294
if ( $counter != count( $pid_filter ) )
295
$pid_sql .= ' || ';
296
+
297
$counter++;
298
}
299
+
300
$pid_sql .= ' )';
301
}
302
303
if ( !empty( $filter_array['secondary_id'] ) ) {
304
$sid_filter = explode( ',', $filter_array['secondary_id'] );
305
$sid_sql = ' AND ( ';
306
+
307
$counter = 1;
308
foreach( (array) $sid_filter as $sid ) {
309
$sid_sql .= $wpdb->prepare( "secondary_item_id = %s", trim( $sid ) );
310
+
311
if ( $counter != count( $sid_filter ) )
312
$sid_sql .= ' || ';
313
+
314
$counter++;
315
}
316
+
317
$sid_sql .= ' )';
318
}
319
+
320
return $object_sql . $action_sql . $pid_sql . $sid_sql;
321
}
322
+
323
function get_last_updated() {
324
global $bp, $wpdb;
325
+
326
return $wpdb->get_var( $wpdb->prepare( "SELECT date_recorded FROM {$bp->activity->table_name} ORDER BY date_recorded ASC LIMIT 1" ) );
327
}
328
+
329
function check_exists_by_content( $content ) {
330
global $wpdb, $bp;
331
bp-activity/bp-activity-filters.php CHANGED
@@ -14,12 +14,12 @@ add_filter( 'bp_get_activity_content', 'stripslashes_deep' );
14
15
function bp_activity_filter_kses( $content ) {
16
global $allowedtags;
17
-
18
$activity_allowedtags = $allowedtags;
19
$activity_allowedtags['span'] = array();
20
$activity_allowedtags['span']['class'] = array();
21
$activity_allowedtags['a']['class'] = array();
22
- $activity_allowedtags['img'] = array();
23
$activity_allowedtags['img']['src'] = array();
24
$activity_allowedtags['img']['alt'] = array();
25
$activity_allowedtags['img']['class'] = array();
14
15
function bp_activity_filter_kses( $content ) {
16
global $allowedtags;
17
+
18
$activity_allowedtags = $allowedtags;
19
$activity_allowedtags['span'] = array();
20
$activity_allowedtags['span']['class'] = array();
21
$activity_allowedtags['a']['class'] = array();
22
+ $activity_allowedtags['img'] = array();
23
$activity_allowedtags['img']['src'] = array();
24
$activity_allowedtags['img']['alt'] = array();
25
$activity_allowedtags['img']['class'] = array();
bp-activity/bp-activity-templatetags.php CHANGED
@@ -7,9 +7,9 @@ class BP_Activity_Template {
7
var $activities;
8
var $activity;
9
var $activity_type;
10
-
11
var $in_the_loop;
12
-
13
var $pag_page;
14
var $pag_num;
15
var $pag_links;
@@ -25,20 +25,20 @@ class BP_Activity_Template {
25
26
if ( $type == 'sitewide' )
27
$this->activities = bp_activity_get_sitewide_activity( $max, $this->pag_num, $this->pag_page, $filter );
28
-
29
if ( $type == 'personal' )
30
$this->activities = bp_activity_get_user_activity( $user_id, $max, $this->pag_num, $this->pag_page, $filter );
31
32
if ( $type == 'friends' && ( bp_is_home() || is_site_admin() || $bp->loggedin_user->id == $user_id ) )
33
$this->activities = bp_activity_get_friends_activity( $user_id, $max, false, $this->pag_num, $this->pag_page, $filter );
34
-
35
if ( !$max || $max >= (int)$this->activities['total'] )
36
$this->total_activity_count = (int)$this->activities['total'];
37
else
38
$this->total_activity_count = (int)$max;
39
-
40
$this->activities = $this->activities['activities'];
41
-
42
if ( $max ) {
43
if ( $max >= count($this->activities) )
44
$this->activity_count = count($this->activities);
@@ -47,7 +47,7 @@ class BP_Activity_Template {
47
} else {
48
$this->activity_count = count($this->activities);
49
}
50
-
51
$this->full_name = $bp->displayed_user->fullname;
52
53
if ( (int) $this->total_activity_count && (int) $this->pag_num ) {
@@ -62,29 +62,29 @@ class BP_Activity_Template {
62
));
63
}
64
}
65
-
66
function has_activities() {
67
if ( $this->activity_count )
68
return true;
69
-
70
return false;
71
}
72
-
73
function next_activity() {
74
$this->current_activity++;
75
$this->activity = $this->activities[$this->current_activity];
76
-
77
return $this->activity;
78
}
79
-
80
function rewind_activities() {
81
$this->current_activity = -1;
82
if ( $this->activity_count > 0 ) {
83
$this->activity = $this->activities[0];
84
}
85
}
86
-
87
- function user_activities() {
88
if ( $this->current_activity + 1 < $this->activity_count ) {
89
return true;
90
} elseif ( $this->current_activity + 1 == $this->activity_count ) {
@@ -96,13 +96,13 @@ class BP_Activity_Template {
96
$this->in_the_loop = false;
97
return false;
98
}
99
-
100
function the_activity() {
101
global $activity;
102
103
$this->in_the_loop = true;
104
$this->activity = $this->next_activity();
105
-
106
if ( is_array( $this->activity ) )
107
$this->activity = (object) $this->activity;
108
@@ -113,9 +113,9 @@ class BP_Activity_Template {
113
114
function bp_has_activities( $args = '' ) {
115
global $bp, $activities_template;
116
-
117
/* Note: any params used for filtering can be a single value, or multiple values comma separated. */
118
-
119
$defaults = array(
120
'type' => 'sitewide',
121
'per_page' => 25,
@@ -137,13 +137,13 @@ function bp_has_activities( $args = '' ) {
137
if ( $per_page > $max )
138
$per_page = $max;
139
}
140
-
141
if ( isset( $_GET['afilter'] ) )
142
$filter = array( 'object' => $_GET['afilter'] );
143
else
144
$filter = array( 'object' => $object, 'action' => $action, 'primary_id' => $primary_id, 'secondary_id' => $secondary_id );
145
-
146
- $activities_template = new BP_Activity_Template( $type, $user_id, $per_page, $max, $filter );
147
return apply_filters( 'bp_has_activities', $activities_template->has_activities(), &$activities_template );
148
}
149
@@ -159,7 +159,7 @@ function bp_the_activity() {
159
160
function bp_activity_pagination_count() {
161
global $bp, $activities_template;
162
-
163
$from_num = intval( ( $activities_template->pag_page - 1 ) * $activities_template->pag_num ) + 1;
164
$to_num = ( $from_num + ( $activities_template->pag_num - 1 ) > $activities_template->total_activity_count ) ? $activities_template->total_activity_count : $from_num + ( $activities_template->pag_num - 1) ;
165
@@ -172,13 +172,13 @@ function bp_activity_pagination_links() {
172
}
173
function bp_get_activity_pagination_links() {
174
global $activities_template;
175
-
176
return apply_filters( 'bp_get_activity_pagination_links', $activities_template->pag_links );
177
}
178
179
function bp_activities_title() {
180
global $bp_activity_title;
181
-
182
echo bp_get_activities_title();
183
}
184
function bp_get_activities_title() {
@@ -189,12 +189,12 @@ function bp_activities_title() {
189
190
function bp_activities_no_activity() {
191
global $bp_activity_no_activity;
192
-
193
echo bp_get_activities_no_activity();
194
}
195
function bp_get_activities_no_activity() {
196
global $bp_activity_no_activity;
197
-
198
return apply_filters( 'bp_get_activities_no_activity', $bp_activity_no_activity );
199
}
200
@@ -217,12 +217,12 @@ function bp_activity_avatar( $args = '' ) {
217
'width' => 20,
218
'height' => 20,
219
'class' => 'avatar',
220
- 'alt' => __( 'Avatar', 'buddypress' )
221
);
222
223
$r = wp_parse_args( $args, $defaults );
224
extract( $r, EXTR_SKIP );
225
-
226
$item_id = false;
227
if ( (int)$activities_template->activity->user_id )
228
$item_id = $activities_template->activity->user_id;
@@ -234,10 +234,10 @@ function bp_activity_avatar( $args = '' ) {
234
$object = 'group';
235
if ( $bp->blogs->id == $activities_template->activity->component_name && !(int) $activities_template->activity->user_id )
236
$object = 'blog';
237
-
238
$object = apply_filters( 'bp_get_activity_avatar_object_' . $activities_template->activity->component_name, $object );
239
-
240
- return apply_filters( 'bp_get_group_avatar', bp_core_fetch_avatar( array( 'item_id' => $item_id, 'object' => $object, 'type' => $type, 'alt' => $alt, 'class' => $class, 'width' => $width, 'height' => $height ) ) );
241
}
242
243
function bp_activity_content() {
@@ -247,22 +247,19 @@ function bp_activity_content() {
247
global $activities_template, $allowed_tags, $bp;
248
249
if ( bp_is_home() && $activities_template->activity_type == 'personal' )
250
- $content = bp_activity_content_filter( $activities_template->activity->content, $activities_template->activity->date_recorded, $activities_template->full_name );
251
else
252
$content = bp_activity_content_filter( $activities_template->activity->content, $activities_template->activity->date_recorded, $activities_template->full_name, true, false, false );
253
254
- /* Add 'the_content' filter to activity to allow existing plugins to replace text as they would on post text. (extra smilies etc) */
255
- $content = apply_filters( 'the_content', $content );
256
-
257
return apply_filters( 'bp_get_activity_content', $content );
258
}
259
260
function bp_activity_content_filter( $content, $date_recorded, $full_name, $insert_time = true, $filter_words = true, $filter_you = true ) {
261
global $activities_template, $bp;
262
-
263
if ( !$content )
264
return false;
265
-
266
/* Split the content so we don't evaluate and replace text on content we don't want to */
267
$content = explode( '%s', $content );
268
@@ -272,7 +269,7 @@ function bp_activity_content_filter( $content, $date_recorded, $full_name, $inse
272
/* Insert the time since */
273
if ( $insert_time )
274
$content[0] = bp_activity_insert_time_since( $content[0], $date_recorded );
275
-
276
// The "You" and "Your" conversion is only done in english, if a translation file is present
277
// then do not translate as it causes problems in other languages.
278
if ( '' == get_locale() ) {
@@ -283,19 +280,19 @@ function bp_activity_content_filter( $content, $date_recorded, $full_name, $inse
283
284
/* Remove the 'You' and replace if with the persons name */
285
if ( $filter_you && $full_name != '' ) {
286
- $content[0] = preg_replace( "/{$full_name}[<]/", 'You<', $content[0], 1 );
287
}
288
}
289
290
/* Add the delete link if the user has permission on this item */
291
if ( ( $activities_template->activity->user_id == $bp->loggedin_user->id ) || $bp->is_item_admin || is_site_admin() )
292
- $content[1] = '</span> <span class="activity-delete-link">' . bp_get_activity_delete_link() . '</span>' . $content[1];
293
-
294
$content_new = '';
295
-
296
for ( $i = 0; $i < count($content); $i++ )
297
$content_new .= $content[$i];
298
-
299
return apply_filters( 'bp_activity_content_filter', $content_new );
300
}
301
@@ -305,7 +302,7 @@ function bp_activity_insert_time_since( $content, $date ) {
305
306
// Make sure we don't have any URL encoding in links when trying to insert the time.
307
$content = urldecode($content);
308
-
309
return apply_filters( 'bp_activity_insert_time_since', @sprintf( $content, @sprintf( __( '&nbsp; %s ago', 'buddypress' ), bp_core_time_since( strtotime( $date ) ) ) ) );
310
}
311
@@ -314,7 +311,7 @@ function bp_activity_css_class() {
314
}
315
function bp_get_activity_css_class() {
316
global $activities_template;
317
-
318
return apply_filters( 'bp_get_activity_css_class', $activities_template->activity->component_name );
319
}
320
@@ -332,26 +329,26 @@ function bp_activity_filter_links( $args = false ) {
332
}
333
function bp_get_activity_filter_links( $args = false ) {
334
global $activities_template, $bp;
335
-
336
$defaults = array(
337
'style' => 'list'
338
);
339
340
$r = wp_parse_args( $args, $defaults );
341
extract( $r, EXTR_SKIP );
342
-
343
/* Fetch the names of components that have activity recorded in the DB */
344
$component_names = BP_Activity_Activity::get_recorded_component_names();
345
-
346
if ( !$component_names )
347
return false;
348
-
349
foreach ( (array) $component_names as $component_name ) {
350
if ( isset( $_GET['afilter'] ) && $component_name == $_GET['afilter'] )
351
$selected = ' class="selected"';
352
else
353
unset($selected);
354
-
355
$component_name = attribute_escape( $component_name );
356
357
switch ( $style ) {
@@ -371,15 +368,15 @@ function bp_activity_filter_links( $args = false ) {
371
$after = '</span>';
372
break;
373
}
374
-
375
$link = add_query_arg( 'afilter', $component_name );
376
$link = remove_query_arg( 'acpage' , $link );
377
378
$link = apply_filters( 'bp_get_activity_filter_link_href', $link, $component_name );
379
-
380
/* Make sure all core internal component names are translatable */
381
$translatable_component_names = array( __( 'profile', 'buddypress'), __( 'friends', 'buddypress' ), __( 'groups', 'buddypress' ), __( 'status', 'buddypress' ), __( 'blogs', 'buddypress' ) );
382
-
383
$component_links[] = $before . '<a href="' . attribute_escape( $link ) . '">' . ucwords( __( $component_name, 'buddypress' ) ) . '</a>' . $after;
384
}
385
@@ -387,7 +384,7 @@ function bp_activity_filter_links( $args = false ) {
387
388
if ( isset( $_GET['afilter'] ) )
389
$component_links[] = '<' . $tag . ' id="afilter-clear"><a href="' . attribute_escape( $link ) . '"">' . __( 'Clear Filter', 'buddypress' ) . '</a></' . $tag . '>';
390
-
391
return apply_filters( 'bp_get_activity_filter_links', implode( "\n", $component_links ) );
392
}
393
@@ -409,7 +406,7 @@ function bp_activities_member_rss_link() {
409
if ( ( $bp->current_component == $bp->profile->slug ) || 'just-me' == $bp->current_action )
410
return apply_filters( 'bp_get_activities_member_rss_link', $bp->displayed_user->domain . $bp->activity->slug . '/feed' );
411
else
412
- return apply_filters( 'bp_get_activities_member_rss_link', $bp->displayed_user->domain . $bp->activity->slug . '/my-friends/feed' );
413
}
414
415
/* Template tags for RSS feed output */
@@ -420,7 +417,7 @@ function bp_activity_feed_item_guid() {
420
function bp_get_activity_feed_item_guid() {
421
global $activities_template;
422
423
- return apply_filters( 'bp_get_activity_feed_item_title', md5( $activities_template->activity->date_recorded . '-' . $activities_template->activity->content ) );
424
}
425
426
function bp_activity_feed_item_title() {
@@ -452,12 +449,12 @@ function bp_activity_feed_item_date() {
452
}
453
454
function bp_activity_feed_item_description() {
455
- echo bp_get_activity_feed_item_description();
456
}
457
function bp_get_activity_feed_item_description() {
458
global $activities_template;
459
460
- return apply_filters( 'bp_get_activity_feed_item_description', html_entity_decode( str_replace( '%s', '', $activities_template->activity->content ), ENT_COMPAT, 'UTF-8' ) );
461
}
462
463
?>
7
var $activities;
8
var $activity;
9
var $activity_type;
10
+
11
var $in_the_loop;
12
+
13
var $pag_page;
14
var $pag_num;
15
var $pag_links;
25
26
if ( $type == 'sitewide' )
27
$this->activities = bp_activity_get_sitewide_activity( $max, $this->pag_num, $this->pag_page, $filter );
28
+
29
if ( $type == 'personal' )
30
$this->activities = bp_activity_get_user_activity( $user_id, $max, $this->pag_num, $this->pag_page, $filter );
31
32
if ( $type == 'friends' && ( bp_is_home() || is_site_admin() || $bp->loggedin_user->id == $user_id ) )
33
$this->activities = bp_activity_get_friends_activity( $user_id, $max, false, $this->pag_num, $this->pag_page, $filter );
34
+
35
if ( !$max || $max >= (int)$this->activities['total'] )
36
$this->total_activity_count = (int)$this->activities['total'];
37
else
38
$this->total_activity_count = (int)$max;
39
+
40
$this->activities = $this->activities['activities'];
41
+
42
if ( $max ) {
43
if ( $max >= count($this->activities) )
44
$this->activity_count = count($this->activities);
47
} else {
48
$this->activity_count = count($this->activities);
49
}
50
+
51
$this->full_name = $bp->displayed_user->fullname;
52
53
if ( (int) $this->total_activity_count && (int) $this->pag_num ) {
62
));
63
}
64
}
65
+
66
function has_activities() {
67
if ( $this->activity_count )
68
return true;
69
+
70
return false;
71
}
72
+
73
function next_activity() {
74
$this->current_activity++;
75
$this->activity = $this->activities[$this->current_activity];
76
+
77
return $this->activity;
78
}
79
+
80
function rewind_activities() {
81
$this->current_activity = -1;
82
if ( $this->activity_count > 0 ) {
83
$this->activity = $this->activities[0];
84
}
85
}
86
+
87
+ function user_activities() {
88
if ( $this->current_activity + 1 < $this->activity_count ) {
89
return true;
90
} elseif ( $this->current_activity + 1 == $this->activity_count ) {
96
$this->in_the_loop = false;
97
return false;
98
}
99
+
100
function the_activity() {
101
global $activity;
102
103
$this->in_the_loop = true;
104
$this->activity = $this->next_activity();
105
+
106
if ( is_array( $this->activity ) )
107
$this->activity = (object) $this->activity;
108
113
114
function bp_has_activities( $args = '' ) {
115
global $bp, $activities_template;
116
+
117
/* Note: any params used for filtering can be a single value, or multiple values comma separated. */
118
+
119
$defaults = array(
120
'type' => 'sitewide',
121
'per_page' => 25,
137
if ( $per_page > $max )
138
$per_page = $max;
139
}
140
+
141
if ( isset( $_GET['afilter'] ) )
142
$filter = array( 'object' => $_GET['afilter'] );
143
else
144
$filter = array( 'object' => $object, 'action' => $action, 'primary_id' => $primary_id, 'secondary_id' => $secondary_id );
145
+
146
+ $activities_template = new BP_Activity_Template( $type, $user_id, $per_page, $max, $filter );
147
return apply_filters( 'bp_has_activities', $activities_template->has_activities(), &$activities_template );
148
}
149
159
160
function bp_activity_pagination_count() {
161
global $bp, $activities_template;
162
+
163
$from_num = intval( ( $activities_template->pag_page - 1 ) * $activities_template->pag_num ) + 1;
164
$to_num = ( $from_num + ( $activities_template->pag_num - 1 ) > $activities_template->total_activity_count ) ? $activities_template->total_activity_count : $from_num + ( $activities_template->pag_num - 1) ;
165
172
}
173
function bp_get_activity_pagination_links() {
174
global $activities_template;
175
+
176
return apply_filters( 'bp_get_activity_pagination_links', $activities_template->pag_links );
177
}
178
179
function bp_activities_title() {
180
global $bp_activity_title;
181
+
182
echo bp_get_activities_title();
183
}
184
function bp_get_activities_title() {
189
190
function bp_activities_no_activity() {
191
global $bp_activity_no_activity;
192
+
193
echo bp_get_activities_no_activity();
194
}
195
function bp_get_activities_no_activity() {
196
global $bp_activity_no_activity;
197
+
198
return apply_filters( 'bp_get_activities_no_activity', $bp_activity_no_activity );
199
}
200
217
'width' => 20,
218
'height' => 20,
219
'class' => 'avatar',
220
+ 'alt' => __( 'Avatar', 'buddypress' )
221
);
222
223
$r = wp_parse_args( $args, $defaults );
224
extract( $r, EXTR_SKIP );
225
+
226
$item_id = false;
227
if ( (int)$activities_template->activity->user_id )
228
$item_id = $activities_template->activity->user_id;
234
$object = 'group';
235
if ( $bp->blogs->id == $activities_template->activity->component_name && !(int) $activities_template->activity->user_id )
236
$object = 'blog';
237
+
238
$object = apply_filters( 'bp_get_activity_avatar_object_' . $activities_template->activity->component_name, $object );
239
+
240
+ return apply_filters( 'bp_get_activity_avatar', bp_core_fetch_avatar( array( 'item_id' => $item_id, 'object' => $object, 'type' => $type, 'alt' => $alt, 'class' => $class, 'width' => $width, 'height' => $height ) ) );
241
}
242
243
function bp_activity_content() {
247
global $activities_template, $allowed_tags, $bp;
248
249
if ( bp_is_home() && $activities_template->activity_type == 'personal' )
250
+ $content = bp_activity_content_filter( $activities_template->activity->content, $activities_template->activity->date_recorded, $activities_template->full_name );
251
else
252
$content = bp_activity_content_filter( $activities_template->activity->content, $activities_template->activity->date_recorded, $activities_template->full_name, true, false, false );
253
254
return apply_filters( 'bp_get_activity_content', $content );
255
}
256
257
function bp_activity_content_filter( $content, $date_recorded, $full_name, $insert_time = true, $filter_words = true, $filter_you = true ) {
258
global $activities_template, $bp;
259
+
260
if ( !$content )
261
return false;
262
+
263
/* Split the content so we don't evaluate and replace text on content we don't want to */
264
$content = explode( '%s', $content );
265
269
/* Insert the time since */
270
if ( $insert_time )
271
$content[0] = bp_activity_insert_time_since( $content[0], $date_recorded );
272
+
273
// The "You" and "Your" conversion is only done in english, if a translation file is present
274
// then do not translate as it causes problems in other languages.
275
if ( '' == get_locale() ) {
280
281
/* Remove the 'You' and replace if with the persons name */
282
if ( $filter_you && $full_name != '' ) {
283
+ $content[0] = preg_replace( "/{$full_name}[<]/", 'You<', $content[0], 1 );
284
}
285
}
286
287
/* Add the delete link if the user has permission on this item */
288
if ( ( $activities_template->activity->user_id == $bp->loggedin_user->id ) || $bp->is_item_admin || is_site_admin() )
289
+ $content[1] = '</span> <span class="activity-delete-link">' . bp_get_activity_delete_link() . '</span>' . $content[1];
290
+
291
$content_new = '';
292
+
293
for ( $i = 0; $i < count($content); $i++ )
294
$content_new .= $content[$i];
295
+
296
return apply_filters( 'bp_activity_content_filter', $content_new );
297
}
298
302
303
// Make sure we don't have any URL encoding in links when trying to insert the time.
304
$content = urldecode($content);
305
+
306
return apply_filters( 'bp_activity_insert_time_since', @sprintf( $content, @sprintf( __( '&nbsp; %s ago', 'buddypress' ), bp_core_time_since( strtotime( $date ) ) ) ) );
307
}
308
311
}
312
function bp_get_activity_css_class() {
313
global $activities_template;
314
+
315
return apply_filters( 'bp_get_activity_css_class', $activities_template->activity->component_name );
316
}
317
329
}
330
function bp_get_activity_filter_links( $args = false ) {
331
global $activities_template, $bp;
332
+
333
$defaults = array(
334
'style' => 'list'
335
);
336
337
$r = wp_parse_args( $args, $defaults );
338
extract( $r, EXTR_SKIP );
339
+
340
/* Fetch the names of components that have activity recorded in the DB */
341
$component_names = BP_Activity_Activity::get_recorded_component_names();
342
+
343
if ( !$component_names )
344
return false;
345
+
346
foreach ( (array) $component_names as $component_name ) {
347
if ( isset( $_GET['afilter'] ) && $component_name == $_GET['afilter'] )
348
$selected = ' class="selected"';
349
else
350
unset($selected);
351
+
352
$component_name = attribute_escape( $component_name );
353
354
switch ( $style ) {
368
$after = '</span>';
369
break;
370
}
371
+
372
$link = add_query_arg( 'afilter', $component_name );
373
$link = remove_query_arg( 'acpage' , $link );
374
375
$link = apply_filters( 'bp_get_activity_filter_link_href', $link, $component_name );
376
+
377
/* Make sure all core internal component names are translatable */
378
$translatable_component_names = array( __( 'profile', 'buddypress'), __( 'friends', 'buddypress' ), __( 'groups', 'buddypress' ), __( 'status', 'buddypress' ), __( 'blogs', 'buddypress' ) );
379
+
380
$component_links[] = $before . '<a href="' . attribute_escape( $link ) . '">' . ucwords( __( $component_name, 'buddypress' ) ) . '</a>' . $after;
381
}
382
384
385
if ( isset( $_GET['afilter'] ) )
386
$component_links[] = '<' . $tag . ' id="afilter-clear"><a href="' . attribute_escape( $link ) . '"">' . __( 'Clear Filter', 'buddypress' ) . '</a></' . $tag . '>';
387
+
388
return apply_filters( 'bp_get_activity_filter_links', implode( "\n", $component_links ) );
389
}
390
406
if ( ( $bp->current_component == $bp->profile->slug ) || 'just-me' == $bp->current_action )
407
return apply_filters( 'bp_get_activities_member_rss_link', $bp->displayed_user->domain . $bp->activity->slug . '/feed' );
408
else
409
+ return apply_filters( 'bp_get_activities_member_rss_link', $bp->displayed_user->domain . $bp->activity->slug . '/my-friends/feed' );
410
}
411
412
/* Template tags for RSS feed output */
417
function bp_get_activity_feed_item_guid() {
418
global $activities_template;
419
420
+ return apply_filters( 'bp_get_activity_feed_item_guid', md5( $activities_template->activity->date_recorded . '-' . $activities_template->activity->content ) );
421
}
422
423
function bp_activity_feed_item_title() {
449
}
450
451
function bp_activity_feed_item_description() {
452
+ echo bp_get_activity_feed_item_description();
453
}
454
function bp_get_activity_feed_item_description() {
455
global $activities_template;
456
457
+ return apply_filters( 'bp_get_activity_feed_item_description', html_entity_decode( str_replace( '%s', '', $activities_template->activity->content ), ENT_COMPAT, 'UTF-8' ) );
458
}
459
460
?>
bp-activity/bp-activity-widgets.php CHANGED
@@ -13,15 +13,15 @@ class BP_Activity_Widget extends WP_Widget {
13
14
function widget($args, $instance) {
15
global $bp;
16
-
17
extract( $args );
18
-
19
echo $before_widget;
20
echo $before_title
21
- . $widget_name .
22
- ' <a class="rss-image" href="' . bp_get_sitewide_activity_feed_link() . '" title="' . __( 'Site Wide Activity RSS Feed', 'buddypress' ) . '">' . __( '[RSS]', 'buddypress' ) . '</a>'
23
. $after_title; ?>
24
-
25
<?php if ( bp_has_activities( 'type=sitewide&max=' . $instance['max_items'] . '&per_page=' . $instance['per_page'] ) ) : ?>
26
27
<?php if ( !file_exists( WP_CONTENT_DIR . '/bp-themes' ) ) : ?>
@@ -29,17 +29,17 @@ class BP_Activity_Widget extends WP_Widget {
29
<div class="pag-count" id="activity-count">
30
<?php bp_activity_pagination_count() ?>
31
</div>
32
-
33
<div class="pagination-links" id="activity-pag">
34
&nbsp; <?php bp_activity_pagination_links() ?>
35
</div>
36
</div>
37
-
38
<ul id="activity-filter-links">
39
<?php bp_activity_filter_links() ?>
40
</ul>
41
<?php endif; ?>
42
-
43
<ul id="site-wide-stream" class="activity-list">
44
<?php while ( bp_activities() ) : bp_the_activity(); ?>
45
<li class="<?php bp_activity_css_class() ?>">
@@ -48,7 +48,7 @@ class BP_Activity_Widget extends WP_Widget {
48
<?php bp_activity_avatar() ?>
49
</div>
50
<?php endif; ?>
51
-
52
<?php bp_activity_content() ?>
53
</li>
54
<?php endwhile; ?>
@@ -60,7 +60,7 @@ class BP_Activity_Widget extends WP_Widget {
60
<?php _e('There has been no recent site activity.', 'buddypress') ?>
61
</div>
62
<?php endif;?>
63
-
64
<?php echo $after_widget; ?>
65
<?php
66
}
13
14
function widget($args, $instance) {
15
global $bp;
16
+
17
extract( $args );
18
+
19
echo $before_widget;
20
echo $before_title
21
+ . $widget_name .
22
+ ' <a class="rss-image" href="' . bp_get_sitewide_activity_feed_link() . '" title="' . __( 'Site Wide Activity RSS Feed', 'buddypress' ) . '">' . __( '[RSS]', 'buddypress' ) . '</a>'
23
. $after_title; ?>
24
+
25
<?php if ( bp_has_activities( 'type=sitewide&max=' . $instance['max_items'] . '&per_page=' . $instance['per_page'] ) ) : ?>
26
27
<?php if ( !file_exists( WP_CONTENT_DIR . '/bp-themes' ) ) : ?>
29
<div class="pag-count" id="activity-count">
30
<?php bp_activity_pagination_count() ?>
31
</div>
32
+
33
<div class="pagination-links" id="activity-pag">
34
&nbsp; <?php bp_activity_pagination_links() ?>
35
</div>
36
</div>
37
+
38
<ul id="activity-filter-links">
39
<?php bp_activity_filter_links() ?>
40
</ul>
41
<?php endif; ?>
42
+
43
<ul id="site-wide-stream" class="activity-list">
44
<?php while ( bp_activities() ) : bp_the_activity(); ?>
45
<li class="<?php bp_activity_css_class() ?>">
48
<?php bp_activity_avatar() ?>
49
</div>
50
<?php endif; ?>
51
+
52
<?php bp_activity_content() ?>
53
</li>
54
<?php endwhile; ?>
60
<?php _e('There has been no recent site activity.', 'buddypress') ?>
61
</div>
62
<?php endif;?>
63
+
64
<?php echo $after_widget; ?>
65
<?php
66
}
bp-activity/deprecated/bp-activity-deprecated.php CHANGED
@@ -3,7 +3,7 @@
3
* Deprecated Activity Stream Functionality
4
*
5
* This file contains functions that are deprecated.
6
- * You should not under any circumstance use these functions as they are
7
* either no longer valid, or have been replaced with something much more awesome.
8
*
9
* If you are using functions in this file you should slap the back of your head
@@ -12,9 +12,9 @@
12
*
13
* Of course, things will still work if you use these functions but you will
14
* be the laughing stock of the BuddyPress community. We will all point and laugh at
15
- * you. You'll also be making things harder for yourself in the long run,
16
* and you will miss out on lovely performance and functionality improvements.
17
- *
18
* If you've checked you are not using any deprecated functions and finished your little
19
* dance, you can add the following line to your wp-config.php file to prevent any of
20
* these old functions from being loaded:
@@ -24,59 +24,59 @@
24
25
function bp_activity_deprecated_globals() {
26
global $bp;
27
-
28
/* If we are using a BuddyPress 1.1+ theme ignore this. */
29
if ( !file_exists( WP_CONTENT_DIR . '/bp-themes' ) )
30
return $template;
31
32
$bp->activity->image_base = BP_PLUGIN_URL . '/bp-activity/images';
33
}
34
- add_action( 'plugins_loaded', 'bp_activity_deprecated_globals', 5 );
35
add_action( 'admin_menu', 'bp_activity_deprecated_globals', 2 );
36
37
/* DEPRECATED - use bp_activity_add() */
38
function bp_activity_record( $item_id, $component_name, $component_action, $is_private, $secondary_item_id = false, $user_id = false, $secondary_user_id = false, $recorded_time = false ) {
39
global $bp, $wpdb;
40
-
41
if ( !$user_id )
42
$user_id = $bp->loggedin_user->id;
43
44
if ( !$recorded_time )
45
$recorded_time = time();
46
-
47
$args = compact( 'user_id', 'content', 'component_name', 'component_action', 'item_id', 'secondary_item_id', 'recorded_time' );
48
bp_activity_add( $args );
49
-
50
if ( $secondary_user_id ) {
51
$hide_sitewide = true;
52
$args = compact( 'user_id', 'content', 'component_name', 'component_action', 'item_id', 'secondary_item_id', 'recorded_time', 'hide_sitewide' );
53
bp_activity_add( $args );
54
}
55
-
56
do_action( 'bp_activity_record', $item_id, $component_name, $component_action, $is_private, $secondary_item_id, $user_id, $secondary_user_id );
57
-
58
return true;
59
}
60
61
/* DEPRECATED - use bp_activity_delete_by_item_id() */
62
- function bp_activity_delete( $item_id, $component_name, $component_action, $user_id, $secondary_item_id ) {
63
if ( !bp_activity_delete_by_item_id( array( 'item_id' => $item_id, 'component_name' => $component_name, 'component_action' => $component_action, 'user_id' => $user_id, 'secondary_item_id' => $secondary_item_id ) ) )
64
return false;
65
-
66
do_action( 'bp_activity_delete', $item_id, $component_name, $component_action, $user_id, $secondary_item_id );
67
-
68
return true;
69
}
70
71
/* DEPRECATED - use the activity template loop directly */
72
function bp_activity_get_list( $user_id, $title, $no_activity, $limit = false ) {
73
global $bp_activity_user_id, $bp_activity_limit, $bp_activity_title, $bp_activity_no_activity;
74
-
75
$bp_activity_user_id = $user_id;
76
$bp_activity_limit = $limit;
77
$bp_activity_title = $title;
78
$bp_activity_no_activity = $no_activity;
79
-
80
locate_template( array( '/activity/activity-list.php' ), true );
81
}
82
@@ -86,9 +86,9 @@ function bp_activity_add_structure_css() {
86
/* If we are using a BuddyPress 1.1+ theme ignore this. */
87
if ( !file_exists( WP_CONTENT_DIR . '/bp-themes' ) )
88
return $template;
89
-
90
/* Enqueue the structure CSS file to give basic positional formatting for components */
91
- wp_enqueue_style( 'bp-activity-structure', BP_PLUGIN_URL . '/bp-activity/deprecated/css/structure.css' );
92
}
93
add_action( 'bp_styles', 'bp_activity_add_structure_css' );
94
3
* Deprecated Activity Stream Functionality
4
*
5
* This file contains functions that are deprecated.
6
+ * You should not under any circumstance use these functions as they are
7
* either no longer valid, or have been replaced with something much more awesome.
8
*
9
* If you are using functions in this file you should slap the back of your head
12
*
13
* Of course, things will still work if you use these functions but you will
14
* be the laughing stock of the BuddyPress community. We will all point and laugh at
15
+ * you. You'll also be making things harder for yourself in the long run,
16
* and you will miss out on lovely performance and functionality improvements.
17
+ *
18
* If you've checked you are not using any deprecated functions and finished your little
19
* dance, you can add the following line to your wp-config.php file to prevent any of
20
* these old functions from being loaded:
24
25
function bp_activity_deprecated_globals() {
26
global $bp;
27
+
28
/* If we are using a BuddyPress 1.1+ theme ignore this. */
29
if ( !file_exists( WP_CONTENT_DIR . '/bp-themes' ) )
30
return $template;
31
32
$bp->activity->image_base = BP_PLUGIN_URL . '/bp-activity/images';
33
}
34
+ add_action( 'plugins_loaded', 'bp_activity_deprecated_globals', 5 );
35
add_action( 'admin_menu', 'bp_activity_deprecated_globals', 2 );
36
37
/* DEPRECATED - use bp_activity_add() */
38
function bp_activity_record( $item_id, $component_name, $component_action, $is_private, $secondary_item_id = false, $user_id = false, $secondary_user_id = false, $recorded_time = false ) {
39
global $bp, $wpdb;
40
+
41
if ( !$user_id )
42
$user_id = $bp->loggedin_user->id;
43
44
if ( !$recorded_time )
45
$recorded_time = time();
46
+
47
$args = compact( 'user_id', 'content', 'component_name', 'component_action', 'item_id', 'secondary_item_id', 'recorded_time' );
48
bp_activity_add( $args );
49
+
50
if ( $secondary_user_id ) {
51
$hide_sitewide = true;
52
$args = compact( 'user_id', 'content', 'component_name', 'component_action', 'item_id', 'secondary_item_id', 'recorded_time', 'hide_sitewide' );
53
bp_activity_add( $args );
54
}
55
+
56
do_action( 'bp_activity_record', $item_id, $component_name, $component_action, $is_private, $secondary_item_id, $user_id, $secondary_user_id );
57
+
58
return true;
59
}
60
61
/* DEPRECATED - use bp_activity_delete_by_item_id() */
62
+ function bp_activity_delete( $item_id, $component_name, $component_action, $user_id, $secondary_item_id ) {
63
if ( !bp_activity_delete_by_item_id( array( 'item_id' => $item_id, 'component_name' => $component_name, 'component_action' => $component_action, 'user_id' => $user_id, 'secondary_item_id' => $secondary_item_id ) ) )
64
return false;
65
+
66
do_action( 'bp_activity_delete', $item_id, $component_name, $component_action, $user_id, $secondary_item_id );
67
+
68
return true;
69
}
70
71
/* DEPRECATED - use the activity template loop directly */
72
function bp_activity_get_list( $user_id, $title, $no_activity, $limit = false ) {
73
global $bp_activity_user_id, $bp_activity_limit, $bp_activity_title, $bp_activity_no_activity;
74
+
75
$bp_activity_user_id = $user_id;
76
$bp_activity_limit = $limit;
77
$bp_activity_title = $title;
78
$bp_activity_no_activity = $no_activity;
79
+
80
locate_template( array( '/activity/activity-list.php' ), true );
81
}
82
86
/* If we are using a BuddyPress 1.1+ theme ignore this. */
87
if ( !file_exists( WP_CONTENT_DIR . '/bp-themes' ) )
88
return $template;
89
+
90
/* Enqueue the structure CSS file to give basic positional formatting for components */
91
+ wp_enqueue_style( 'bp-activity-structure', BP_PLUGIN_URL . '/bp-activity/deprecated/css/structure.css' );
92
}
93
add_action( 'bp_styles', 'bp_activity_add_structure_css' );
94
bp-activity/deprecated/css/structure.css CHANGED
File without changes
bp-activity/deprecated/images/rss.png CHANGED
File without changes
bp-activity/feeds/bp-activity-friends-feed.php CHANGED
File without changes
bp-activity/feeds/bp-activity-personal-feed.php CHANGED
File without changes
bp-activity/feeds/bp-activity-sitewide-feed.php CHANGED
File without changes
bp-blogs.php CHANGED
@@ -12,14 +12,14 @@ require ( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-widgets.php' );
12
13
/* Include deprecated functions if settings allow */
14
if ( !defined( 'BP_IGNORE_DEPRECATED' ) )
15
- require ( BP_PLUGIN_DIR . '/bp-blogs/deprecated/bp-blogs-deprecated.php' );
16
-
17
function bp_blogs_install() {
18
global $wpdb, $bp;
19
-
20
if ( !empty($wpdb->charset) )
21
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
22
-
23
$sql[] = "CREATE TABLE {$bp->blogs->table_name} (
24
id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
25
user_id bigint(20) NOT NULL,
@@ -51,7 +51,7 @@ function bp_blogs_install() {
51
KEY comment_id (comment_id),
52
KEY comment_post_id (comment_post_id)
53
) {$charset_collate};";
54
-
55
$sql[] = "CREATE TABLE {$bp->blogs->table_name_blogmeta} (
56
id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
57
blog_id bigint(20) NOT NULL,
@@ -60,42 +60,42 @@ function bp_blogs_install() {
60
KEY blog_id (blog_id),
61
KEY meta_key (meta_key)
62
) {$charset_collate};";
63
-
64
-
65
require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
66
67
dbDelta($sql);
68
69
// On first installation - record all existing blogs in the system.
70
if ( !(int)get_site_option( 'bp-blogs-first-install') ) {
71
-
72
bp_blogs_record_existing_blogs();
73
add_site_option( 'bp-blogs-first-install', 1 );
74
-
75
} else {
76
-
77
- // Import blog titles and descriptions into the blogmeta table
78
if ( get_site_option( 'bp-blogs-version' ) <= '0.1.5' ) {
79
$blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM " . $bp->blogs->table_name ) );
80
81
for ( $i = 0; $i < count($blog_ids); $i++ ) {
82
$name = get_blog_option( $blog_ids[$i], 'blogname' );
83
$desc = get_blog_option( $blog_ids[$i], 'blogdescription' );
84
-
85
bp_blogs_update_blogmeta( $blog_ids[$i], 'name', $name );
86
bp_blogs_update_blogmeta( $blog_ids[$i], 'description', $desc );
87
bp_blogs_update_blogmeta( $blog_ids[$i], 'last_activity', time() );
88
}
89
}
90
-
91
}
92
-
93
update_site_option( 'bp-blogs-db-version', BP_BLOGS_DB_VERSION );
94
}
95
96
- function bp_blogs_check_installed() {
97
global $wpdb, $bp, $userdata;
98
-
99
if ( is_site_admin() ) {
100
/* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
101
if ( get_site_option('bp-blogs-db-version') < BP_BLOGS_DB_VERSION )
@@ -106,27 +106,27 @@ add_action( 'admin_menu', 'bp_blogs_check_installed' );
106
107
function bp_blogs_setup_globals() {
108
global $bp, $wpdb;
109
-
110
/* For internal identification */
111
$bp->blogs->id = 'blogs';
112
-
113
$bp->blogs->table_name = $wpdb->base_prefix . 'bp_user_blogs';
114
$bp->blogs->table_name_blog_posts = $wpdb->base_prefix . 'bp_user_blogs_posts';
115
$bp->blogs->table_name_blog_comments = $wpdb->base_prefix . 'bp_user_blogs_comments';
116
$bp->blogs->table_name_blogmeta = $wpdb->base_prefix . 'bp_user_blogs_blogmeta';
117
$bp->blogs->format_notification_function = 'bp_blogs_format_notifications';
118
$bp->blogs->slug = BP_BLOGS_SLUG;
119
-
120
/* Register this in the active components array */
121
$bp->active_components[$bp->blogs->slug] = $bp->blogs->id;
122
123
do_action( 'bp_blogs_setup_globals' );
124
}
125
- add_action( 'plugins_loaded', 'bp_blogs_setup_globals', 5 );
126
add_action( 'admin_menu', 'bp_blogs_setup_globals', 2 );
127
128
function bp_blogs_setup_root_component() {
129
- /* Register 'groups' as a root component */
130
bp_core_add_root_component( BP_BLOGS_SLUG );
131
}
132
add_action( 'plugins_loaded', 'bp_blogs_setup_root_component', 2 );
@@ -135,19 +135,19 @@ add_action( 'plugins_loaded', 'bp_blogs_setup_root_component', 2 );
135
* bp_blogs_setup_nav()
136
*
137
* Adds "Blog" to the navigation arrays for the current and logged in user.
138
- *
139
* @package BuddyPress Blogs
140
* @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
141
* @uses bp_is_home() Checks to see if the current user being viewed is the logged in user
142
*/
143
function bp_blogs_setup_nav() {
144
global $bp;
145
-
146
/* Add 'Blogs' to the main navigation */
147
bp_core_new_nav_item( array( 'name' => __( 'Blogs', 'buddypress' ), 'slug' => $bp->blogs->slug, 'position' => 30, 'screen_function' => 'bp_blogs_screen_my_blogs', 'default_subnav_slug' => 'my-blogs', 'item_css_id' => $bp->blogs->id ) );
148
-
149
$blogs_link = $bp->loggedin_user->domain . $bp->blogs->slug . '/';
150
-
151
/* Add the subnav items to the blogs nav item */
152
bp_core_new_subnav_item( array( 'name' => __( 'My Blogs', 'buddypress' ), 'slug' => 'my-blogs', 'parent_url' => $blogs_link, 'parent_slug' => $bp->blogs->slug, 'screen_function' => 'bp_blogs_screen_my_blogs', 'position' => 10, 'item_css_id' => 'my-blogs-list' ) );
153
bp_core_new_subnav_item( array( 'name' => __( 'Recent Posts', 'buddypress' ), 'slug' => 'recent-posts', 'parent_url' => $blogs_link, 'parent_slug' => $bp->blogs->slug, 'screen_function' => 'bp_blogs_screen_recent_posts', 'position' => 20 ) );
@@ -158,15 +158,15 @@ function bp_blogs_setup_nav() {
158
if ( 'blogs' == $bp->current_component ) {
159
if ( bp_is_home() ) {
160
if ( function_exists('xprofile_setup_nav') ) {
161
- $bp->bp_options_title = __('My Blogs', 'buddypress');
162
}
163
} else {
164
/* If we are not viewing the logged in user, set up the current users avatar and name */
165
$bp->bp_options_avatar = bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => 'thumb' ) );
166
- $bp->bp_options_title = $bp->displayed_user->fullname;
167
}
168
}
169
-
170
do_action( 'bp_blogs_setup_nav' );
171
}
172
add_action( 'plugins_loaded', 'bp_blogs_setup_nav' );
@@ -177,7 +177,7 @@ function bp_blogs_directory_blogs_setup() {
177
178
if ( $bp->current_component == $bp->blogs->slug && empty( $bp->current_action ) ) {
179
$bp->is_directory = true;
180
-
181
do_action( 'bp_blogs_directory_blogs_setup' );
182
bp_core_load_template( apply_filters( 'bp_blogs_template_directory_blogs_setup', 'directories/blogs/index' ) );
183
}
@@ -195,7 +195,7 @@ add_action( 'wp', 'bp_blogs_directory_blogs_setup', 2 );
195
196
function bp_blogs_screen_my_blogs() {
197
do_action( 'bp_blogs_screen_my_blogs' );
198
- bp_core_load_template( apply_filters( 'bp_blogs_template_my_blogs', 'blogs/my-blogs' ) );
199
}
200
201
function bp_blogs_screen_recent_posts() {
@@ -223,7 +223,7 @@ function bp_blogs_screen_create_a_blog() {
223
224
function bp_blogs_register_activity_actions() {
225
global $bp;
226
-
227
if ( !function_exists( 'bp_activity_set_action' ) )
228
return false;
229
@@ -237,15 +237,15 @@ add_action( 'plugins_loaded', 'bp_blogs_register_activity_actions' );
237
238
function bp_blogs_record_activity( $args = '' ) {
239
global $bp;
240
-
241
if ( !function_exists( 'bp_activity_add' ) )
242
return false;
243
-
244
/* Because blog, comment, and blog post code execution happens before anything else
245
we may need to manually instantiate the activity component globals */
246
if ( !$bp->activity && function_exists('bp_activity_setup_globals') )
247
bp_activity_setup_globals();
248
-
249
$defaults = array(
250
'user_id' => $bp->loggedin_user->id,
251
'content' => false,
@@ -259,19 +259,19 @@ function bp_blogs_record_activity( $args = '' ) {
259
);
260
261
$r = wp_parse_args( $args, $defaults );
262
- extract( $r, EXTR_SKIP );
263
-
264
return bp_activity_add( array( 'user_id' => $user_id, 'content' => $content, 'primary_link' => $primary_link, 'component_name' => $component_name, 'component_action' => $component_action, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) );
265
}
266
267
function bp_blogs_delete_activity( $args = true ) {
268
if ( function_exists('bp_activity_delete_by_item_id') ) {
269
extract($args);
270
-
271
- bp_activity_delete_by_item_id( array(
272
- 'item_id' => $item_id,
273
'component_name' => $component_name,
274
- 'component_action' => $component_action,
275
'user_id' => $user_id,
276
'secondary_item_id' => $secondary_item_id
277
) );
@@ -291,7 +291,7 @@ function bp_blogs_record_existing_blogs() {
291
global $wpdb;
292
293
$blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM {$wpdb->base_prefix}blogs WHERE public = 1 AND mature = 0 AND spam = 0 AND deleted = 0" ) );
294
-
295
if ( $blog_ids ) {
296
foreach( $blog_ids as $blog_id ) {
297
$users = get_users_of_blog( $blog_id );
@@ -310,67 +310,67 @@ function bp_blogs_record_existing_blogs() {
310
311
function bp_blogs_record_blog( $blog_id, $user_id, $no_activity = true ) {
312
global $bp;
313
-
314
if ( !$user_id )
315
$user_id = $bp->loggedin_user->id;
316
-
317
$name = get_blog_option( $blog_id, 'blogname' );
318
$description = get_blog_option( $blog_id, 'blogdescription' );
319
-
320
$recorded_blog = new BP_Blogs_Blog;
321
$recorded_blog->user_id = $user_id;
322
$recorded_blog->blog_id = $blog_id;
323
324
$recorded_blog_id = $recorded_blog->save();
325
-
326
bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'name', $name );
327
bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'description', $description );
328
bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'last_activity', time() );
329
-
330
/* Only record this activity if the blog is public */
331
if ( (int)$_POST['blog_public'] || !$no_activity ) {
332
/* Record this in activity streams */
333
bp_blogs_record_activity( array(
334
'user_id' => $recorded_blog->user_id,
335
- 'content' => apply_filters( 'bp_blogs_activity_created_blog', sprintf( __( '%s created the blog %s', 'buddypress'), bp_core_get_userlink( $recorded_blog->user_id ), '<a href="' . get_blog_option( $recorded_blog->blog_id, 'siteurl' ) . '">' . attribute_escape( $name ) . '</a>' ), &$recorded_blog, $name, $description ),
336
'primary_link' => apply_filters( 'bp_blogs_activity_created_blog_primary_link', get_blog_option( $recorded_blog->blog_id, 'siteurl' ), $recorded_blog->blog_id ),
337
'component_action' => 'new_blog',
338
'item_id' => $recorded_blog->blog_id
339
) );
340
}
341
-
342
do_action( 'bp_blogs_new_blog', &$recorded_blog, $is_private, $is_recorded );
343
}
344
add_action( 'wpmu_new_blog', 'bp_blogs_record_blog', 10, 2 );
345
346
function bp_blogs_record_post( $post_id, $post, $user_id = false ) {
347
global $bp, $wpdb;
348
-
349
$post_id = (int)$post_id;
350
$blog_id = (int)$wpdb->blogid;
351
-
352
if ( !$user_id )
353
$user_id = (int)$post->post_author;
354
-
355
/* This is to stop infinate loops with Donncha's sitewide tags plugin */
356
if ( (int)get_site_option( 'tags_blog_id' ) == (int)$blog_id )
357
return false;
358
-
359
/* Don't record this if it's not a post */
360
if ( $post->post_type != 'post' )
361
return false;
362
-
363
if ( !$is_recorded = BP_Blogs_Post::is_recorded( $post_id, $blog_id, $user_id ) ) {
364
if ( 'publish' == $post->post_status && '' == $post->post_password ) {
365
-
366
$recorded_post = new BP_Blogs_Post;
367
$recorded_post->user_id = $user_id;
368
$recorded_post->blog_id = $blog_id;
369
$recorded_post->post_id = $post_id;
370
$recorded_post->date_created = strtotime( $post->post_date );
371
-
372
$recorded_post_id = $recorded_post->save();
373
-
374
bp_blogs_update_blogmeta( $recorded_post->blog_id, 'last_activity', time() );
375
376
if ( (int)get_blog_option( $blog_id, 'blog_public' ) ) {
@@ -379,10 +379,10 @@ function bp_blogs_record_post( $post_id, $post, $user_id = false ) {
379
380
$activity_content = sprintf( __( '%s wrote a new blog post: %s', 'buddypress' ), bp_core_get_userlink( (int)$post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>' );
381
$activity_content .= "<blockquote>" . bp_create_excerpt( $post->post_content ) . "</blockquote>";
382
-
383
bp_blogs_record_activity( array(
384
'user_id' => (int)$post->post_author,
385
- 'content' => apply_filters( 'bp_blogs_activity_new_post', $activity_content, &$post, $post_permalink ),
386
'primary_link' => apply_filters( 'bp_blogs_activity_new_post_primary_link', $post_permalink, $post_id ),
387
'component_action' => 'new_blog_post',
388
'item_id' => $recorded_post_id,
@@ -398,28 +398,28 @@ function bp_blogs_record_post( $post_id, $post, $user_id = false ) {
398
399
/* Delete the recorded post if the status is not published or it is password protected */
400
if ( 'publish' != $post->post_status || '' != $post->post_password ) {
401
- return bp_blogs_remove_post( $post_id, $blog_id, $existing_post );
402
-
403
/* If the post author has changed, delete the post and re-add it. */
404
} else if ( (int)$existing_post->user_id != (int)$post->post_author ) {
405
// Delete the existing recorded post
406
bp_blogs_remove_post( $post_id, $blog_id, $existing_post );
407
-
408
// Re-record the post with the new author.
409
- bp_blogs_record_post( $post_id );
410
}
411
412
if ( (int)get_blog_option( $blog_id, 'blog_public' ) ) {
413
- /* Now re-record the post in the activity streams */
414
$post_permalink = bp_post_get_permalink( $post, $blog_id );
415
416
$activity_content = sprintf( __( '%s wrote a new blog post: %s', 'buddypress' ), bp_core_get_userlink( (int)$post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>' );
417
$activity_content .= "<blockquote>" . bp_create_excerpt( $post->post_content ) . "</blockquote>";
418
-
419
/* Record this in activity streams */
420
bp_blogs_record_activity( array(
421
'user_id' => (int)$post->post_author,
422
- 'content' => apply_filters( 'bp_blogs_activity_new_post', $activity_content, &$post, $post_permalink ),
423
'primary_link' => apply_filters( 'bp_blogs_activity_new_post_primary_link', $post_permalink, $post_id ),
424
'component_action' => 'new_blog_post',
425
'item_id' => $existing_post->id,
@@ -434,20 +434,24 @@ add_action( 'save_post', 'bp_blogs_record_post', 10, 2 );
434
435
function bp_blogs_record_comment( $comment_id, $is_approved ) {
436
global $wpdb, $bp;
437
-
438
if ( !$is_approved )
439