BuddyPress - Version 2.6.4

Version Description

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

Download this release

Release Info

Developer netweb
Plugin Icon 128x128 BuddyPress
Version 2.6.4
Comparing to
See all releases

Code changes from version 2.7.5 to 2.6.4

Files changed (503) hide show
  1. bp-activity/bp-activity-actions.php +40 -1
  2. bp-activity/bp-activity-akismet.php +0 -23
  3. bp-activity/bp-activity-cache.php +0 -21
  4. bp-activity/bp-activity-filters.php +11 -15
  5. bp-activity/bp-activity-functions.php +52 -232
  6. bp-activity/bp-activity-loader.php +1 -1
  7. bp-activity/bp-activity-notifications.php +225 -23
  8. bp-activity/bp-activity-screens.php +1 -1
  9. bp-activity/bp-activity-template.php +11 -11
  10. bp-activity/classes/class-bp-activity-activity.php +2 -24
  11. bp-activity/classes/class-bp-activity-component.php +16 -11
  12. bp-activity/classes/class-bp-activity-list-table.php +2 -20
  13. bp-activity/js/mentions.min.js +1 -1
  14. bp-blogs/bp-blogs-activity.php +1 -1
  15. bp-blogs/bp-blogs-filters.php +0 -14
  16. bp-blogs/bp-blogs-functions.php +0 -20
  17. bp-blogs/bp-blogs-loader.php +0 -2
  18. bp-blogs/bp-blogs-template.php +22 -97
  19. bp-blogs/classes/class-bp-blogs-blog.php +10 -33
  20. bp-blogs/classes/class-bp-blogs-component.php +1 -6
  21. bp-core/admin/bp-core-admin-components.php +0 -1
  22. bp-core/admin/bp-core-admin-functions.php +0 -233
  23. bp-core/admin/bp-core-admin-schema.php +26 -13
  24. bp-core/admin/bp-core-admin-slugs.php +3 -11
  25. bp-core/admin/bp-core-admin-tools.php +29 -20
  26. bp-core/admin/css/common-rtl.css +79 -220
  27. bp-core/admin/css/common-rtl.min.css +1 -1
  28. bp-core/admin/css/common.css +79 -220
  29. bp-core/admin/css/common.min.css +1 -1
  30. bp-core/admin/images/activity-embeds.png +0 -0
  31. bp-core/admin/images/default-themes.png +0 -0
  32. bp-core/admin/images/group-type-pop.png +0 -0
  33. bp-core/admin/images/new-nav-api.png +0 -0
  34. bp-core/admin/images/user-frontpage.png +0 -0
  35. bp-core/admin/js/dismissible-admin-notices.js +0 -16
  36. bp-core/admin/js/dismissible-admin-notices.min.js +0 -1
  37. bp-core/bp-core-actions.php +4 -11
  38. bp-core/bp-core-admin.php +19 -27
  39. bp-core/bp-core-attachments.php +6 -8
  40. bp-core/bp-core-avatars.php +32 -24
  41. bp-core/bp-core-buddybar.php +11 -11
  42. bp-core/bp-core-cache.php +0 -107
  43. bp-core/bp-core-caps.php +20 -65
  44. bp-core/bp-core-catchuri.php +20 -71
  45. bp-core/bp-core-classes.php +0 -1
  46. bp-core/bp-core-cssjs.php +20 -145
  47. bp-core/bp-core-customizer-email.php +5 -3
  48. bp-core/bp-core-dependency.php +27 -0
  49. bp-core/bp-core-filters.php +43 -53
  50. bp-core/bp-core-functions.php +52 -405
  51. bp-core/bp-core-loader.php +3 -1
  52. bp-core/bp-core-options.php +61 -21
  53. bp-core/bp-core-taxonomy.php +5 -113
  54. bp-core/bp-core-template-loader.php +1 -5
  55. bp-core/bp-core-template.php +8 -77
  56. bp-core/bp-core-theme-compatibility.php +9 -11
  57. bp-core/bp-core-update.php +24 -109
  58. bp-core/bp-core-wpabstraction.php +7 -0
  59. bp-core/classes/class-bp-admin.php +97 -140
  60. bp-core/classes/class-bp-attachment-avatar.php +4 -1
  61. bp-core/classes/class-bp-attachment.php +12 -12
  62. bp-core/classes/class-bp-button.php +76 -231
  63. bp-core/classes/class-bp-core-html-element.php +0 -127
  64. bp-core/classes/class-bp-core-nav.php +15 -15
  65. bp-core/classes/class-bp-core-oembed-extension.php +15 -21
  66. bp-core/classes/class-bp-core-user.php +0 -17
  67. bp-core/classes/class-bp-theme-compat.php +1 -1
  68. bp-core/classes/class-bp-user-query.php +4 -11
  69. bp-core/css/admin-bar-rtl.css +0 -13
  70. bp-core/css/admin-bar-rtl.min.css +1 -1
  71. bp-core/css/admin-bar.css +0 -13
  72. bp-core/css/admin-bar.min.css +1 -1
  73. bp-core/css/avatar-rtl.css +1 -15
  74. bp-core/css/avatar-rtl.min.css +1 -1
  75. bp-core/css/avatar.css +1 -15
  76. bp-core/css/avatar.min.css +1 -1
  77. bp-core/deprecated/2.7.php +0 -26
  78. bp-core/js/bp-plupload.min.js +1 -1
  79. bp-core/js/confirm.min.js +1 -1
  80. bp-core/js/{vendor/jquery-cookie.js → jquery-cookie.js} +0 -0
  81. bp-core/js/{vendor/jquery-cookie.min.js → jquery-cookie.min.js} +1 -1
  82. bp-core/js/{vendor/jquery-scroll-to.js → jquery-scroll-to.js} +0 -0
  83. bp-core/js/{vendor/jquery-scroll-to.min.js → jquery-scroll-to.min.js} +1 -1
  84. bp-core/js/{vendor/jquery.atwho.js → jquery.atwho.js} +0 -0
  85. bp-core/js/jquery.atwho.min.js +1 -0
  86. bp-core/js/{vendor/jquery.atwho.txt → jquery.atwho.txt} +0 -0
  87. bp-core/js/{vendor/jquery.caret.js → jquery.caret.js} +0 -0
  88. bp-core/js/{vendor/jquery.caret.min.js → jquery.caret.min.js} +1 -1
  89. bp-core/js/{vendor/jquery.caret.txt → jquery.caret.txt} +0 -0
  90. bp-core/js/vendor/jquery.atwho.min.js +0 -1
  91. bp-core/js/vendor/livestamp.js +0 -129
  92. bp-core/js/vendor/livestamp.min.js +0 -1
  93. bp-core/js/vendor/moment-js/locale/af.js +0 -73
  94. bp-core/js/vendor/moment-js/locale/af.min.js +0 -1
  95. bp-core/js/vendor/moment-js/locale/ar-ly.js +0 -122
  96. bp-core/js/vendor/moment-js/locale/ar-ly.min.js +0 -1
  97. bp-core/js/vendor/moment-js/locale/ar-ma.js +0 -60
  98. bp-core/js/vendor/moment-js/locale/ar-ma.min.js +0 -1
  99. bp-core/js/vendor/moment-js/locale/ar-sa.js +0 -104
  100. bp-core/js/vendor/moment-js/locale/ar-sa.min.js +0 -1
  101. bp-core/js/vendor/moment-js/locale/ar-tn.js +0 -59
  102. bp-core/js/vendor/moment-js/locale/ar-tn.min.js +0 -1
  103. bp-core/js/vendor/moment-js/locale/ar.js +0 -137
  104. bp-core/js/vendor/moment-js/locale/ar.min.js +0 -1
  105. bp-core/js/vendor/moment-js/locale/az.js +0 -105
  106. bp-core/js/vendor/moment-js/locale/az.min.js +0 -1
  107. bp-core/js/vendor/moment-js/locale/be.js +0 -134
  108. bp-core/js/vendor/moment-js/locale/be.min.js +0 -1
  109. bp-core/js/vendor/moment-js/locale/bg.js +0 -90
  110. bp-core/js/vendor/moment-js/locale/bg.min.js +0 -1
  111. bp-core/js/vendor/moment-js/locale/bn.js +0 -119
  112. bp-core/js/vendor/moment-js/locale/bn.min.js +0 -1
  113. bp-core/js/vendor/moment-js/locale/bo.js +0 -119
  114. bp-core/js/vendor/moment-js/locale/bo.min.js +0 -1
  115. bp-core/js/vendor/moment-js/locale/br.js +0 -108
  116. bp-core/js/vendor/moment-js/locale/br.min.js +0 -1
  117. bp-core/js/vendor/moment-js/locale/bs.js +0 -143
  118. bp-core/js/vendor/moment-js/locale/bs.min.js +0 -1
  119. bp-core/js/vendor/moment-js/locale/ca.js +0 -81
  120. bp-core/js/vendor/moment-js/locale/ca.min.js +0 -1
  121. bp-core/js/vendor/moment-js/locale/cs.js +0 -172
  122. bp-core/js/vendor/moment-js/locale/cs.min.js +0 -1
  123. bp-core/js/vendor/moment-js/locale/cv.js +0 -63
  124. bp-core/js/vendor/moment-js/locale/cv.min.js +0 -1
  125. bp-core/js/vendor/moment-js/locale/cy.js +0 -81
  126. bp-core/js/vendor/moment-js/locale/cy.min.js +0 -1
  127. bp-core/js/vendor/moment-js/locale/da.js +0 -60
  128. bp-core/js/vendor/moment-js/locale/da.min.js +0 -1
  129. bp-core/js/vendor/moment-js/locale/de-at.js +0 -79
  130. bp-core/js/vendor/moment-js/locale/de-at.min.js +0 -1
  131. bp-core/js/vendor/moment-js/locale/de.js +0 -78
  132. bp-core/js/vendor/moment-js/locale/de.min.js +0 -1
  133. bp-core/js/vendor/moment-js/locale/dv.js +0 -99
  134. bp-core/js/vendor/moment-js/locale/dv.min.js +0 -1
  135. bp-core/js/vendor/moment-js/locale/el.js +0 -98
  136. bp-core/js/vendor/moment-js/locale/el.min.js +0 -1
  137. bp-core/js/vendor/moment-js/locale/en-au.js +0 -67
  138. bp-core/js/vendor/moment-js/locale/en-au.min.js +0 -1
  139. bp-core/js/vendor/moment-js/locale/en-ca.js +0 -63
  140. bp-core/js/vendor/moment-js/locale/en-ca.min.js +0 -1
  141. bp-core/js/vendor/moment-js/locale/en-gb.js +0 -67
  142. bp-core/js/vendor/moment-js/locale/en-gb.min.js +0 -1
  143. bp-core/js/vendor/moment-js/locale/en-ie.js +0 -67
  144. bp-core/js/vendor/moment-js/locale/en-ie.min.js +0 -1
  145. bp-core/js/vendor/moment-js/locale/en-nz.js +0 -67
  146. bp-core/js/vendor/moment-js/locale/en-nz.min.js +0 -1
  147. bp-core/js/vendor/moment-js/locale/eo.js +0 -73
  148. bp-core/js/vendor/moment-js/locale/eo.min.js +0 -1
  149. bp-core/js/vendor/moment-js/locale/es-do.js +0 -80
  150. bp-core/js/vendor/moment-js/locale/es-do.min.js +0 -1
  151. bp-core/js/vendor/moment-js/locale/es.js +0 -81
  152. bp-core/js/vendor/moment-js/locale/es.min.js +0 -1
  153. bp-core/js/vendor/moment-js/locale/et.js +0 -80
  154. bp-core/js/vendor/moment-js/locale/et.min.js +0 -1
  155. bp-core/js/vendor/moment-js/locale/eu.js +0 -66
  156. bp-core/js/vendor/moment-js/locale/eu.min.js +0 -1
  157. bp-core/js/vendor/moment-js/locale/fa.js +0 -106
  158. bp-core/js/vendor/moment-js/locale/fa.min.js +0 -1
  159. bp-core/js/vendor/moment-js/locale/fi.js +0 -107
  160. bp-core/js/vendor/moment-js/locale/fi.min.js +0 -1
  161. bp-core/js/vendor/moment-js/locale/fo.js +0 -60
  162. bp-core/js/vendor/moment-js/locale/fo.min.js +0 -1
  163. bp-core/js/vendor/moment-js/locale/fr-ca.js +0 -60
  164. bp-core/js/vendor/moment-js/locale/fr-ca.min.js +0 -1
  165. bp-core/js/vendor/moment-js/locale/fr-ch.js +0 -64
  166. bp-core/js/vendor/moment-js/locale/fr-ch.min.js +0 -1
  167. bp-core/js/vendor/moment-js/locale/fr.js +0 -64
  168. bp-core/js/vendor/moment-js/locale/fr.min.js +0 -1
  169. bp-core/js/vendor/moment-js/locale/fy.js +0 -73
  170. bp-core/js/vendor/moment-js/locale/fy.min.js +0 -1
  171. bp-core/js/vendor/moment-js/locale/gd.js +0 -76
  172. bp-core/js/vendor/moment-js/locale/gd.min.js +0 -1
  173. bp-core/js/vendor/moment-js/locale/gl.js +0 -77
  174. bp-core/js/vendor/moment-js/locale/gl.min.js +0 -1
  175. bp-core/js/vendor/moment-js/locale/he.js +0 -99
  176. bp-core/js/vendor/moment-js/locale/he.min.js +0 -1
  177. bp-core/js/vendor/moment-js/locale/hi.js +0 -124
  178. bp-core/js/vendor/moment-js/locale/hi.min.js +0 -1
  179. bp-core/js/vendor/moment-js/locale/hr.js +0 -145
  180. bp-core/js/vendor/moment-js/locale/hr.min.js +0 -1
  181. bp-core/js/vendor/moment-js/locale/hu.js +0 -109
  182. bp-core/js/vendor/moment-js/locale/hu.min.js +0 -1
  183. bp-core/js/vendor/moment-js/locale/hy-am.js +0 -95
  184. bp-core/js/vendor/moment-js/locale/hy-am.min.js +0 -1
  185. bp-core/js/vendor/moment-js/locale/id.js +0 -83
  186. bp-core/js/vendor/moment-js/locale/id.min.js +0 -1
  187. bp-core/js/vendor/moment-js/locale/is.js +0 -127
  188. bp-core/js/vendor/moment-js/locale/is.min.js +0 -1
  189. bp-core/js/vendor/moment-js/locale/it.js +0 -70
  190. bp-core/js/vendor/moment-js/locale/it.min.js +0 -1
  191. bp-core/js/vendor/moment-js/locale/ja.js +0 -76
  192. bp-core/js/vendor/moment-js/locale/ja.min.js +0 -1
  193. bp-core/js/vendor/moment-js/locale/jv.js +0 -83
  194. bp-core/js/vendor/moment-js/locale/jv.min.js +0 -1
  195. bp-core/js/vendor/moment-js/locale/ka.js +0 -89
  196. bp-core/js/vendor/moment-js/locale/ka.min.js +0 -1
  197. bp-core/js/vendor/moment-js/locale/kk.js +0 -87
  198. bp-core/js/vendor/moment-js/locale/kk.min.js +0 -1
  199. bp-core/js/vendor/moment-js/locale/km.js +0 -58
  200. bp-core/js/vendor/moment-js/locale/km.min.js +0 -1
  201. bp-core/js/vendor/moment-js/locale/ko.js +0 -65
  202. bp-core/js/vendor/moment-js/locale/ko.min.js +0 -1
  203. bp-core/js/vendor/moment-js/locale/ky.js +0 -88
  204. bp-core/js/vendor/moment-js/locale/ky.min.js +0 -1
  205. bp-core/js/vendor/moment-js/locale/lb.js +0 -137
  206. bp-core/js/vendor/moment-js/locale/lb.min.js +0 -1
  207. bp-core/js/vendor/moment-js/locale/lo.js +0 -70
  208. bp-core/js/vendor/moment-js/locale/lo.min.js +0 -1
  209. bp-core/js/vendor/moment-js/locale/lt.js +0 -117
  210. bp-core/js/vendor/moment-js/locale/lt.min.js +0 -1
  211. bp-core/js/vendor/moment-js/locale/lv.js +0 -97
  212. bp-core/js/vendor/moment-js/locale/lv.min.js +0 -1
  213. bp-core/js/vendor/moment-js/locale/me.js +0 -111
  214. bp-core/js/vendor/moment-js/locale/me.min.js +0 -1
  215. bp-core/js/vendor/moment-js/locale/mi.js +0 -64
  216. bp-core/js/vendor/moment-js/locale/mi.min.js +0 -1
  217. bp-core/js/vendor/moment-js/locale/mk.js +0 -90
  218. bp-core/js/vendor/moment-js/locale/mk.min.js +0 -1
  219. bp-core/js/vendor/moment-js/locale/ml.js +0 -81
  220. bp-core/js/vendor/moment-js/locale/ml.min.js +0 -1
  221. bp-core/js/vendor/moment-js/locale/mr.js +0 -159
  222. bp-core/js/vendor/moment-js/locale/mr.min.js +0 -1
  223. bp-core/js/vendor/moment-js/locale/ms-my.js +0 -83
  224. bp-core/js/vendor/moment-js/locale/ms-my.min.js +0 -1
  225. bp-core/js/vendor/moment-js/locale/ms.js +0 -82
  226. bp-core/js/vendor/moment-js/locale/ms.min.js +0 -1
  227. bp-core/js/vendor/moment-js/locale/my.js +0 -95
  228. bp-core/js/vendor/moment-js/locale/my.min.js +0 -1
  229. bp-core/js/vendor/moment-js/locale/nb.js +0 -63
  230. bp-core/js/vendor/moment-js/locale/nb.min.js +0 -1
  231. bp-core/js/vendor/moment-js/locale/ne.js +0 -123
  232. bp-core/js/vendor/moment-js/locale/ne.min.js +0 -1
  233. bp-core/js/vendor/moment-js/locale/nl.js +0 -86
  234. bp-core/js/vendor/moment-js/locale/nl.min.js +0 -1
  235. bp-core/js/vendor/moment-js/locale/nn.js +0 -60
  236. bp-core/js/vendor/moment-js/locale/nn.min.js +0 -1
  237. bp-core/js/vendor/moment-js/locale/pa-in.js +0 -124
  238. bp-core/js/vendor/moment-js/locale/pa-in.min.js +0 -1
  239. bp-core/js/vendor/moment-js/locale/pl.js +0 -105
  240. bp-core/js/vendor/moment-js/locale/pl.min.js +0 -1
  241. bp-core/js/vendor/moment-js/locale/pt-br.js +0 -61
  242. bp-core/js/vendor/moment-js/locale/pt-br.min.js +0 -1
  243. bp-core/js/vendor/moment-js/locale/pt.js +0 -65
  244. bp-core/js/vendor/moment-js/locale/pt.min.js +0 -1
  245. bp-core/js/vendor/moment-js/locale/ro.js +0 -75
  246. bp-core/js/vendor/moment-js/locale/ro.min.js +0 -1
  247. bp-core/js/vendor/moment-js/locale/ru.js +0 -183
  248. bp-core/js/vendor/moment-js/locale/ru.min.js +0 -1
  249. bp-core/js/vendor/moment-js/locale/se.js +0 -61
  250. bp-core/js/vendor/moment-js/locale/se.min.js +0 -1
  251. bp-core/js/vendor/moment-js/locale/si.js +0 -71
  252. bp-core/js/vendor/moment-js/locale/si.min.js +0 -1
  253. bp-core/js/vendor/moment-js/locale/sk.js +0 -150
  254. bp-core/js/vendor/moment-js/locale/sk.min.js +0 -1
  255. bp-core/js/vendor/moment-js/locale/sl.js +0 -162
  256. bp-core/js/vendor/moment-js/locale/sl.min.js +0 -1
  257. bp-core/js/vendor/moment-js/locale/sq.js +0 -70
  258. bp-core/js/vendor/moment-js/locale/sq.min.js +0 -1
  259. bp-core/js/vendor/moment-js/locale/sr-cyrl.js +0 -110
  260. bp-core/js/vendor/moment-js/locale/sr-cyrl.min.js +0 -1
  261. bp-core/js/vendor/moment-js/locale/sr.js +0 -110
  262. bp-core/js/vendor/moment-js/locale/sr.min.js +0 -1
  263. bp-core/js/vendor/moment-js/locale/ss.js +0 -89
  264. bp-core/js/vendor/moment-js/locale/ss.min.js +0 -1
  265. bp-core/js/vendor/moment-js/locale/sv.js +0 -69
  266. bp-core/js/vendor/moment-js/locale/sv.min.js +0 -1
  267. bp-core/js/vendor/moment-js/locale/sw.js +0 -59
  268. bp-core/js/vendor/moment-js/locale/sw.min.js +0 -1
  269. bp-core/js/vendor/moment-js/locale/ta.js +0 -129
  270. bp-core/js/vendor/moment-js/locale/ta.min.js +0 -1
  271. bp-core/js/vendor/moment-js/locale/te.js +0 -89
  272. bp-core/js/vendor/moment-js/locale/te.min.js +0 -1
  273. bp-core/js/vendor/moment-js/locale/th.js +0 -67
  274. bp-core/js/vendor/moment-js/locale/th.min.js +0 -1
  275. bp-core/js/vendor/moment-js/locale/tl-ph.js +0 -62
  276. bp-core/js/vendor/moment-js/locale/tl-ph.min.js +0 -1
  277. bp-core/js/vendor/moment-js/locale/tlh.js +0 -120
  278. bp-core/js/vendor/moment-js/locale/tlh.min.js +0 -1
  279. bp-core/js/vendor/moment-js/locale/tr.js +0 -90
  280. bp-core/js/vendor/moment-js/locale/tr.min.js +0 -1
  281. bp-core/js/vendor/moment-js/locale/tzl.js +0 -91
  282. bp-core/js/vendor/moment-js/locale/tzl.min.js +0 -1
  283. bp-core/js/vendor/moment-js/locale/tzm-latn.js +0 -58
  284. bp-core/js/vendor/moment-js/locale/tzm-latn.min.js +0 -1
  285. bp-core/js/vendor/moment-js/locale/tzm.js +0 -58
  286. bp-core/js/vendor/moment-js/locale/tzm.min.js +0 -1
  287. bp-core/js/vendor/moment-js/locale/uk.js +0 -146
  288. bp-core/js/vendor/moment-js/locale/uk.min.js +0 -1
  289. bp-core/js/vendor/moment-js/locale/uz.js +0 -58
  290. bp-core/js/vendor/moment-js/locale/uz.min.js +0 -1
  291. bp-core/js/vendor/moment-js/locale/vi.js +0 -79
  292. bp-core/js/vendor/moment-js/locale/vi.min.js +0 -1
  293. bp-core/js/vendor/moment-js/locale/x-pseudo.js +0 -68
  294. bp-core/js/vendor/moment-js/locale/x-pseudo.min.js +0 -1
  295. bp-core/js/vendor/moment-js/locale/zh-cn.js +0 -127
  296. bp-core/js/vendor/moment-js/locale/zh-cn.min.js +0 -1
  297. bp-core/js/vendor/moment-js/locale/zh-hk.js +0 -105
  298. bp-core/js/vendor/moment-js/locale/zh-hk.min.js +0 -1
  299. bp-core/js/vendor/moment-js/locale/zh-tw.js +0 -104
  300. bp-core/js/vendor/moment-js/locale/zh-tw.min.js +0 -1
  301. bp-core/js/vendor/moment-js/moment.js +0 -4234
  302. bp-core/js/vendor/moment-js/moment.min.js +0 -2
  303. bp-forums/bp-forums-bbpress-sa.php +11 -8
  304. bp-forums/bp-forums-loader.php +0 -18
  305. bp-forums/bp-forums-template.php +14 -9
  306. bp-friends/bp-friends-actions.php +2 -2
  307. bp-friends/bp-friends-cache.php +0 -41
  308. bp-friends/bp-friends-filters.php +34 -7
  309. bp-friends/bp-friends-functions.php +0 -75
  310. bp-friends/bp-friends-loader.php +1 -1
  311. bp-friends/bp-friends-notifications.php +96 -15
  312. bp-friends/bp-friends-template.php +4 -0
  313. bp-friends/bp-friends-widgets.php +2 -2
  314. bp-friends/classes/class-bp-core-friends-widget.php +10 -7
  315. bp-friends/classes/class-bp-friends-component.php +2 -8
  316. bp-friends/classes/class-bp-friends-friendship.php +49 -296
  317. bp-groups/admin/css/admin-rtl.css +7 -17
  318. bp-groups/admin/css/admin-rtl.min.css +1 -1
  319. bp-groups/admin/css/admin.css +7 -17
  320. bp-groups/admin/css/admin.min.css +1 -1
  321. bp-groups/admin/js/admin.min.js +1 -1
  322. bp-groups/bp-groups-actions.php +2 -33
  323. bp-groups/bp-groups-activity.php +14 -5
  324. bp-groups/bp-groups-admin.php +26 -129
  325. bp-groups/bp-groups-cache.php +3 -73
  326. bp-groups/bp-groups-filters.php +1 -1
  327. bp-groups/bp-groups-forums.php +1 -1
  328. bp-groups/bp-groups-functions.php +72 -168
  329. bp-groups/bp-groups-loader.php +1 -1
  330. bp-groups/bp-groups-notifications.php +11 -53
  331. bp-groups/bp-groups-screens.php +1 -43
  332. bp-groups/bp-groups-template.php +79 -347
  333. bp-groups/bp-groups-widgets.php +11 -7
  334. bp-groups/classes/class-bp-group-extension.php +10 -4
  335. bp-groups/classes/class-bp-groups-component.php +16 -16
  336. bp-groups/classes/class-bp-groups-group-members-template.php +3 -5
  337. bp-groups/classes/class-bp-groups-group.php +178 -370
  338. bp-groups/classes/class-bp-groups-invite-template.php +2 -4
  339. bp-groups/classes/class-bp-groups-list-table.php +3 -147
  340. bp-groups/classes/class-bp-groups-member-suggestions.php +6 -1
  341. bp-groups/classes/class-bp-groups-member.php +27 -90
  342. bp-groups/classes/class-bp-groups-template.php +6 -5
  343. bp-groups/classes/class-bp-groups-theme-compat.php +4 -8
  344. bp-groups/classes/class-bp-groups-widget.php +1 -1
  345. bp-loader.php +6 -7
  346. bp-members/bp-members-cache.php +1 -13
  347. bp-members/bp-members-functions.php +5 -40
  348. bp-members/bp-members-screens.php +2 -2
  349. bp-members/bp-members-template.php +34 -60
  350. bp-members/classes/class-bp-core-members-widget.php +13 -9
  351. bp-members/classes/class-bp-core-recently-active-widget.php +3 -1
  352. bp-members/classes/class-bp-core-whos-online-widget.php +4 -1
  353. bp-members/classes/class-bp-members-admin.php +0 -277
  354. bp-members/classes/class-bp-members-component.php +1 -5
  355. bp-messages/bp-messages-functions.php +8 -106
  356. bp-messages/bp-messages-loader.php +1 -3
  357. bp-messages/bp-messages-notifications.php +104 -21
  358. bp-messages/bp-messages-template.php +1 -0
  359. bp-messages/classes/class-bp-messages-component.php +1 -3
  360. bp-messages/classes/class-bp-messages-message.php +6 -12
  361. bp-messages/classes/class-bp-messages-notice.php +2 -8
  362. bp-messages/classes/class-bp-messages-thread.php +7 -30
  363. bp-messages/js/autocomplete/jquery.autocomplete.min.js +1 -1
  364. bp-messages/js/autocomplete/jquery.dimensions.min.js +1 -1
  365. bp-notifications/bp-notifications-functions.php +2 -4
  366. bp-notifications/bp-notifications-loader.php +1 -1
  367. bp-notifications/classes/class-bp-notifications-notification.php +20 -26
  368. bp-settings/bp-settings-loader.php +1 -1
  369. bp-templates/bp-legacy/buddypress-functions.php +12 -44
  370. bp-templates/bp-legacy/buddypress/activity/comment.php +2 -2
  371. bp-templates/bp-legacy/buddypress/activity/entry.php +2 -2
  372. bp-templates/bp-legacy/buddypress/activity/index.php +15 -18
  373. bp-templates/bp-legacy/buddypress/activity/single/home.php +3 -7
  374. bp-templates/bp-legacy/buddypress/assets/_attachments/avatars/index.php +2 -2
  375. bp-templates/bp-legacy/buddypress/assets/_attachments/cover-images/index.php +2 -2
  376. bp-templates/bp-legacy/buddypress/blogs/create.php +3 -6
  377. bp-templates/bp-legacy/buddypress/blogs/index.php +5 -19
  378. bp-templates/bp-legacy/buddypress/common/search/dir-search-form.php +0 -16
  379. bp-templates/bp-legacy/buddypress/forums/index.php +7 -18
  380. bp-templates/bp-legacy/buddypress/groups/create.php +32 -92
  381. bp-templates/bp-legacy/buddypress/groups/groups-loop.php +2 -6
  382. bp-templates/bp-legacy/buddypress/groups/index.php +8 -25
  383. bp-templates/bp-legacy/buddypress/groups/single/activity.php +2 -2
  384. bp-templates/bp-legacy/buddypress/groups/single/admin.php +456 -19
  385. bp-templates/bp-legacy/buddypress/groups/single/admin/delete-group.php +0 -41
  386. bp-templates/bp-legacy/buddypress/groups/single/admin/edit-details.php +0 -53
  387. bp-templates/bp-legacy/buddypress/groups/single/admin/group-avatar.php +0 -67
  388. bp-templates/bp-legacy/buddypress/groups/single/admin/group-cover-image.php +0 -33
  389. bp-templates/bp-legacy/buddypress/groups/single/admin/group-settings.php +0 -124
  390. bp-templates/bp-legacy/buddypress/groups/single/admin/manage-members.php +0 -332
  391. bp-templates/bp-legacy/buddypress/groups/single/admin/membership-requests.php +0 -35
  392. bp-templates/bp-legacy/buddypress/groups/single/cover-image-header.php +6 -12
  393. bp-templates/bp-legacy/buddypress/groups/single/forum.php +1 -1
  394. bp-templates/bp-legacy/buddypress/groups/single/forum/edit.php +1 -1
  395. bp-templates/bp-legacy/buddypress/groups/single/forum/topic.php +1 -1
  396. bp-templates/bp-legacy/buddypress/groups/single/group-header.php +7 -13
  397. bp-templates/bp-legacy/buddypress/groups/single/home.php +1 -1
  398. bp-templates/bp-legacy/buddypress/groups/single/invites-loop.php +1 -1
  399. bp-templates/bp-legacy/buddypress/groups/single/members.php +1 -1
  400. bp-templates/bp-legacy/buddypress/groups/single/request-membership.php +0 -5
  401. bp-templates/bp-legacy/buddypress/groups/single/requests-loop.php +2 -2
  402. bp-templates/bp-legacy/buddypress/groups/single/send-invites.php +1 -3
  403. bp-templates/bp-legacy/buddypress/members/activate.php +3 -6
  404. bp-templates/bp-legacy/buddypress/members/index.php +7 -20
  405. bp-templates/bp-legacy/buddypress/members/members-loop.php +2 -2
  406. bp-templates/bp-legacy/buddypress/members/register.php +27 -43
  407. bp-templates/bp-legacy/buddypress/members/single/activity.php +2 -2
  408. bp-templates/bp-legacy/buddypress/members/single/blogs.php +1 -1
  409. bp-templates/bp-legacy/buddypress/members/single/cover-image-header.php +4 -7
  410. bp-templates/bp-legacy/buddypress/members/single/forums.php +1 -1
  411. bp-templates/bp-legacy/buddypress/members/single/friends.php +1 -13
  412. bp-templates/bp-legacy/buddypress/members/single/friends/requests.php +0 -5
  413. bp-templates/bp-legacy/buddypress/members/single/groups.php +1 -13
  414. bp-templates/bp-legacy/buddypress/members/single/groups/invites.php +0 -5
  415. bp-templates/bp-legacy/buddypress/members/single/home.php +1 -1
  416. bp-templates/bp-legacy/buddypress/members/single/member-header.php +4 -7
  417. bp-templates/bp-legacy/buddypress/members/single/messages.php +1 -18
  418. bp-templates/bp-legacy/buddypress/members/single/messages/compose.php +0 -5
  419. bp-templates/bp-legacy/buddypress/members/single/messages/messages-loop.php +0 -5
  420. bp-templates/bp-legacy/buddypress/members/single/messages/single.php +1 -1
  421. bp-templates/bp-legacy/buddypress/members/single/notifications.php +1 -1
  422. bp-templates/bp-legacy/buddypress/members/single/notifications/read.php +0 -5
  423. bp-templates/bp-legacy/buddypress/members/single/notifications/unread.php +0 -5
  424. bp-templates/bp-legacy/buddypress/members/single/plugins.php +1 -1
  425. bp-templates/bp-legacy/buddypress/members/single/profile.php +1 -1
  426. bp-templates/bp-legacy/buddypress/members/single/profile/change-avatar.php +2 -2
  427. bp-templates/bp-legacy/buddypress/members/single/profile/change-cover-image.php +1 -1
  428. bp-templates/bp-legacy/buddypress/members/single/profile/edit.php +2 -2
  429. bp-templates/bp-legacy/buddypress/members/single/profile/profile-loop.php +1 -1
  430. bp-templates/bp-legacy/buddypress/members/single/profile/profile-wp.php +1 -1
  431. bp-templates/bp-legacy/buddypress/members/single/settings.php +1 -1
  432. bp-templates/bp-legacy/buddypress/members/single/settings/general.php +0 -5
  433. bp-templates/bp-legacy/buddypress/members/single/settings/notifications.php +0 -5
  434. bp-templates/bp-legacy/buddypress/members/single/settings/profile.php +0 -5
  435. bp-templates/bp-legacy/css/buddypress-rtl.css +9 -35
  436. bp-templates/bp-legacy/css/buddypress-rtl.min.css +1 -1
  437. bp-templates/bp-legacy/css/buddypress.css +9 -35
  438. bp-templates/bp-legacy/css/buddypress.min.css +1 -1
  439. bp-templates/bp-legacy/css/twentyeleven-rtl.css +5 -5
  440. bp-templates/bp-legacy/css/twentyeleven-rtl.min.css +1 -1
  441. bp-templates/bp-legacy/css/twentyeleven.css +5 -5
  442. bp-templates/bp-legacy/css/twentyeleven.min.css +1 -1
  443. bp-templates/bp-legacy/css/twentyeleven.scss +5 -5
  444. bp-templates/bp-legacy/css/twentyfifteen-rtl.css +5 -15
  445. bp-templates/bp-legacy/css/twentyfifteen-rtl.min.css +1 -1
  446. bp-templates/bp-legacy/css/twentyfifteen.css +5 -15
  447. bp-templates/bp-legacy/css/twentyfifteen.min.css +1 -1
  448. bp-templates/bp-legacy/css/twentyfifteen.scss +5 -18
  449. bp-templates/bp-legacy/css/twentyfourteen-rtl.css +7 -28
  450. bp-templates/bp-legacy/css/twentyfourteen-rtl.min.css +1 -1
  451. bp-templates/bp-legacy/css/twentyfourteen.css +7 -28
  452. bp-templates/bp-legacy/css/twentyfourteen.min.css +1 -1
  453. bp-templates/bp-legacy/css/twentyfourteen.scss +8 -32
  454. bp-templates/bp-legacy/css/twentysixteen-rtl.css +9 -41
  455. bp-templates/bp-legacy/css/twentysixteen-rtl.min.css +1 -1
  456. bp-templates/bp-legacy/css/twentysixteen.css +9 -41
  457. bp-templates/bp-legacy/css/twentysixteen.min.css +1 -1
  458. bp-templates/bp-legacy/css/twentysixteen.scss +5 -49
  459. bp-templates/bp-legacy/css/twentyten-rtl.css +5 -5
  460. bp-templates/bp-legacy/css/twentyten-rtl.min.css +1 -1
  461. bp-templates/bp-legacy/css/twentyten.css +5 -5
  462. bp-templates/bp-legacy/css/twentyten.min.css +1 -1
  463. bp-templates/bp-legacy/css/twentyten.scss +5 -5
  464. bp-templates/bp-legacy/css/twentythirteen-rtl.css +12 -21
  465. bp-templates/bp-legacy/css/twentythirteen-rtl.min.css +1 -1
  466. bp-templates/bp-legacy/css/twentythirteen.css +12 -21
  467. bp-templates/bp-legacy/css/twentythirteen.min.css +1 -1
  468. bp-templates/bp-legacy/css/twentythirteen.scss +12 -21
  469. bp-templates/bp-legacy/css/twentytwelve-rtl.css +6 -10
  470. bp-templates/bp-legacy/css/twentytwelve-rtl.min.css +1 -1
  471. bp-templates/bp-legacy/css/twentytwelve.css +6 -10
  472. bp-templates/bp-legacy/css/twentytwelve.min.css +1 -1
  473. bp-templates/bp-legacy/css/twentytwelve.scss +7 -10
  474. bp-templates/bp-legacy/js/buddypress.js +2 -13
  475. bp-templates/bp-legacy/js/buddypress.min.js +2 -2
  476. bp-templates/bp-legacy/js/password-verify.min.js +1 -1
  477. bp-themes/bp-default/_inc/ajax.php +4 -11
  478. bp-xprofile/admin/css/admin-rtl.css +0 -76
  479. bp-xprofile/admin/css/admin-rtl.min.css +1 -1
  480. bp-xprofile/admin/css/admin.css +0 -76
  481. bp-xprofile/admin/css/admin.min.css +1 -1
  482. bp-xprofile/admin/js/admin.js +3 -44
  483. bp-xprofile/admin/js/admin.min.js +1 -1
  484. bp-xprofile/bp-xprofile-activity.php +1 -1
  485. bp-xprofile/bp-xprofile-admin.php +3 -8
  486. bp-xprofile/bp-xprofile-caps.php +3 -25
  487. bp-xprofile/bp-xprofile-cssjs.php +3 -3
  488. bp-xprofile/bp-xprofile-functions.php +1 -1
  489. bp-xprofile/bp-xprofile-loader.php +1 -1
  490. bp-xprofile/bp-xprofile-template.php +3 -2
  491. bp-xprofile/classes/class-bp-xprofile-field-type-datebox.php +6 -298
  492. bp-xprofile/classes/class-bp-xprofile-field-type-placeholder.php +0 -2
  493. bp-xprofile/classes/class-bp-xprofile-field-type-url.php +4 -4
  494. bp-xprofile/classes/class-bp-xprofile-field-type.php +1 -38
  495. bp-xprofile/classes/class-bp-xprofile-field.php +25 -45
  496. bp-xprofile/classes/class-bp-xprofile-group.php +2 -12
  497. bp-xprofile/classes/class-bp-xprofile-profiledata.php +6 -30
  498. bp-xprofile/classes/class-bp-xprofile-query.php +1 -1
  499. bp-xprofile/classes/class-bp-xprofile-user-admin.php +2 -2
  500. buddypress.pot +1510 -1929
  501. composer.json +5 -6
  502. humans.txt +1 -14
  503. readme.txt +15 -37
bp-activity/bp-activity-actions.php CHANGED
@@ -71,7 +71,7 @@ function bp_activity_action_permalink_router() {
71
} else {
72
73
// Set redirect to group activity stream.
74
- if ( $group = groups_get_group( $activity->item_id ) ) {
75
$redirect = bp_get_group_permalink( $group ) . bp_get_activity_slug() . '/' . $activity->id . '/';
76
}
77
}
@@ -604,6 +604,45 @@ function bp_activity_action_favorites_feed() {
604
}
605
add_action( 'bp_actions', 'bp_activity_action_favorites_feed' );
606
607
/**
608
* AJAX endpoint for Suggestions API lookups.
609
*
71
} else {
72
73
// Set redirect to group activity stream.
74
+ if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) ) {
75
$redirect = bp_get_group_permalink( $group ) . bp_get_activity_slug() . '/' . $activity->id . '/';
76
}
77
}
604
}
605
add_action( 'bp_actions', 'bp_activity_action_favorites_feed' );
606
607
+ /**
608
+ * Loads Akismet filtering for activity.
609
+ *
610
+ * @since 1.6.0
611
+ * @since 2.3.0 We only support Akismet 3+.
612
+ */
613
+ function bp_activity_setup_akismet() {
614
+ $bp = buddypress();
615
+
616
+ // Bail if Akismet is not active.
617
+ if ( ! defined( 'AKISMET_VERSION' ) ) {
618
+ return;
619
+ }
620
+
621
+ // Bail if older version of Akismet.
622
+ if ( ! class_exists( 'Akismet' ) ) {
623
+ return;
624
+ }
625
+
626
+ // Bail if no Akismet key is set.
627
+ if ( ! bp_get_option( 'wordpress_api_key' ) && ! defined( 'WPCOM_API_KEY' ) ) {
628
+ return;
629
+ }
630
+
631
+ /**
632
+ * Filters if BuddyPress Activity Akismet support has been disabled by another plugin.
633
+ *
634
+ * @since 1.6.0
635
+ *
636
+ * @param bool $value Return value of bp_is_akismet_active boolean function.
637
+ */
638
+ if ( ! apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) ) {
639
+ return;
640
+ }
641
+
642
+ // Instantiate Akismet for BuddyPress.
643
+ $bp->activity->akismet = new BP_Akismet();
644
+ }
645
+
646
/**
647
* AJAX endpoint for Suggestions API lookups.
648
*
bp-activity/bp-activity-akismet.php CHANGED
@@ -14,29 +14,6 @@ if ( ! buddypress()->do_autoload ) {
14
require dirname( __FILE__ ) . '/classes/class-bp-akismet.php';
15
}
16
17
- /**
18
- * Loads Akismet filtering for activity.
19
- *
20
- * @since 1.6.0
21
- * @since 2.3.0 We only support Akismet 3+.
22
- */
23
- function bp_activity_setup_akismet() {
24
- /**
25
- * Filters if BuddyPress Activity Akismet support has been disabled by another plugin.
26
- *
27
- * @since 1.6.0
28
- *
29
- * @param bool $value Return value of bp_is_akismet_active boolean function.
30
- */
31
- if ( ! apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) ) {
32
- return;
33
- }
34
-
35
- // Instantiate Akismet for BuddyPress.
36
- buddypress()->activity->akismet = new BP_Akismet();
37
- }
38
- add_action( 'bp_activity_setup_globals', 'bp_activity_setup_akismet' );
39
-
40
/**
41
* Delete old spam activity meta data.
42
*
14
require dirname( __FILE__ ) . '/classes/class-bp-akismet.php';
15
}
16
17
/**
18
* Delete old spam activity meta data.
19
*
bp-activity/bp-activity-cache.php CHANGED
@@ -63,24 +63,3 @@ function bp_activity_clear_cache_for_deleted_activity( $deleted_ids ) {
63
}
64
}
65
add_action( 'bp_activity_deleted_activities', 'bp_activity_clear_cache_for_deleted_activity' );
66
-
67
- /**
68
- * Reset cache incrementor for the Activity component.
69
- *
70
- * Called whenever an activity item is created, updated, or deleted, this
71
- * function effectively invalidates all cached results of activity queries.
72
- *
73
- * @since 2.7.0
74
- *
75
- * @return bool True on success, false on failure.
76
- */
77
- function bp_activity_reset_cache_incrementor() {
78
- $without_last_activity = bp_core_reset_incrementor( 'bp_activity' );
79
- $with_last_activity = bp_core_reset_incrementor( 'bp_activity_with_last_activity' );
80
- return $without_last_activity && $with_last_activity;
81
- }
82
- add_action( 'bp_activity_delete', 'bp_activity_reset_cache_incrementor' );
83
- add_action( 'bp_activity_add', 'bp_activity_reset_cache_incrementor' );
84
- add_action( 'added_activity_meta', 'bp_activity_reset_cache_incrementor' );
85
- add_action( 'updated_activity_meta', 'bp_activity_reset_cache_incrementor' );
86
- add_action( 'deleted_activity_meta', 'bp_activity_reset_cache_incrementor' );
63
}
64
}
65
add_action( 'bp_activity_deleted_activities', 'bp_activity_clear_cache_for_deleted_activity' );
bp-activity/bp-activity-filters.php CHANGED
@@ -207,15 +207,13 @@ function bp_activity_filter_kses( $content ) {
207
global $allowedtags;
208
209
$activity_allowedtags = $allowedtags;
210
- $activity_allowedtags['a']['class'] = array();
211
- $activity_allowedtags['a']['id'] = array();
212
- $activity_allowedtags['a']['rel'] = array();
213
- $activity_allowedtags['a']['title'] = array();
214
-
215
- $activity_allowedtags['b'] = array();
216
- $activity_allowedtags['code'] = array();
217
- $activity_allowedtags['i'] = array();
218
-
219
$activity_allowedtags['img'] = array();
220
$activity_allowedtags['img']['src'] = array();
221
$activity_allowedtags['img']['alt'] = array();
@@ -224,10 +222,8 @@ function bp_activity_filter_kses( $content ) {
224
$activity_allowedtags['img']['class'] = array();
225
$activity_allowedtags['img']['id'] = array();
226
$activity_allowedtags['img']['title'] = array();
227
-
228
- $activity_allowedtags['span'] = array();
229
- $activity_allowedtags['span']['class'] = array();
230
- $activity_allowedtags['span']['data-livestamp'] = array();
231
232
233
/**
@@ -282,7 +278,7 @@ function bp_activity_at_name_filter( $content, $activity_id = 0 ) {
282
283
// Linkify the mentions with the username.
284
foreach ( (array) $usernames as $user_id => $username ) {
285
- $content = preg_replace( '/(@' . $username . '\b)/', "<a class='bp-suggestions-mention' href='" . bp_core_get_user_domain( $user_id ) . "' rel='nofollow'>@$username</a>", $content );
286
}
287
288
// Put everything back.
@@ -323,7 +319,7 @@ function bp_activity_at_name_filter_updates( $activity ) {
323
if ( ! empty( $usernames ) ) {
324
// Replace @mention text with userlinks.
325
foreach( (array) $usernames as $user_id => $username ) {
326
- $activity->content = preg_replace( '/(@' . $username . '\b)/', "<a class='bp-suggestions-mention' href='" . bp_core_get_user_domain( $user_id ) . "' rel='nofollow'>@$username</a>", $activity->content );
327
}
328
329
// Add our hook to send @mention emails after the activity item is saved.
207
global $allowedtags;
208
209
$activity_allowedtags = $allowedtags;
210
+ $activity_allowedtags['a']['class'] = array();
211
+ $activity_allowedtags['a']['id'] = array();
212
+ $activity_allowedtags['a']['rel'] = array();
213
+ $activity_allowedtags['a']['title'] = array();
214
+ $activity_allowedtags['b'] = array();
215
+ $activity_allowedtags['code'] = array();
216
+ $activity_allowedtags['i'] = array();
217
$activity_allowedtags['img'] = array();
218
$activity_allowedtags['img']['src'] = array();
219
$activity_allowedtags['img']['alt'] = array();
222
$activity_allowedtags['img']['class'] = array();
223
$activity_allowedtags['img']['id'] = array();
224
$activity_allowedtags['img']['title'] = array();
225
+ $activity_allowedtags['span'] = array();
226
+ $activity_allowedtags['span']['class'] = array();
227
228
229
/**
278
279
// Linkify the mentions with the username.
280
foreach ( (array) $usernames as $user_id => $username ) {
281
+ $content = preg_replace( '/(@' . $username . '\b)/', "<a href='" . bp_core_get_user_domain( $user_id ) . "' rel='nofollow'>@$username</a>", $content );
282
}
283
284
// Put everything back.
319
if ( ! empty( $usernames ) ) {
320
// Replace @mention text with userlinks.
321
foreach( (array) $usernames as $user_id => $username ) {
322
+ $activity->content = preg_replace( '/(@' . $username . '\b)/', "<a href='" . bp_core_get_user_domain( $user_id ) . "' rel='nofollow'>@$username</a>", $activity->content );
323
}
324
325
// Add our hook to send @mention emails after the activity item is saved.
bp-activity/bp-activity-functions.php CHANGED
@@ -1663,29 +1663,57 @@ function bp_activity_get( $args = '' ) {
1663
* );
1664
*/
1665
'filter' => array()
1666
- ), 'activity_get' );
1667
-
1668
- $activity = BP_Activity_Activity::get( array(
1669
- 'page' => $r['page'],
1670
- 'per_page' => $r['per_page'],
1671
- 'max' => $r['max'],
1672
- 'sort' => $r['sort'],
1673
- 'search_terms' => $r['search_terms'],
1674
- 'meta_query' => $r['meta_query'],
1675
- 'date_query' => $r['date_query'],
1676
- 'filter_query' => $r['filter_query'],
1677
- 'filter' => $r['filter'],
1678
- 'scope' => $r['scope'],
1679
- 'display_comments' => $r['display_comments'],
1680
- 'show_hidden' => $r['show_hidden'],
1681
- 'exclude' => $r['exclude'],
1682
- 'in' => $r['in'],
1683
- 'spam' => $r['spam'],
1684
- 'update_meta_cache' => $r['update_meta_cache'],
1685
- 'count_total' => $r['count_total'],
1686
- 'fields' => $r['fields'],
1687
) );
1688
1689
/**
1690
* Filters the requested activity item(s).
1691
*
@@ -1870,13 +1898,10 @@ function bp_activity_add( $args = '' ) {
1870
* @since 1.2.0
1871
*
1872
* @param array|string $args {
1873
- * @type string $content The content of the activity update.
1874
- * @type int $user_id Optional. Defaults to the logged-in user.
1875
- * @type string $error_type Optional. Error type to return. Either 'bool' or 'wp_error'. Defaults to
1876
- * 'bool' for boolean. 'wp_error' will return a WP_Error object.
1877
* }
1878
- * @return int|bool|WP_Error $activity_id The activity id on success. On failure, either boolean false or WP_Error
1879
- * object depending on the 'error_type' $args parameter.
1880
*/
1881
function bp_activity_post_update( $args = '' ) {
1882
@@ -3392,211 +3417,6 @@ function bp_activity_mark_as_ham( &$activity, $source = 'by_a_person' ) {
3392
do_action( 'bp_activity_mark_as_ham', $activity, $source );
3393
}
3394
3395
- /* Emails *********************************************************************/
3396
-
3397
- /**
3398
- * Send email and BP notifications when a user is mentioned in an update.
3399
- *
3400
- * @since 1.2.0
3401
- *
3402
- * @param int $activity_id The ID of the activity update.
3403
- * @param int $receiver_user_id The ID of the user who is receiving the update.
3404
- */
3405
- function bp_activity_at_message_notification( $activity_id, $receiver_user_id ) {
3406
- $notifications = BP_Core_Notification::get_all_for_user( $receiver_user_id, 'all' );
3407
-
3408
- // Don't leave multiple notifications for the same activity item.
3409
- foreach( $notifications as $notification ) {
3410
- if ( $activity_id == $notification->item_id ) {
3411
- return;
3412
- }
3413
- }
3414
-
3415
- $activity = new BP_Activity_Activity( $activity_id );
3416
- $email_type = 'activity-at-message';
3417
- $group_name = '';
3418
- $message_link = bp_activity_get_permalink( $activity_id );
3419
- $poster_name = bp_core_get_user_displayname( $activity->user_id );
3420
-
3421
- remove_filter( 'bp_get_activity_content_body', 'convert_smilies' );
3422
- remove_filter( 'bp_get_activity_content_body', 'wpautop' );
3423
- remove_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 );
3424
-
3425
- /** This filter is documented in bp-activity/bp-activity-template.php */
3426
- $content = apply_filters( 'bp_get_activity_content_body', $activity->content );
3427
-
3428
- add_filter( 'bp_get_activity_content_body', 'convert_smilies' );
3429
- add_filter( 'bp_get_activity_content_body', 'wpautop' );
3430
- add_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 );
3431
-
3432
- // Now email the user with the contents of the message (if they have enabled email notifications).
3433
- if ( 'no' != bp_get_user_meta( $receiver_user_id, 'notification_activity_new_mention', true ) ) {
3434
- if ( bp_is_active( 'groups' ) && bp_is_group() ) {
3435
- $email_type = 'groups-at-message';
3436
- $group_name = bp_get_current_group_name();
3437
- }
3438
-
3439
- $unsubscribe_args = array(
3440
- 'user_id' => $receiver_user_id,
3441
- 'notification_type' => $email_type,
3442
- );
3443
-
3444
- $args = array(
3445
- 'tokens' => array(
3446
- 'activity' => $activity,
3447
- 'usermessage' => wp_strip_all_tags( $content ),
3448
- 'group.name' => $group_name,
3449
- 'mentioned.url' => $message_link,
3450
- 'poster.name' => $poster_name,
3451
- 'receiver-user.id' => $receiver_user_id,
3452
- 'unsubscribe' => esc_url( bp_email_get_unsubscribe_link( $unsubscribe_args ) ),
3453
- ),
3454
- );
3455
-
3456
- bp_send_email( $email_type, $receiver_user_id, $args );
3457
- }
3458
-
3459
- /**
3460
- * Fires after the sending of an @mention email notification.
3461
- *
3462
- * @since 1.5.0
3463
- * @since 2.5.0 $subject, $message, $content arguments unset and deprecated.
3464
- *
3465
- * @param BP_Activity_Activity $activity Activity Item object.
3466
- * @param string $deprecated Removed in 2.5; now an empty string.
3467
- * @param string $deprecated Removed in 2.5; now an empty string.
3468
- * @param string $deprecated Removed in 2.5; now an empty string.
3469
- * @param int $receiver_user_id The ID of the user who is receiving the update.
3470
- */
3471
- do_action( 'bp_activity_sent_mention_email', $activity, '', '', '', $receiver_user_id );
3472
- }
3473
-
3474
- /**
3475
- * Send email and BP notifications when an activity item receives a comment.
3476
- *
3477
- * @since 1.2.0
3478
- * @since 2.5.0 Updated to use new email APIs.
3479
- *
3480
- * @param int $comment_id The comment id.
3481
- * @param int $commenter_id The ID of the user who posted the comment.
3482
- * @param array $params {@link bp_activity_new_comment()}.
3483
- */
3484
- function bp_activity_new_comment_notification( $comment_id = 0, $commenter_id = 0, $params = array() ) {
3485
- $original_activity = new BP_Activity_Activity( $params['activity_id'] );
3486
- $poster_name = bp_core_get_user_displayname( $commenter_id );
3487
- $thread_link = bp_activity_get_permalink( $params['activity_id'] );
3488
-
3489
- remove_filter( 'bp_get_activity_content_body', 'convert_smilies' );
3490
- remove_filter( 'bp_get_activity_content_body', 'wpautop' );
3491
- remove_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 );
3492
-
3493
- /** This filter is documented in bp-activity/bp-activity-template.php */
3494
- $content = apply_filters( 'bp_get_activity_content_body', $params['content'] );
3495
-
3496
- add_filter( 'bp_get_activity_content_body', 'convert_smilies' );
3497
- add_filter( 'bp_get_activity_content_body', 'wpautop' );
3498
- add_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 );
3499
-
3500
- if ( $original_activity->user_id != $commenter_id ) {
3501
-
3502
- // Send an email if the user hasn't opted-out.
3503
- if ( 'no' != bp_get_user_meta( $original_activity->user_id, 'notification_activity_new_reply', true ) ) {
3504
-
3505
- $unsubscribe_args = array(
3506
- 'user_id' => $original_activity->user_id,
3507
- 'notification_type' => 'activity-comment',
3508
- );
3509
-
3510
- $args = array(
3511
- 'tokens' => array(
3512
- 'comment.id' => $comment_id,
3513
- 'commenter.id' => $commenter_id,
3514
- 'usermessage' => wp_strip_all_tags( $content ),
3515
- 'original_activity.user_id' => $original_activity->user_id,
3516
- 'poster.name' => $poster_name,
3517
- 'thread.url' => esc_url( $thread_link ),
3518
- 'unsubscribe' => esc_url( bp_email_get_unsubscribe_link( $unsubscribe_args ) ),
3519
- ),
3520
- );
3521
-
3522
- bp_send_email( 'activity-comment', $original_activity->user_id, $args );
3523
- }
3524
-
3525
- /**
3526
- * Fires at the point that notifications should be sent for activity comments.
3527
- *
3528
- * @since 2.6.0
3529
- *
3530
- * @param BP_Activity_Activity $original_activity The original activity.
3531
- * @param int $comment_id ID for the newly received comment.
3532
- * @param int $commenter_id ID of the user who made the comment.
3533
- * @param array $params Arguments used with the original activity comment.
3534
- */
3535
- do_action( 'bp_activity_sent_reply_to_update_notification', $original_activity, $comment_id, $commenter_id, $params );
3536
- }
3537
-
3538
-
3539
- /*
3540
- * If this is a reply to another comment, send an email notification to the
3541
- * author of the immediate parent comment.
3542
- */
3543
- if ( empty( $params['parent_id'] ) || ( $params['activity_id'] == $params['parent_id'] ) ) {
3544
- return;
3545
- }
3546
-
3547
- $parent_comment = new BP_Activity_Activity( $params['parent_id'] );
3548
-
3549
- if ( $parent_comment->user_id != $commenter_id && $original_activity->user_id != $parent_comment->user_id ) {
3550
-
3551
- // Send an email if the user hasn't opted-out.
3552
- if ( 'no' != bp_get_user_meta( $parent_comment->user_id, 'notification_activity_new_reply', true ) ) {
3553
-
3554
- $unsubscribe_args = array(
3555
- 'user_id' => $parent_comment->user_id,
3556
- 'notification_type' => 'activity-comment-author',
3557
- );
3558
-
3559
- $args = array(
3560
- 'tokens' => array(
3561
- 'comment.id' => $comment_id,
3562
- 'commenter.id' => $commenter_id,
3563
- 'usermessage' => wp_strip_all_tags( $content ),
3564
- 'parent-comment-user.id' => $parent_comment->user_id,
3565
- 'poster.name' => $poster_name,
3566
- 'thread.url' => esc_url( $thread_link ),
3567
- 'unsubscribe' => esc_url( bp_email_get_unsubscribe_link( $unsubscribe_args ) ),
3568
- ),
3569
- );
3570
-
3571
- bp_send_email( 'activity-comment-author', $parent_comment->user_id, $args );
3572
- }
3573
-
3574
- /**
3575
- * Fires at the point that notifications should be sent for comments on activity replies.
3576
- *
3577
- * @since 2.6.0
3578
- *
3579
- * @param BP_Activity_Activity $parent_comment The parent activity.
3580
- * @param int $comment_id ID for the newly received comment.
3581
- * @param int $commenter_id ID of the user who made the comment.
3582
- * @param array $params Arguments used with the original activity comment.
3583
- */
3584
- do_action( 'bp_activity_sent_reply_to_reply_notification', $parent_comment, $comment_id, $commenter_id, $params );
3585
- }
3586
- }
3587
-
3588
- /**
3589
- * Helper method to map action arguments to function parameters.
3590
- *
3591
- * @since 1.9.0
3592
- *
3593
- * @param int $comment_id ID of the comment being notified about.
3594
- * @param array $params Parameters to use with notification.
3595
- */
3596
- function bp_activity_new_comment_notification_helper( $comment_id, $params ) {
3597
- bp_activity_new_comment_notification( $comment_id, $params['user_id'], $params );
3598
- }
3599
- add_action( 'bp_activity_comment_posted', 'bp_activity_new_comment_notification_helper', 10, 2 );
3600
3601
/** Embeds *******************************************************************/
3602
1663
* );
1664
*/
1665
'filter' => array()
1666
) );
1667
1668
+ // Attempt to return a cached copy of the first page of sitewide activity.
1669
+ if ( ( 1 === (int) $r['page'] ) && empty( $r['max'] ) && ( 'all' === $r['fields'] ) && empty( $r['search_terms'] ) && empty( $r['meta_query'] ) && empty( $r['date_query'] ) && empty( $r['filter_query'] ) && empty( $r['filter'] ) && empty( $r['scope'] )&& empty( $r['exclude'] ) && empty( $r['in'] ) && ( 'DESC' === $r['sort'] ) && empty( $r['exclude'] ) && ( 'ham_only' === $r['spam'] ) ) {
1670
+
1671
+ $activity = wp_cache_get( 'bp_activity_sitewide_front', 'bp' );
1672
+ if ( false === $activity ) {
1673
+
1674
+ $activity = BP_Activity_Activity::get( array(
1675
+ 'page' => $r['page'],
1676
+ 'per_page' => $r['per_page'],
1677
+ 'max' => $r['max'],
1678
+ 'fields' => $r['fields'],
1679
+ 'sort' => $r['sort'],
1680
+ 'search_terms' => $r['search_terms'],
1681
+ 'meta_query' => $r['meta_query'],
1682
+ 'date_query' => $r['date_query'],
1683
+ 'filter_query' => $r['filter_query'],
1684
+ 'filter' => $r['filter'],
1685
+ 'scope' => $r['scope'],
1686
+ 'display_comments' => $r['display_comments'],
1687
+ 'show_hidden' => $r['show_hidden'],
1688
+ 'spam' => $r['spam'],
1689
+ 'update_meta_cache' => $r['update_meta_cache'],
1690
+ 'count_total' => $r['count_total'],
1691
+ ) );
1692
+
1693
+ wp_cache_set( 'bp_activity_sitewide_front', $activity, 'bp' );
1694
+ }
1695
+
1696
+ } else {
1697
+ $activity = BP_Activity_Activity::get( array(
1698
+ 'page' => $r['page'],
1699
+ 'per_page' => $r['per_page'],
1700
+ 'max' => $r['max'],
1701
+ 'sort' => $r['sort'],
1702
+ 'search_terms' => $r['search_terms'],
1703
+ 'meta_query' => $r['meta_query'],
1704
+ 'date_query' => $r['date_query'],
1705
+ 'filter_query' => $r['filter_query'],
1706
+ 'filter' => $r['filter'],
1707
+ 'scope' => $r['scope'],
1708
+ 'display_comments' => $r['display_comments'],
1709
+ 'show_hidden' => $r['show_hidden'],
1710
+ 'exclude' => $r['exclude'],
1711
+ 'in' => $r['in'],
1712
+ 'spam' => $r['spam'],
1713
+ 'count_total' => $r['count_total'],
1714
+ ) );
1715
+ }
1716
+
1717
/**
1718
* Filters the requested activity item(s).
1719
*
1898
* @since 1.2.0
1899
*
1900
* @param array|string $args {
1901
+ * @type string $content The content of the activity update.
1902
+ * @type int $user_id Optional. Defaults to the logged-in user.
1903
* }
1904
+ * @return int $activity_id The activity id.
1905
*/
1906
function bp_activity_post_update( $args = '' ) {
1907
3417
do_action( 'bp_activity_mark_as_ham', $activity, $source );
3418
}
3419
3420
3421
/** Embeds *******************************************************************/
3422
bp-activity/bp-activity-loader.php CHANGED
@@ -17,7 +17,7 @@ if ( ! buddypress()->do_autoload ) {
17
}
18
19
/**
20
- * Set up the bp-activity component.
21
*
22
* @since 1.6.0
23
*/
17
}
18
19
/**
20
+ * Bootstrap the Activity component.
21
*
22
* @since 1.6.0
23
*/
bp-activity/bp-activity-notifications.php CHANGED
@@ -10,6 +10,194 @@
10
// Exit if accessed directly.
11
defined( 'ABSPATH' ) || exit;
12
13
/**
14
* Format notifications related to activity.
15
*
@@ -151,7 +339,8 @@ function bp_activity_format_notifications( $action, $item_id, $secondary_item_id
151
* @param int $receiver_user_id ID of user receiving notification.
152
*/
153
function bp_activity_at_mention_add_notification( $activity, $subject, $message, $content, $receiver_user_id ) {
154
- bp_notifications_add_notification( array(
155
'user_id' => $receiver_user_id,
156
'item_id' => $activity->id,
157
'secondary_item_id' => $activity->user_id,
@@ -159,7 +348,8 @@ function bp_activity_at_mention_add_notification( $activity, $subject, $message,
159
'component_action' => 'new_at_mention',
160
'date_notified' => bp_core_current_time(),
161
'is_new' => 1,
162
- ) );
163
}
164
add_action( 'bp_activity_sent_mention_email', 'bp_activity_at_mention_add_notification', 10, 5 );
165
@@ -173,15 +363,17 @@ add_action( 'bp_activity_sent_mention_email', 'bp_activity_at_mention_add_notifi
173
* @param int $commenter_id ID of the user who made the comment.
174
*/
175
function bp_activity_update_reply_add_notification( $activity, $comment_id, $commenter_id ) {
176
- bp_notifications_add_notification( array(
177
- 'user_id' => $activity->user_id,
178
- 'item_id' => $comment_id,
179
- 'secondary_item_id' => $commenter_id,
180
- 'component_name' => buddypress()->activity->id,
181
- 'component_action' => 'update_reply',
182
- 'date_notified' => bp_core_current_time(),
183
- 'is_new' => 1,
184
- ) );
185
}
186
add_action( 'bp_activity_sent_reply_to_update_notification', 'bp_activity_update_reply_add_notification', 10, 3 );
187
@@ -195,15 +387,17 @@ add_action( 'bp_activity_sent_reply_to_update_notification', 'bp_activity_update
195
* @param int $commenter_id ID of the user who made the comment.
196
*/
197
function bp_activity_comment_reply_add_notification( $activity_comment, $comment_id, $commenter_id ) {
198
- bp_notifications_add_notification( array(
199
- 'user_id' => $activity_comment->user_id,
200
- 'item_id' => $comment_id,
201
- 'secondary_item_id' => $commenter_id,
202
- 'component_name' => buddypress()->activity->id,
203
- 'component_action' => 'comment_reply',
204
- 'date_notified' => bp_core_current_time(),
205
- 'is_new' => 1,
206
- ) );
207
}
208
add_action( 'bp_activity_sent_reply_to_reply_notification', 'bp_activity_comment_reply_add_notification', 10, 3 );
209
@@ -216,6 +410,10 @@ add_action( 'bp_activity_sent_reply_to_reply_notification', 'bp_activity_comment
216
* @param int $user_id The id of the user whose notifications are marked as read.
217
*/
218
function bp_activity_remove_screen_notifications( $user_id = 0 ) {
219
// Only mark read if the current user is looking at his own mentions.
220
if ( empty( $user_id ) || (int) $user_id !== (int) bp_loggedin_user_id() ) {
221
return;
@@ -233,6 +431,10 @@ add_action( 'bp_activity_clear_new_mentions', 'bp_activity_remove_screen_notific
233
* @param BP_Activity_Activity $activity Activity object.
234
*/
235
function bp_activity_remove_screen_notifications_single_activity_permalink( $activity ) {
236
if ( ! is_user_logged_in() ) {
237
return;
238
}
@@ -251,7 +453,7 @@ add_action( 'bp_activity_screen_single_activity_permalink', 'bp_activity_remove_
251
* @since 2.6.0
252
*/
253
function bp_activity_remove_screen_notifications_for_non_mentions() {
254
- if ( false === is_singular() || false === is_user_logged_in() || empty( $_GET['nid'] ) ) {
255
return;
256
}
257
@@ -278,7 +480,7 @@ add_action( 'bp_screens', 'bp_activity_remove_screen_notifications_for_non_menti
278
function bp_activity_at_mention_delete_notification( $activity_ids_deleted = array() ) {
279
// Let's delete all without checking if content contains any mentions
280
// to avoid a query to get the activity.
281
- if ( ! empty( $activity_ids_deleted ) ) {
282
foreach ( $activity_ids_deleted as $activity_id ) {
283
bp_notifications_delete_all_notifications_by_type( $activity_id, buddypress()->activity->id );
284
}
@@ -300,7 +502,7 @@ add_action( 'bp_activity_deleted_activities', 'bp_activity_at_mention_delete_not
300
*/
301
function bp_activity_add_notification_for_synced_blog_comment( $activity_id, $post_type_comment, $activity_args, $activity_post_object ) {
302
// If activity comments are disabled for WP posts, stop now!
303
- if ( bp_disable_blogforum_comments() || empty( $activity_id ) ) {
304
return;
305
}
306
10
// Exit if accessed directly.
11
defined( 'ABSPATH' ) || exit;
12
13
+ /* Emails *********************************************************************/
14
+
15
+ /**
16
+ * Send email and BP notifications when a user is mentioned in an update.
17
+ *
18
+ * @since 1.2.0
19
+ *
20
+ * @param int $activity_id The ID of the activity update.
21
+ * @param int $receiver_user_id The ID of the user who is receiving the update.
22
+ */
23
+ function bp_activity_at_message_notification( $activity_id, $receiver_user_id ) {
24
+ $notifications = BP_Core_Notification::get_all_for_user( $receiver_user_id, 'all' );
25
+
26
+ // Don't leave multiple notifications for the same activity item.
27
+ foreach( $notifications as $notification ) {
28
+ if ( $activity_id == $notification->item_id ) {
29
+ return;
30
+ }
31
+ }
32
+
33
+ $activity = new BP_Activity_Activity( $activity_id );
34
+ $email_type = 'activity-at-message';
35
+ $group_name = '';
36
+ $message_link = bp_activity_get_permalink( $activity_id );
37
+ $poster_name = bp_core_get_user_displayname( $activity->user_id );
38
+
39
+ remove_filter( 'bp_get_activity_content_body', 'convert_smilies' );
40
+ remove_filter( 'bp_get_activity_content_body', 'wpautop' );
41
+ remove_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 );
42
+
43
+ /** This filter is documented in bp-activity/bp-activity-template.php */
44
+ $content = apply_filters( 'bp_get_activity_content_body', $activity->content );
45
+
46
+ add_filter( 'bp_get_activity_content_body', 'convert_smilies' );
47
+ add_filter( 'bp_get_activity_content_body', 'wpautop' );
48
+ add_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 );
49
+
50
+ // Now email the user with the contents of the message (if they have enabled email notifications).
51
+ if ( 'no' != bp_get_user_meta( $receiver_user_id, 'notification_activity_new_mention', true ) ) {
52
+ if ( bp_is_active( 'groups' ) && bp_is_group() ) {
53
+ $email_type = 'groups-at-message';
54
+ $group_name = bp_get_current_group_name();
55
+ }
56
+
57
+ $args = array(
58
+ 'tokens' => array(
59
+ 'activity' => $activity,
60
+ 'usermessage' => wp_strip_all_tags( $content ),
61
+ 'group.name' => $group_name,
62
+ 'mentioned.url' => $message_link,
63
+ 'poster.name' => $poster_name,
64
+ 'receiver-user.id' => $receiver_user_id,
65
+ ),
66
+ );
67
+
68
+ bp_send_email( $email_type, $receiver_user_id, $args );
69
+ }
70
+
71
+ /**
72
+ * Fires after the sending of an @mention email notification.
73
+ *
74
+ * @since 1.5.0
75
+ * @since 2.5.0 $subject, $message, $content arguments unset and deprecated.
76
+ *
77
+ * @param BP_Activity_Activity $activity Activity Item object.
78
+ * @param string $deprecated Removed in 2.5; now an empty string.
79
+ * @param string $deprecated Removed in 2.5; now an empty string.
80
+ * @param string $deprecated Removed in 2.5; now an empty string.
81
+ * @param int $receiver_user_id The ID of the user who is receiving the update.
82
+ */
83
+ do_action( 'bp_activity_sent_mention_email', $activity, '', '', '', $receiver_user_id );
84
+ }
85
+
86
+ /**
87
+ * Send email and BP notifications when an activity item receives a comment.
88
+ *
89
+ * @since 1.2.0
90
+ * @since 2.5.0 Updated to use new email APIs.
91
+ *
92
+ * @param int $comment_id The comment id.
93
+ * @param int $commenter_id The ID of the user who posted the comment.
94
+ * @param array $params {@link bp_activity_new_comment()}.
95
+ */
96
+ function bp_activity_new_comment_notification( $comment_id = 0, $commenter_id = 0, $params = array() ) {
97
+ $original_activity = new BP_Activity_Activity( $params['activity_id'] );
98
+ $poster_name = bp_core_get_user_displayname( $commenter_id );
99
+ $thread_link = bp_activity_get_permalink( $params['activity_id'] );
100
+
101
+ remove_filter( 'bp_get_activity_content_body', 'convert_smilies' );
102
+ remove_filter( 'bp_get_activity_content_body', 'wpautop' );
103
+ remove_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 );
104
+
105
+ /** This filter is documented in bp-activity/bp-activity-template.php */
106
+ $content = apply_filters( 'bp_get_activity_content_body', $params['content'] );
107
+
108
+ add_filter( 'bp_get_activity_content_body', 'convert_smilies' );
109
+ add_filter( 'bp_get_activity_content_body', 'wpautop' );
110
+ add_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 );
111
+
112
+ if ( $original_activity->user_id != $commenter_id ) {
113
+
114
+ // Send an email if the user hasn't opted-out.
115
+ if ( 'no' != bp_get_user_meta( $original_activity->user_id, 'notification_activity_new_reply', true ) ) {
116
+ $args = array(
117
+ 'tokens' => array(
118
+ 'comment.id' => $comment_id,
119
+ 'commenter.id' => $commenter_id,
120
+ 'usermessage' => wp_strip_all_tags( $content ),
121
+ 'original_activity.user_id' => $original_activity->user_id,
122
+ 'poster.name' => $poster_name,
123
+ 'thread.url' => esc_url( $thread_link ),
124
+ ),
125
+ );
126
+
127
+ bp_send_email( 'activity-comment', $original_activity->user_id, $args );
128
+ }
129
+
130
+ /**
131
+ * Fires at the point that notifications should be sent for activity comments.
132
+ *
133
+ * @since 2.6.0
134
+ *
135
+ * @param BP_Activity_Activity $original_activity The original activity.
136
+ * @param int $comment_id ID for the newly received comment.
137
+ * @param int $commenter_id ID of the user who made the comment.
138
+ * @param array $params Arguments used with the original activity comment.
139
+ */
140
+ do_action( 'bp_activity_sent_reply_to_update_notification', $original_activity, $comment_id, $commenter_id, $params );
141
+ }
142
+
143
+
144
+ /*
145
+ * If this is a reply to another comment, send an email notification to the
146
+ * author of the immediate parent comment.
147
+ */
148
+ if ( empty( $params['parent_id'] ) || ( $params['activity_id'] == $params['parent_id'] ) ) {
149
+ return;
150
+ }
151
+
152
+ $parent_comment = new BP_Activity_Activity( $params['parent_id'] );
153
+
154
+ if ( $parent_comment->user_id != $commenter_id && $original_activity->user_id != $parent_comment->user_id ) {
155
+
156
+ // Send an email if the user hasn't opted-out.
157
+ if ( 'no' != bp_get_user_meta( $parent_comment->user_id, 'notification_activity_new_reply', true ) ) {
158
+ $args = array(
159
+ 'tokens' => array(
160
+ 'comment.id' => $comment_id,
161
+ 'commenter.id' => $commenter_id,
162
+ 'usermessage' => wp_strip_all_tags( $content ),
163
+ 'parent-comment-user.id' => $parent_comment->user_id,
164
+ 'poster.name' => $poster_name,
165
+ 'thread.url' => esc_url( $thread_link ),
166
+ ),
167
+ );
168
+
169
+ bp_send_email( 'activity-comment-author', $parent_comment->user_id, $args );
170
+ }
171
+
172
+ /**
173
+ * Fires at the point that notifications should be sent for comments on activity replies.
174
+ *
175
+ * @since 2.6.0
176
+ *
177
+ * @param BP_Activity_Activity $parent_comment The parent activity.
178
+ * @param int $comment_id ID for the newly received comment.
179
+ * @param int $commenter_id ID of the user who made the comment.
180
+ * @param array $params Arguments used with the original activity comment.
181
+ */
182
+ do_action( 'bp_activity_sent_reply_to_reply_notification', $parent_comment, $comment_id, $commenter_id, $params );
183
+ }
184
+ }
185
+
186
+ /**
187
+ * Helper method to map action arguments to function parameters.
188
+ *
189
+ * @since 1.9.0
190
+ *
191
+ * @param int $comment_id ID of the comment being notified about.
192
+ * @param array $params Parameters to use with notification.
193
+ */
194
+ function bp_activity_new_comment_notification_helper( $comment_id, $params ) {
195
+ bp_activity_new_comment_notification( $comment_id, $params['user_id'], $params );
196
+ }
197
+ add_action( 'bp_activity_comment_posted', 'bp_activity_new_comment_notification_helper', 10, 2 );
198
+
199
+ /** Notifications *************************************************************/
200
+
201
/**
202
* Format notifications related to activity.
203
*
339
* @param int $receiver_user_id ID of user receiving notification.
340
*/
341
function bp_activity_at_mention_add_notification( $activity, $subject, $message, $content, $receiver_user_id ) {
342
+ if ( bp_is_active( 'notifications' ) ) {
343
+ bp_notifications_add_notification( array(
344
'user_id' => $receiver_user_id,
345
'item_id' => $activity->id,
346
'secondary_item_id' => $activity->user_id,
348
'component_action' => 'new_at_mention',
349
'date_notified' => bp_core_current_time(),
350
'is_new' => 1,
351
+ ) );
352
+ }
353
}
354
add_action( 'bp_activity_sent_mention_email', 'bp_activity_at_mention_add_notification', 10, 5 );
355
363
* @param int $commenter_id ID of the user who made the comment.
364
*/
365
function bp_activity_update_reply_add_notification( $activity, $comment_id, $commenter_id ) {
366
+ if ( bp_is_active( 'notifications' ) ) {
367
+ bp_notifications_add_notification( array(
368
+ 'user_id' => $activity->user_id,
369
+ 'item_id' => $comment_id,
370
+ 'secondary_item_id' => $commenter_id,
371
+ 'component_name' => buddypress()->activity->id,
372
+ 'component_action' => 'update_reply',
373
+ 'date_notified' => bp_core_current_time(),
374
+ 'is_new' => 1,
375
+ ) );
376
+ }
377
}
378
add_action( 'bp_activity_sent_reply_to_update_notification', 'bp_activity_update_reply_add_notification', 10, 3 );
379
387
* @param int $commenter_id ID of the user who made the comment.
388
*/
389
function bp_activity_comment_reply_add_notification( $activity_comment, $comment_id, $commenter_id ) {
390
+ if ( bp_is_active( 'notifications' ) ) {
391
+ bp_notifications_add_notification( array(
392
+ 'user_id' => $activity_comment->user_id,
393
+ 'item_id' => $comment_id,
394
+ 'secondary_item_id' => $commenter_id,
395
+ 'component_name' => buddypress()->activity->id,
396
+ 'component_action' => 'comment_reply',
397
+ 'date_notified' => bp_core_current_time(),
398
+ 'is_new' => 1,
399
+ ) );
400
+ }
401
}
402
add_action( 'bp_activity_sent_reply_to_reply_notification', 'bp_activity_comment_reply_add_notification', 10, 3 );
403
410
* @param int $user_id The id of the user whose notifications are marked as read.
411
*/
412
function bp_activity_remove_screen_notifications( $user_id = 0 ) {
413
+ if ( ! bp_is_active( 'notifications' ) ) {
414
+ return;
415
+ }
416
+
417
// Only mark read if the current user is looking at his own mentions.
418
if ( empty( $user_id ) || (int) $user_id !== (int) bp_loggedin_user_id() ) {
419
return;
431
* @param BP_Activity_Activity $activity Activity object.
432
*/
433
function bp_activity_remove_screen_notifications_single_activity_permalink( $activity ) {
434
+ if ( ! bp_is_active( 'notifications' ) ) {
435
+ return;
436
+ }
437
+
438
if ( ! is_user_logged_in() ) {
439
return;
440
}
453
* @since 2.6.0
454
*/
455
function bp_activity_remove_screen_notifications_for_non_mentions() {
456
+ if ( false === bp_is_active( 'notifications' ) || false === is_singular() || false === is_user_logged_in() || empty( $_GET['nid'] ) ) {
457
return;
458
}
459
480
function bp_activity_at_mention_delete_notification( $activity_ids_deleted = array() ) {
481
// Let's delete all without checking if content contains any mentions
482
// to avoid a query to get the activity.
483
+ if ( bp_is_active( 'notifications' ) && ! empty( $activity_ids_deleted ) ) {
484
foreach ( $activity_ids_deleted as $activity_id ) {
485
bp_notifications_delete_all_notifications_by_type( $activity_id, buddypress()->activity->id );
486
}
502
*/
503
function bp_activity_add_notification_for_synced_blog_comment( $activity_id, $post_type_comment, $activity_args, $activity_post_object ) {
504
// If activity comments are disabled for WP posts, stop now!
505
+ if ( bp_disable_blogforum_comments() || empty( $activity_id ) || false === bp_is_active( 'notifications' ) ) {
506
return;
507
}
508
bp-activity/bp-activity-screens.php CHANGED
@@ -236,7 +236,7 @@ function bp_activity_screen_single_activity_permalink() {
236
237
// Check to see if the group is not public, if so, check the
238
// user has access to see this activity.
239
- if ( $group = groups_get_group( $activity->item_id ) ) {
240
241
// Group is not public.
242
if ( 'public' != $group->status ) {
236
237
// Check to see if the group is not public, if so, check the
238
// user has access to see this activity.
239
+ if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) ) {
240
241
// Group is not public.
242
if ( 'public' != $group->status ) {
bp-activity/bp-activity-template.php CHANGED
@@ -1177,7 +1177,11 @@ function bp_activity_secondary_avatar( $args = '' ) {
1177
1178
// Only if groups is active.
1179
if ( bp_is_active( 'groups' ) ) {
1180
- $group = groups_get_group( $item_id );
1181
$link = bp_get_group_permalink( $group );
1182
$name = $group->name;
1183
}
@@ -1472,13 +1476,6 @@ function bp_insert_activity_meta( $content = '' ) {
1472
// Get the time since this activity was recorded.
1473
$date_recorded = bp_core_time_since( $activities_template->activity->date_recorded );
1474
1475
- // Set up 'time-since' <span>.
1476
- $time_since = sprintf(
1477
- '<span class="time-since" data-livestamp="%1$s">%2$s</span>',
1478
- bp_core_get_iso8601_date( $activities_template->activity->date_recorded ),
1479
- $date_recorded
1480
- );
1481
-
1482
/**
1483
* Filters the activity item time since markup.
1484
*
@@ -1487,7 +1484,7 @@ function bp_insert_activity_meta( $content = '' ) {
1487
* @param array $value Array containing the time since markup and the current activity component.
1488
*/
1489
$time_since = apply_filters_ref_array( 'bp_activity_time_since', array(
1490
- $time_since,
1491
&$activities_template->activity
1492
) );
1493
@@ -1536,7 +1533,7 @@ function bp_insert_activity_meta( $content = '' ) {
1536
*
1537
* @global object $activities_template {@link BP_Activity_Template}
1538
*
1539
- * @param BP_Activity_Activity $activity Optional. Falls back on the current item in the loop.
1540
* @return bool True if can delete, false otherwise.
1541
*/
1542
function bp_activity_user_can_delete( $activity = false ) {
@@ -2093,7 +2090,7 @@ function bp_activity_comment_delete_link() {
2093
* activity comment.
2094
*/
2095
function bp_get_activity_comment_delete_link() {
2096
- $link = wp_nonce_url( bp_get_activity_directory_permalink() . 'delete/' . bp_get_activity_comment_id() . '?cid=' . bp_get_activity_comment_id(), 'bp_activity_delete_link' );
2097
2098
/**
2099
* Filters the link used for deleting the activity comment currently being displayed.
@@ -3165,6 +3162,8 @@ function bp_send_public_message_button( $args = '' ) {
3165
* @type string $wrapper_id Default: 'post-mention'.
3166
* @type string $link_href Default: the public message link for
3167
* the current member in the loop.
3168
* @type string $link_text Default: 'Public Message'.
3169
* @type string $link_class Default: 'activity-button mention'.
3170
* }
@@ -3179,6 +3178,7 @@ function bp_send_public_message_button( $args = '' ) {
3179
'block_self' => true,
3180
'wrapper_id' => 'post-mention',
3181
'link_href' => bp_get_send_public_message_link(),
3182
'link_text' => __( 'Public Message', 'buddypress' ),
3183
'link_class' => 'activity-button mention'
3184
) );
1177
1178
// Only if groups is active.
1179
if ( bp_is_active( 'groups' ) ) {
1180
+ $group = groups_get_group( array(
1181
+ 'group_id' => $item_id,
1182
+ 'populate_extras' => false,
1183
+ 'update_meta_cache' => false,
1184
+ ) );
1185
$link = bp_get_group_permalink( $group );
1186
$name = $group->name;
1187
}
1476
// Get the time since this activity was recorded.
1477
$date_recorded = bp_core_time_since( $activities_template->activity->date_recorded );
1478
1479
/**
1480
* Filters the activity item time since markup.
1481
*
1484
* @param array $value Array containing the time since markup and the current activity component.
1485
*/
1486
$time_since = apply_filters_ref_array( 'bp_activity_time_since', array(
1487
+ '<span class="time-since">' . $date_recorded . '</span>',
1488
&$activities_template->activity
1489
) );
1490
1533
*
1534
* @global object $activities_template {@link BP_Activity_Template}
1535
*
1536
+ * @param object|bool $activity Optional. Falls back on the current item in the loop.
1537
* @return bool True if can delete, false otherwise.
1538
*/
1539
function bp_activity_user_can_delete( $activity = false ) {
2090
* activity comment.
2091
*/
2092
function bp_get_activity_comment_delete_link() {
2093
+ $link = wp_nonce_url( bp_get_root_domain() . '/' . bp_get_activity_slug() . '/delete/' . bp_get_activity_comment_id() . '?cid=' . bp_get_activity_comment_id(), 'bp_activity_delete_link' );
2094
2095
/**
2096
* Filters the link used for deleting the activity comment currently being displayed.
3162
* @type string $wrapper_id Default: 'post-mention'.
3163
* @type string $link_href Default: the public message link for
3164
* the current member in the loop.
3165
+ * @type string $link_title Default: 'Send a public message on your
3166
+ * activity stream.'.
3167
* @type string $link_text Default: 'Public Message'.
3168
* @type string $link_class Default: 'activity-button mention'.
3169
* }
3178
'block_self' => true,
3179
'wrapper_id' => 'post-mention',
3180
'link_href' => bp_get_send_public_message_link(),
3181
+ 'link_title' => __( 'Send a public message on your activity stream.', 'buddypress' ),
3182
'link_text' => __( 'Public Message', 'buddypress' ),
3183
'link_class' => 'activity-button mention'
3184
) );
bp-activity/classes/class-bp-activity-activity.php CHANGED
@@ -645,23 +645,7 @@ class BP_Activity_Activity {
645
*/
646
$activity_ids_sql = apply_filters( 'bp_activity_paged_activities_sql', $activity_ids_sql, $r );
647
648
- /*
649
- * Queries that include 'last_activity' are cached separately,
650
- * since they are generally much less long-lived.
651
- */
652
- if ( preg_match( '/a\.type NOT IN \([^\)]*\'last_activity\'[^\)]*\)/', $activity_ids_sql ) ) {
653
- $cache_group = 'bp_activity';
654
- } else {
655
- $cache_group = 'bp_activity_with_last_activity';
656
- }
657
-
658
- $cached = bp_core_get_incremented_cache( $activity_ids_sql, $cache_group );
659
- if ( false === $cached ) {
660
- $activity_ids = $wpdb->get_col( $activity_ids_sql );
661
- bp_core_set_incremented_cache( $activity_ids_sql, $cache_group, $activity_ids );
662
- } else {
663
- $activity_ids = $cached;
664
- }
665
666
$retval['has_more_items'] = ! empty( $per_page ) && count( $activity_ids ) > $per_page;
667
@@ -718,13 +702,7 @@ class BP_Activity_Activity {
718
* @param string $sort Sort direction for query.
719
*/
720
$total_activities_sql = apply_filters( 'bp_activity_total_activities_sql', "SELECT count(DISTINCT a.id) FROM {$bp->activity->table_name} a {$join_sql} {$where_sql}", $where_sql, $sort );
721
- $cached = bp_core_get_incremented_cache( $total_activities_sql, $cache_group );
722
- if ( false === $cached ) {
723
- $total_activities = $wpdb->get_var( $total_activities_sql );
724
- bp_core_set_incremented_cache( $total_activities_sql, $cache_group, $total_activities );
725
- } else {
726
- $total_activities = $cached;
727
- }
728
729
if ( !empty( $r['max'] ) ) {
730
if ( (int) $total_activities > (int) $r['max'] ) {
645
*/
646
$activity_ids_sql = apply_filters( 'bp_activity_paged_activities_sql', $activity_ids_sql, $r );
647
648
+ $activity_ids = $wpdb->get_col( $activity_ids_sql );
649
650
$retval['has_more_items'] = ! empty( $per_page ) && count( $activity_ids ) > $per_page;
651
702
* @param string $sort Sort direction for query.
703
*/
704
$total_activities_sql = apply_filters( 'bp_activity_total_activities_sql', "SELECT count(DISTINCT a.id) FROM {$bp->activity->table_name} a {$join_sql} {$where_sql}", $where_sql, $sort );
705
+ $total_activities = $wpdb->get_var( $total_activities_sql );
706
707
if ( !empty( $r['max'] ) ) {
708
if ( (int) $total_activities > (int) $r['max'] ) {
bp-activity/classes/class-bp-activity-component.php CHANGED
@@ -57,14 +57,10 @@ class BP_Activity_Component extends BP_Component {
57
'adminbar',
58
'template',
59
'functions',
60
'cache'
61
);
62
63
- // Notifications support.
64
- if ( bp_is_active( 'notifications' ) ) {
65
- $includes[] = 'notifications';
66
- }
67
-
68
if ( ! buddypress()->do_autoload ) {
69
$includes[] = 'classes';
70
}
@@ -72,7 +68,7 @@ class BP_Activity_Component extends BP_Component {
72
// Load Akismet support if Akismet is configured.
73
$akismet_key = bp_get_option( 'wordpress_api_key' );
74
75
- /** This filter is documented in bp-activity/bp-activity-akismet.php */
76
if ( defined( 'AKISMET_VERSION' ) && class_exists( 'Akismet' ) && ( ! empty( $akismet_key ) || defined( 'WPCOM_API_KEY' ) ) && apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) ) {
77
$includes[] = 'akismet';
78
}
@@ -120,17 +116,13 @@ class BP_Activity_Component extends BP_Component {
120
'activity' => $bp->table_prefix . 'bp_activity_meta',
121
);
122
123
- // Fetch the default directory title.
124
- $default_directory_titles = bp_core_get_directory_page_default_titles();
125
- $default_directory_title = $default_directory_titles[$this->id];
126
-
127
// All globals for activity component.
128
// Note that global_tables is included in this array.
129
$args = array(
130
'slug' => BP_ACTIVITY_SLUG,
131
'root_slug' => isset( $bp->pages->activity->slug ) ? $bp->pages->activity->slug : BP_ACTIVITY_SLUG,
132
'has_directory' => true,
133
- 'directory_title' => isset( $bp->pages->activity->title ) ? $bp->pages->activity->title : $default_directory_title,
134
'notification_callback' => 'bp_activity_format_notifications',
135
'search_string' => __( 'Search Activity...', 'buddypress' ),
136
'global_tables' => $global_tables,
@@ -369,6 +361,19 @@ class BP_Activity_Component extends BP_Component {
369
parent::setup_title();
370
}
371
372
/**
373
* Setup cache groups.
374
*
57
'adminbar',
58
'template',
59
'functions',
60
+ 'notifications',
61
'cache'
62
);
63
64
if ( ! buddypress()->do_autoload ) {
65
$includes[] = 'classes';
66
}
68
// Load Akismet support if Akismet is configured.
69
$akismet_key = bp_get_option( 'wordpress_api_key' );
70
71
+ /** This filter is documented in bp-activity/bp-activity-actions.php */
72
if ( defined( 'AKISMET_VERSION' ) && class_exists( 'Akismet' ) && ( ! empty( $akismet_key ) || defined( 'WPCOM_API_KEY' ) ) && apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) ) {
73
$includes[] = 'akismet';
74
}
116
'activity' => $bp->table_prefix . 'bp_activity_meta',
117
);
118
119
// All globals for activity component.
120
// Note that global_tables is included in this array.
121
$args = array(
122
'slug' => BP_ACTIVITY_SLUG,
123
'root_slug' => isset( $bp->pages->activity->slug ) ? $bp->pages->activity->slug : BP_ACTIVITY_SLUG,
124
'has_directory' => true,
125
+ 'directory_title' => _x( 'Site-Wide Activity', 'component directory title', 'buddypress' ),
126
'notification_callback' => 'bp_activity_format_notifications',
127
'search_string' => __( 'Search Activity...', 'buddypress' ),
128
'global_tables' => $global_tables,
361
parent::setup_title();
362
}
363
364
+ /**
365
+ * Set up actions necessary for the component.
366
+ *
367
+ * @since 1.6.0
368
+ */
369
+ public function setup_actions() {
370
+
371
+ // Spam prevention.
372
+ add_action( 'bp_include', 'bp_activity_setup_akismet' );
373
+
374
+ parent::setup_actions();
375
+ }
376
+
377
/**
378
* Setup cache groups.
379
*
bp-activity/classes/class-bp-activity-list-table.php CHANGED
@@ -428,26 +428,8 @@ class BP_Activity_List_Table extends WP_List_Table {
428
<option value="" <?php selected( ! $selected ); ?>><?php _e( 'View all actions', 'buddypress' ); ?></option>
429
430
<?php foreach ( $activity_actions as $component => $actions ) : ?>
431
- <?php
432
- // Older avatar activity items use 'profile' for component. See r4273.
433
- if ( $component === 'profile' ) {
434
- $component = 'xprofile';
435
- }
436
-
437
- if ( bp_is_active( $component ) ) {
438
- if ( $component === 'xprofile' ) {
439
- $component_name = buddypress()->profile->name;
440
- } else {
441
- $component_name = buddypress()->$component->name;
442
- }
443
-
444
- } else {
445
- // Prevent warnings by other plugins if a component is disabled but the activity type has been registered.
446
- $component_name = ucfirst( $component );
447
- }
448
- ?>
449
-
450
- <optgroup label="<?php echo esc_html( $component_name ); ?>">
451
452
<?php foreach ( $actions as $action_key => $action_values ) : ?>
453
428
<option value="" <?php selected( ! $selected ); ?>><?php _e( 'View all actions', 'buddypress' ); ?></option>
429
430
<?php foreach ( $activity_actions as $component => $actions ) : ?>
431
+
432
+ <optgroup label="<?php echo ucfirst( $component ); ?>">
433
434
<?php foreach ( $actions as $action_key => $action_values ) : ?>
435
bp-activity/js/mentions.min.js CHANGED
@@ -1 +1 @@
1
- window.bp=window.bp||{},function(a,b,c){var d,e=[];a.mentions=a.mentions||{},a.mentions.users=window.bp.mentions.users||[],"object"==typeof window.BP_Suggestions&&(a.mentions.users=window.BP_Suggestions.friends||a.mentions.users),b.fn.bp_mentions=function(a){b.isArray(a)&&(a={data:a});var c={delay:200,hide_without_suffix:!0,insert_tpl:"</>${atwho-data-value}</>",limit:10,start_with_space:!1,suffix:"",callbacks:{filter:function(a,b,c){var d,e,f,g=[],h=new RegExp("^"+a+"| "+a,"ig");for(e=0,f=b.length;e<f;e++)d=b[e],d[c].toLowerCase().match(h)&&g.push(d);return g},highlighter:function(a,b){if(!b)return a;var c=new RegExp(">(\\s*|[\\w\\s]*)("+this.at.replace("+","\\+")+"?"+b.replace("+","\\+")+")([\\w ]*)\\s*<","ig");return a.replace(c,function(a,b,c,d){return">"+b+"<strong>"+c+"</strong>"+d+"<"})},before_reposition:function(a){var c,d,e,f,g=b("#atwho-ground-"+this.id+" .atwho-view"),h=b("body"),i=this.$inputor.data("atwho");"undefined"!==i&&"undefined"!==i.iframe&&null!==i.iframe?(c=this.$inputor.caret("offset",{iframe:i.iframe}),e=b(i.iframe).offset(),"undefined"!==e&&(c.left+=e.left,c.top+=e.top)):c=this.$inputor.caret("offset"),c.left>h.width()/2?(g.addClass("right"),f=c.left-a.left-this.view.$el.width()):(g.removeClass("right"),f=c.left-a.left+1),h.width()<=400&&b(document).scrollTop(c.top-6),d=parseInt(this.$inputor.css("line-height").substr(0,this.$inputor.css("line-height").length-2),10),(!d||d<5)&&(d=19),a.top=c.top+d,a.left+=f},inserting_wrapper:function(a,b,c){return""+b+c}}},f={callbacks:{remote_filter:function(a,c){var f=b(this),g={};return d=e[a],"object"==typeof d?void c(d):(f.xhr&&f.xhr.abort(),g={action:"bp_get_suggestions",term:a,type:"members"},b.isNumeric(this.$inputor.data("suggestions-group-id"))&&(g["group-id"]=parseInt(this.$inputor.data("suggestions-group-id"),10)),void(f.xhr=b.getJSON(ajaxurl,g).done(function(d){if(d.success){var f=b.map(d.data,function(a){return a.search=a.search||a.ID+" "+a.name,a});e[a]=f,c(f)}})))}},data:b.map(a.data,function(a){return a.search=a.search||a.ID+" "+a.name,a}),at:"@",search_key:"search",tpl:'<li data-value="@${ID}"><img src="${image}" /><span class="username">@${ID}</span><small>${name}</small></li>'},g=b.extend(!0,{},c,f,a);return b.fn.atwho.call(this,g)},b(document).ready(function(){b(".bp-suggestions, #comments form textarea, .wp-editor-area").bp_mentions(a.mentions.users)}),a.mentions.tinyMCEinit=function(){"undefined"!=typeof window.tinyMCE&&null!==window.tinyMCE.activeEditor&&"undefined"!=typeof window.tinyMCE.activeEditor&&b(window.tinyMCE.activeEditor.contentDocument.activeElement).atwho("setIframe",b(".wp-editor-wrap iframe")[0]).bp_mentions(a.mentions.users)}}(bp,jQuery);
1
+ window.bp=window.bp||{},function(a,b,c){var d,e=[];a.mentions=a.mentions||{},a.mentions.users=window.bp.mentions.users||[],"object"==typeof window.BP_Suggestions&&(a.mentions.users=window.BP_Suggestions.friends||a.mentions.users),b.fn.bp_mentions=function(a){b.isArray(a)&&(a={data:a});var c={delay:200,hide_without_suffix:!0,insert_tpl:"</>${atwho-data-value}</>",limit:10,start_with_space:!1,suffix:"",callbacks:{filter:function(a,b,c){var d,e,f,g=[],h=new RegExp("^"+a+"| "+a,"ig");for(e=0,f=b.length;f>e;e++)d=b[e],d[c].toLowerCase().match(h)&&g.push(d);return g},highlighter:function(a,b){if(!b)return a;var c=new RegExp(">(\\s*|[\\w\\s]*)("+this.at.replace("+","\\+")+"?"+b.replace("+","\\+")+")([\\w ]*)\\s*<","ig");return a.replace(c,function(a,b,c,d){return">"+b+"<strong>"+c+"</strong>"+d+"<"})},before_reposition:function(a){var c,d,e,f,g=b("#atwho-ground-"+this.id+" .atwho-view"),h=b("body"),i=this.$inputor.data("atwho");"undefined"!==i&&"undefined"!==i.iframe&&null!==i.iframe?(c=this.$inputor.caret("offset",{iframe:i.iframe}),e=b(i.iframe).offset(),"undefined"!==e&&(c.left+=e.left,c.top+=e.top)):c=this.$inputor.caret("offset"),c.left>h.width()/2?(g.addClass("right"),f=c.left-a.left-this.view.$el.width()):(g.removeClass("right"),f=c.left-a.left+1),h.width()<=400&&b(document).scrollTop(c.top-6),d=parseInt(this.$inputor.css("line-height").substr(0,this.$inputor.css("line-height").length-2),10),(!d||5>d)&&(d=19),a.top=c.top+d,a.left+=f},inserting_wrapper:function(a,b,c){return""+b+c}}},f={callbacks:{remote_filter:function(a,c){var f=b(this),g={};return d=e[a],"object"==typeof d?void c(d):(f.xhr&&f.xhr.abort(),g={action:"bp_get_suggestions",term:a,type:"members"},b.isNumeric(this.$inputor.data("suggestions-group-id"))&&(g["group-id"]=parseInt(this.$inputor.data("suggestions-group-id"),10)),void(f.xhr=b.getJSON(ajaxurl,g).done(function(d){if(d.success){var f=b.map(d.data,function(a){return a.search=a.search||a.ID+" "+a.name,a});e[a]=f,c(f)}})))}},data:b.map(a.data,function(a){return a.search=a.search||a.ID+" "+a.name,a}),at:"@",search_key:"search",tpl:'<li data-value="@${ID}"><img src="${image}" /><span class="username">@${ID}</span><small>${name}</small></li>'},g=b.extend(!0,{},c,f,a);return b.fn.atwho.call(this,g)},b(document).ready(function(){b(".bp-suggestions, #comments form textarea, .wp-editor-area").bp_mentions(a.mentions.users)}),a.mentions.tinyMCEinit=function(){"undefined"!=typeof window.tinyMCE&&null!==window.tinyMCE.activeEditor&&"undefined"!=typeof window.tinyMCE.activeEditor&&b(window.tinyMCE.activeEditor.contentDocument.activeElement).atwho("setIframe",b(".wp-editor-wrap iframe")[0]).bp_mentions(a.mentions.users)}}(bp,jQuery);
bp-blogs/bp-blogs-activity.php CHANGED
@@ -1291,7 +1291,7 @@ function bp_blogs_can_comment_reply( $retval, $comment ) {
1291
1292
// Check comment depth and disable if depth is too large.
1293
if ( isset( buddypress()->blogs->thread_depth[$comment->item_id] ) ){
1294
- if ( bp_activity_get_comment_depth() > buddypress()->blogs->thread_depth[$comment->item_id] ) {
1295
$retval = false;
1296
}
1297
}
1291
1292
// Check comment depth and disable if depth is too large.
1293
if ( isset( buddypress()->blogs->thread_depth[$comment->item_id] ) ){
1294
+ if ( $comment->mptt_left > buddypress()->blogs->thread_depth[$comment->item_id] ) {
1295
$retval = false;
1296
}
1297
}
bp-blogs/bp-blogs-filters.php CHANGED
@@ -121,17 +121,3 @@ function bp_blogs_post_pre_publish( $return = true, $blog_id = 0, $post_id = 0,
121
}
122
add_filter( 'bp_activity_post_pre_publish', 'bp_blogs_post_pre_publish', 10, 4 );
123
add_filter( 'bp_activity_post_pre_comment', 'bp_blogs_post_pre_publish', 10, 4 );
124
-
125
- /**
126
- * Registers our custom thumb size with WP's Site Icon feature.
127
- *
128
- * @since 2.7.0
129
- *
130
- * @param array $sizes Current array of custom site icon sizes.
131
- * @return array
132
- */
133
- function bp_blogs_register_custom_site_icon_size( $sizes ) {
134
- $sizes[] = bp_core_avatar_thumb_width();
135
- return $sizes;
136
- }
137
- add_filter( 'site_icon_image_sizes', 'bp_blogs_register_custom_site_icon_size' );
121
}
122
add_filter( 'bp_activity_post_pre_publish', 'bp_blogs_post_pre_publish', 10, 4 );
123
add_filter( 'bp_activity_post_pre_comment', 'bp_blogs_post_pre_publish', 10, 4 );
bp-blogs/bp-blogs-functions.php CHANGED
@@ -475,26 +475,6 @@ function bp_blogs_update_option_thread_comments_depth( $oldvalue, $newvalue ) {
475
}
476
add_action( 'update_option_thread_comments_depth', 'bp_blogs_update_option_thread_comments_depth', 10, 2 );
477
478
- /**
479
- * Syncs site icon URLs to blogmeta.
480
- *
481
- * @since 2.7.0
482
- *
483
- * @param int|string $old_value Old value
484
- * @param int|string $new_value New value
485
- */
486
- function bp_blogs_update_option_site_icon( $old_value, $new_value ) {
487
- if ( 0 === $new_value ) {
488
- bp_blogs_update_blogmeta( get_current_blog_id(), 'site_icon_url_thumb', 0 );
489
- bp_blogs_update_blogmeta( get_current_blog_id(), 'site_icon_url_full', 0 );
490
- } else {
491
- // Save site icon URL as blogmeta.
492
- bp_blogs_update_blogmeta( get_current_blog_id(), 'site_icon_url_thumb', get_site_icon_url( bp_core_avatar_thumb_width() ) );
493
- bp_blogs_update_blogmeta( get_current_blog_id(), 'site_icon_url_full', get_site_icon_url( bp_core_avatar_full_width() ) );
494
- }
495
- }
496
- add_action( 'update_option_site_icon', 'bp_blogs_update_option_site_icon', 10, 2 );
497
-
498
/**
499
* Deletes the 'url' blogmeta for a site.
500
*
475
}
476
add_action( 'update_option_thread_comments_depth', 'bp_blogs_update_option_thread_comments_depth', 10, 2 );
477
478
/**
479
* Deletes the 'url' blogmeta for a site.
480
*
bp-blogs/bp-blogs-loader.php CHANGED
@@ -20,8 +20,6 @@ if ( ! buddypress()->do_autoload ) {
20
21
/**
22
* Set up the bp-blogs component.
23
- *
24
- * @since 1.5.0
25
*/
26
function bp_setup_blogs() {
27
buddypress()->blogs = new BP_Blogs_Component();
20
21
/**
22
* Set up the bp-blogs component.
23
*/
24
function bp_setup_blogs() {
25
buddypress()->blogs = new BP_Blogs_Component();
bp-blogs/bp-blogs-template.php CHANGED
@@ -220,20 +220,9 @@ function bp_the_blog() {
220
/**
221
* Output the blogs pagination count.
222
*
223
- * @since 1.0.0
224
- */
225
- function bp_blogs_pagination_count() {
226
- echo bp_get_blogs_pagination_count();
227
- }
228
-
229
- /**
230
- * Get the blogs pagination count.
231
- *
232
- * @since 2.7.0
233
- *
234
* @global object $blogs_template {@link BP_Blogs_Template}
235
*/
236
- function bp_get_blogs_pagination_count() {
237
global $blogs_template;
238
239
$start_num = intval( ( $blogs_template->pag_page - 1 ) * $blogs_template->pag_num ) + 1;
@@ -247,17 +236,7 @@ function bp_get_blogs_pagination_count() {
247
$message = sprintf( _n( 'Viewing %1$s - %2$s of %3$s site', 'Viewing %1$s - %2$s of %3$s sites', $blogs_template->total_blog_count, 'buddypress' ), $from_num, $to_num, $total );
248
}
249
250
- /**
251
- * Filters the "Viewing x-y of z blogs" pagination message.
252
- *
253
- * @since 2.7.0
254
- *
255
- * @param string $message "Viewing x-y of z blogs" text.
256
- * @param string $from_num Total amount for the low value in the range.
257
- * @param string $to_num Total amount for the high value in the range.
258
- * @param string $total Total amount of blogs found.
259
- */
260
- return apply_filters( 'bp_get_blogs_pagination_count', $message, $from_num, $to_num, $total );
261
}
262
263
/**
@@ -345,77 +324,19 @@ function bp_blog_avatar( $args = '' ) {
345
'no_grav' => true,
346
) );
347
348
- // Use site icon if available.
349
- $avatar = '';
350
- if ( bp_is_active( 'blogs', 'site-icon' ) && function_exists( 'has_site_icon' ) ) {
351
- $site_icon = bp_blogs_get_blogmeta( bp_get_blog_id(), "site_icon_url_{$r['type']}" );
352
-
353
- // Never attempted to fetch site icon before; do it now!
354
- if ( '' === $site_icon ) {
355
- switch_to_blog( bp_get_blog_id() );
356
-
357
- // Fetch the other size first.
358
- if ( 'full' === $r['type'] ) {
359
- $size = bp_core_avatar_thumb_width();
360
- $save_size = 'thumb';
361
- } else {
362
- $size = bp_core_avatar_full_width();
363
- $save_size = 'full';
364
- }
365
-
366
- $site_icon = get_site_icon_url( $size );
367
- // Empty site icons get saved as integer 0.
368
- if ( empty( $site_icon ) ) {
369
- $site_icon = 0;
370
- }
371
-
372
- // Sync site icon for other size to blogmeta.
373
- bp_blogs_update_blogmeta( bp_get_blog_id(), "site_icon_url_{$save_size}", $site_icon );
374
-
375
- // Now, fetch the size we want.
376
- if ( 0 !== $site_icon ) {
377
- $size = 'full' === $r['type'] ? bp_core_avatar_full_width() : bp_core_avatar_thumb_width();
378
- $site_icon = get_site_icon_url( $size );
379
- }
380
-
381
- // Sync site icon to blogmeta.
382
- bp_blogs_update_blogmeta( bp_get_blog_id(), "site_icon_url_{$r['type']}", $site_icon );
383
-
384
- restore_current_blog();
385
- }
386
-
387
- // We have a site icon.
388
- if ( ! is_numeric( $site_icon ) ) {
389
- if ( empty( $r['width'] ) && ! isset( $size ) ) {
390
- $size = 'full' === $r['type'] ? bp_core_avatar_full_width() : bp_core_avatar_thumb_width();
391
- } else {
392
- $size = (int) $r['width'];
393
- }
394
-
395
- $avatar = sprintf( '<img src="%1$s" class="%2$s" width="%3$s" height="%3$s" alt="%4$s" title="%4$s" />',
396
- esc_url( $site_icon ),
397
- esc_attr( "{$r['class']} avatar-{$size}" ),
398
- esc_attr( $size ),
399
- sprintf( esc_attr__( 'Site icon for %s', 'buddypress' ), bp_get_blog_name() )
400
- );
401
- }
402
- }
403
-
404
- // Fallback to user ID avatar.
405
- if ( '' === $avatar ) {
406
- $avatar = bp_core_fetch_avatar( array(
407
- 'item_id' => $blogs_template->blog->admin_user_id,
408
- 'title' => $r['title'],
409
- // 'avatar_dir' => 'blog-avatars',
410
- // 'object' => 'blog',
411
- 'type' => $r['type'],
412
- 'alt' => $r['alt'],
413
- 'css_id' => $r['id'],
414
- 'class' => $r['class'],
415
- 'width' => $r['width'],
416
- 'height' => $r['height']
417
- ) );
418
- }
419
420
/**
421
* In future BuddyPress versions you will be able to set the avatar for a blog.
@@ -1111,8 +1032,9 @@ function bp_blogs_signup_blog( $blogname = '', $blog_title = '', $errors = '' )
1111
echo '<input name="blog_title" type="text" id="blog_title" value="'.esc_html($blog_title, 1).'" /></p>';
1112
?>
1113
1114
- <fieldset class="create-site">
1115
- <legend class="label"><?php _e('Privacy: I would like my site to appear in search engines, and in public listings around this network', 'buddypress') ?></legend>
1116
1117
<label class="checkbox" for="blog_public_on">
1118
<input type="radio" id="blog_public_on" name="blog_public" value="1" <?php if( !isset( $_POST['blog_public'] ) || '1' == $_POST['blog_public'] ) { ?>checked="checked"<?php } ?> />
@@ -1122,7 +1044,7 @@ function bp_blogs_signup_blog( $blogname = '', $blog_title = '', $errors = '' )
1122
<input type="radio" id="blog_public_off" name="blog_public" value="0" <?php if( isset( $_POST['blog_public'] ) && '0' == $_POST['blog_public'] ) { ?>checked="checked"<?php } ?> />
1123
<strong><?php _e( 'No' , 'buddypress'); ?></strong>
1124
</label>
1125
- </fieldset>
1126
1127
<?php
1128
@@ -1358,6 +1280,7 @@ function bp_blog_create_button() {
1358
'id' => 'create_blog',
1359
'component' => 'blogs',
1360
'link_text' => __( 'Create a Site', 'buddypress' ),
1361
'link_class' => 'blog-create no-ajax',
1362
'link_href' => trailingslashit( bp_get_blogs_directory_permalink() . 'create' ),
1363
'wrapper' => false,
@@ -1454,6 +1377,7 @@ function bp_blogs_visit_blog_button( $args = '' ) {
1454
* @type string $link_href Permalink of the current blog in the loop.
1455
* @type string $link_class Default: 'blog-button visit'.
1456
* @type string $link_text Default: 'Visit Site'.
1457
* }
1458
* @return string The HTML for the Visit button.
1459
*/
@@ -1467,6 +1391,7 @@ function bp_blogs_visit_blog_button( $args = '' ) {
1467
'link_href' => bp_get_blog_permalink(),
1468
'link_class' => 'blog-button visit',
1469
'link_text' => __( 'Visit Site', 'buddypress' ),
1470
);
1471
1472
$button = wp_parse_args( $args, $defaults );
220
/**
221
* Output the blogs pagination count.
222
*
223
* @global object $blogs_template {@link BP_Blogs_Template}
224
*/
225
+ function bp_blogs_pagination_count() {
226
global $blogs_template;
227
228
$start_num = intval( ( $blogs_template->pag_page - 1 ) * $blogs_template->pag_num ) + 1;
236
$message = sprintf( _n( 'Viewing %1$s - %2$s of %3$s site', 'Viewing %1$s - %2$s of %3$s sites', $blogs_template->total_blog_count, 'buddypress' ), $from_num, $to_num, $total );
237
}
238
239
+ echo $message;
240
}
241
242
/**
324
'no_grav' => true,
325
) );
326
327
+ // Fetch the avatar.
328
+ $avatar = bp_core_fetch_avatar( array(
329
+ 'item_id' => $blogs_template->blog->admin_user_id,
330
+ 'title' => $r['title'],
331
+ // 'avatar_dir' => 'blog-avatars',
332
+ // 'object' => 'blog',
333
+ 'type' => $r['type'],
334
+ 'alt' => $r['alt'],
335
+ 'css_id' => $r['id'],
336
+ 'class' => $r['class'],
337
+ 'width' => $r['width'],
338
+ 'height' => $r['height']
339
+ ) );
340
341
/**
342
* In future BuddyPress versions you will be able to set the avatar for a blog.
1032
echo '<input name="blog_title" type="text" id="blog_title" value="'.esc_html($blog_title, 1).'" /></p>';
1033
?>
1034
1035
+ <p>
1036
+ <label for="blog_public_on"><?php _e('Privacy:', 'buddypress') ?></label>