BuddyPress - Version 1.9

Version Description

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

Download this release

Release Info

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

Code changes from version 1.9-beta2 to 1.9

Files changed (65) hide show
  1. .travis.yml +0 -52
  2. bp-activity/bp-activity-classes.php +6 -1
  3. bp-core/admin/bp-core-functions.php +12 -2
  4. bp-core/admin/css/common.css +277 -68
  5. bp-core/admin/css/common.min.css +1 -1
  6. bp-core/bp-core-admin.php +69 -39
  7. bp-core/bp-core-classes.php +8 -0
  8. bp-core/bp-core-functions.php +10 -5
  9. bp-core/bp-core-template.php +6 -0
  10. bp-core/bp-core-theme-compatibility.php +1 -1
  11. bp-friends/bp-friends-functions.php +6 -0
  12. bp-friends/bp-friends-widgets.php +2 -3
  13. bp-groups/bp-groups-buddybar.php +3 -2
  14. bp-groups/bp-groups-cache.php +30 -15
  15. bp-groups/bp-groups-classes.php +1007 -181
  16. bp-groups/bp-groups-notifications.php +34 -12
  17. bp-languages/buddypress.pot +229 -221
  18. bp-loader.php +2 -2
  19. bp-members/bp-members-functions.php +12 -5
  20. bp-messages/bp-messages-notifications.php +7 -5
  21. bp-notifications/bp-notifications-functions.php +2 -1
  22. bp-templates/bp-legacy/buddypress/members/single/groups/invites.php +1 -1
  23. bp-templates/bp-legacy/css/buddypress.css +2 -0
  24. bp-themes/bp-default/rtl.css +1 -1
  25. bp-themes/bp-default/style.css +1 -1
  26. bp-xprofile/bp-xprofile-template.php +1 -1
  27. readme.txt +10 -4
  28. tests/assets/group-extensions.php +0 -148
  29. tests/bootstrap.php +0 -55
  30. tests/includes/factory.php +0 -165
  31. tests/includes/install.php +0 -74
  32. tests/includes/loader.php +0 -6
  33. tests/includes/testcase.php +0 -317
  34. tests/multisite.xml +0 -17
  35. tests/phpunit.xml +0 -14
  36. tests/testcases/activity/class.BP_Activity_Activity.php +0 -308
  37. tests/testcases/activity/functions.php +0 -208
  38. tests/testcases/activity/template.php +0 -256
  39. tests/testcases/admin/functions.php +0 -123
  40. tests/testcases/blogs/class-bp-blogs-blog.php +0 -67
  41. tests/testcases/core/avatars.php +0 -56
  42. tests/testcases/core/class-bp-core-user.php +0 -124
  43. tests/testcases/core/class-bp-user-query.php +0 -301
  44. tests/testcases/core/functions.php +0 -258
  45. tests/testcases/friends/class-bp-friends-friendship.php +0 -126
  46. tests/testcases/groups/class-bp-group-extension.php +0 -225
  47. tests/testcases/groups/class-bp-group-member-query.php +0 -337
  48. tests/testcases/groups/class-bp-groups-group.php +0 -657
  49. tests/testcases/groups/class-bp-groups-member.php +0 -131
  50. tests/testcases/groups/functions.php +0 -288
  51. tests/testcases/groups/template.php +0 -410
  52. tests/testcases/members/functions.php +0 -79
  53. tests/testcases/members/template.php +0 -102
  54. tests/testcases/routing/activity.php +0 -68
  55. tests/testcases/routing/anonymous.php +0 -29
  56. tests/testcases/routing/core.php +0 -31
  57. tests/testcases/routing/friends.php +0 -30
  58. tests/testcases/routing/groups.php +0 -30
  59. tests/testcases/routing/members.php +0 -30
  60. tests/testcases/routing/messages.php +0 -40
  61. tests/testcases/routing/settings.php +0 -40
  62. tests/testcases/routing/xprofile.php +0 -35
  63. tests/testcases/url/url.php +0 -65
  64. tests/testcases/xprofile/class-bp-xprofile-field.php +0 -29
  65. tests/testcases/xprofile/functions.php +0 -83
.travis.yml DELETED
@@ -1,52 +0,0 @@
1
- language: php
2
-
3
- php:
4
- - 5.2
5
- - 5.3
6
- - 5.4
7
- - 5.5
8
-
9
- env:
10
- - WP_VERSION=master WP_MULTISITE=0
11
- - WP_VERSION=3.7.1 WP_MULTISITE=0
12
- - WP_VERSION=3.6.1 WP_MULTISITE=0
13
- - WP_VERSION=3.5.2 WP_MULTISITE=0
14
- - WP_VERSION=master WP_MULTISITE=1
15
- - WP_VERSION=3.7.1 WP_MULTISITE=1
16
- - WP_VERSION=3.6.1 WP_MULTISITE=1
17
- - WP_VERSION=3.5.2 WP_MULTISITE=1
18
-
19
- before_script:
20
- # set up WP install
21
- - WP_CORE_DIR=/tmp/wordpress/
22
- - wget -nv -O /tmp/wordpress.tar.gz https://github.com/WordPress/WordPress/tarball/$WP_VERSION
23
- - mkdir -p $WP_CORE_DIR
24
- - tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR
25
- - plugin_slug=$(basename $(pwd))
26
- - plugin_dir=$WP_CORE_DIR/wp-content/plugins/$plugin_slug
27
- - cd ..
28
- - mv $plugin_slug $plugin_dir
29
- # set up testing suite
30
- - export WP_TESTS_DIR=/tmp/wordpress-tests/
31
- - svn co --ignore-externals http://unit-tests.svn.wordpress.org/trunk/ $WP_TESTS_DIR
32
- - cd $WP_TESTS_DIR
33
- - cp wp-tests-config-sample.php wp-tests-config.php
34
- - sed -i "s:dirname( __FILE__ ) . '/wordpress/':'$WP_CORE_DIR':" wp-tests-config.php
35
- - sed -i "s/yourdbnamehere/wordpress_test/" wp-tests-config.php
36
- - sed -i "s/yourusernamehere/root/" wp-tests-config.php
37
- - sed -i "s/yourpasswordhere//" wp-tests-config.php
38
- # set up database
39
- - mysql -e 'CREATE DATABASE wordpress_test;' -uroot
40
- # prepare for running the tests
41
- - cd $plugin_dir/tests
42
-
43
- script: phpunit
44
-
45
- notifications:
46
- email: false
47
-
48
- irc:
49
- channels:
50
- - "irc.freenode.net#buddypress-dev"
51
- template:
52
- - "Build %{build_number} (%{branch} - %{commit}): %{message} %{build_url}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bp-activity/bp-activity-classes.php CHANGED
@@ -351,9 +351,14 @@ class BP_Activity_Activity {
351
  // Alter the query based on whether we want to show activity item
352
  // comments in the stream like normal comments or threaded below
353
  // the activity.
354
- if ( false === $display_comments || 'threaded' === $display_comments )
355
  $where_conditions[] = "a.type != 'activity_comment'";
 
 
 
 
356
 
 
357
  $where_sql = 'WHERE ' . join( ' AND ', $where_conditions );
358
 
359
  // Define the preferred order for indexes
351
  // Alter the query based on whether we want to show activity item
352
  // comments in the stream like normal comments or threaded below
353
  // the activity.
354
+ if ( false === $display_comments || 'threaded' === $display_comments ) {
355
  $where_conditions[] = "a.type != 'activity_comment'";
356
+ }
357
+
358
+ // Filter the where conditions
359
+ $where_conditions = apply_filters( 'bp_activity_get_where_conditions', $where_conditions, $r, $select_sql, $from_sql, $join_sql );
360
 
361
+ // Join the where conditions together
362
  $where_sql = 'WHERE ' . join( ' AND ', $where_conditions );
363
 
364
  // Define the preferred order for indexes
bp-core/admin/bp-core-functions.php CHANGED
@@ -209,6 +209,16 @@ function bp_core_activation_notice() {
209
  return;
210
  }
211
 
 
 
 
 
 
 
 
 
 
 
212
  /**
213
  * Check to make sure that the blog setup routine has run. This can't happen during the
214
  * wizard because of the order which the components are loaded. We check for multisite here
@@ -285,7 +295,7 @@ function bp_core_activation_notice() {
285
 
286
  if ( !empty( $orphaned_components ) ) {
287
  $admin_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) );
288
- $notice = sprintf( __( 'The following active BuddyPress Components do not have associated WordPress Pages: %2$s. <a href="%1$s" class="button-secondary">Repair</a>', 'buddypress' ), $admin_url, '<strong>' . implode( '</strong>, <strong>', $orphaned_components ) . '</strong>' );
289
 
290
  bp_core_add_admin_notice( $notice );
291
  }
@@ -307,7 +317,7 @@ function bp_core_activation_notice() {
307
  // If there are duplicates, post a message about them
308
  if ( !empty( $dupe_names ) ) {
309
  $admin_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) );
310
- $notice = sprintf( __( 'Each BuddyPress Component needs its own WordPress page. The following WordPress Pages have more than one component associated with them: %2$s. <a href="%1$s" class="button-secondary">Repair</a>', 'buddypress' ), $admin_url, '<strong>' . implode( '</strong>, <strong>', $dupe_names ) . '</strong>' );
311
 
312
  bp_core_add_admin_notice( $notice );
313
  }
209
  return;
210
  }
211
 
212
+ // Bail if in network admin, and BuddyPress is not network activated
213
+ if ( is_network_admin() && ! bp_is_network_activated() ) {
214
+ return;
215
+ }
216
+
217
+ // Bail in network admin
218
+ if ( is_user_admin() ) {
219
+ return;
220
+ }
221
+
222
  /**
223
  * Check to make sure that the blog setup routine has run. This can't happen during the
224
  * wizard because of the order which the components are loaded. We check for multisite here
295
 
296
  if ( !empty( $orphaned_components ) ) {
297
  $admin_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) );
298
+ $notice = sprintf( __( 'The following active BuddyPress Components do not have associated WordPress Pages: %2$s. <a href="%1$s">Repair</a>', 'buddypress' ), $admin_url, '<strong>' . implode( '</strong>, <strong>', $orphaned_components ) . '</strong>' );
299
 
300
  bp_core_add_admin_notice( $notice );
301
  }
317
  // If there are duplicates, post a message about them
318
  if ( !empty( $dupe_names ) ) {
319
  $admin_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) );
320
+ $notice = sprintf( __( 'Each BuddyPress Component needs its own WordPress page. The following WordPress Pages have more than one component associated with them: %2$s. <a href="%1$s">Repair</a>', 'buddypress' ), $admin_url, '<strong>' . implode( '</strong>, <strong>', $dupe_names ) . '</strong>' );
321
 
322
  bp_core_add_admin_notice( $notice );
323
  }
bp-core/admin/css/common.css CHANGED
@@ -7,15 +7,18 @@
7
  /* Icon 32's
8
  ------------------------------------------------------------------------------*/
9
 
10
- div#icon-buddypress {
 
11
  background: url('../images/icons32.png') no-repeat -370px -6px;
12
  }
13
 
14
- div#icon-buddypress-activity {
 
15
  background: url('../images/icons32.png') no-repeat -10px -6px;
16
  }
17
 
18
- div#icon-buddypress-groups {
 
19
  background: url('../images/icons32.png') no-repeat -250px -6px;
20
  }
21
 
@@ -23,46 +26,68 @@ div#icon-buddypress-groups {
23
  ------------------------------------------------------------------------------*/
24
 
25
  /* Backpat */
26
- ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,
27
- ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image {
 
 
28
  background-image: url('../images/menu.png') !important;
29
  background-position: -178px -34px;
30
  }
31
 
32
- ul#adminmenu li.toplevel_page_bp-components:hover .wp-menu-image,
33
- ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image,
34
- ul#adminmenu li.toplevel_page_bp-components.wp-has-current-submenu .wp-menu-image,
35
- ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image {
 
 
 
 
36
  background-position: -178px -2px;
37
  }
38
 
39
  /* Activity */
40
- ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,
41
- ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image {
 
 
42
  background-image: url('../images/menu.png');
43
  background-position: 0 -34px;
44
  }
45
- ul#adminmenu li.toplevel_page_bp-activity:hover .wp-menu-image,
46
- ul#adminmenu li.toplevel_page_bp-activity.current .wp-menu-image,
47
- ul#adminmenu li.toplevel_page_bp-activity.wp-has-current-submenu .wp-menu-image,
48
- ul#adminmenu li.toplevel_page_bp-activity_network:hover .wp-menu-image,
49
- ul#adminmenu li.toplevel_page_bp-activity_network.current .wp-menu-image,
50
- ul#adminmenu li.toplevel_page_bp-activity_network.wp-has-current-submenu .wp-menu-image {
 
 
 
 
 
 
51
  background-position: 0 -2px;
52
  }
53
 
54
  /* Groups */
55
- ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,
56
- ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image {
 
 
57
  background-image: url('../images/menu.png');
58
  background-position: -61px -34px;
59
  }
60
- ul#adminmenu li.toplevel_page_bp-groups:hover .wp-menu-image,
61
- ul#adminmenu li.toplevel_page_bp-groups.current .wp-menu-image,
62
- ul#adminmenu li.toplevel_page_bp-groups.wp-has-current-submenu .wp-menu-image,
63
- ul#adminmenu li.toplevel_page_bp-groups_network:hover .wp-menu-image,
64
- ul#adminmenu li.toplevel_page_bp-groups_network.current .wp-menu-image,
65
- ul#adminmenu li.toplevel_page_bp-groups_network.wp-has-current-submenu .wp-menu-image {
 
 
 
 
 
 
66
  background-position: -61px -2px;
67
  }
68
  th.column-gid {
@@ -90,73 +115,248 @@ table.bp-group-members .urole-column {
90
  /* Components
91
  ------------------------------------------------------------------------------*/
92
 
93
- .dashboard_page_bp-wizard td.plugin-title span,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  .settings_page_bp-components td.plugin-title span {
95
  float: left;
96
  width: 18px;
97
  height: 18px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  background-image: url('../images/menu.png');
99
  background-position: -4px -40px;
100
  background-repeat: no-repeat;
101
- margin-right: 5px;
102
  }
103
 
104
- .dashboard_page_bp-wizard tr.active td.plugin-title span,
105
- .settings_page_bp-components tr.active td.plugin-title span {
106
  background-position-y: -7px;
107
  }
108
 
109
- .dashboard_page_bp-wizard tr.activity td.plugin-title span,
110
- .settings_page_bp-components tr.activity td.plugin-title span {
111
- background-position-x: -4px;
 
 
 
 
 
112
  }
113
 
114
- .dashboard_page_bp-wizard tr.xprofile td.plugin-title span,
115
- .settings_page_bp-components tr.xprofile td.plugin-title span {
116
  background-image: url('../images/menu-wp.png');
117
- background-position-x: -305px;
 
 
 
 
 
118
  }
119
 
120
- .dashboard_page_bp-wizard tr.settings td.plugin-title span,
121
- .settings_page_bp-components tr.settings td.plugin-title span {
122
  background-image: url('../images/menu-wp.png');
123
- background-position-x: -334px;
124
  }
125
 
126
- .dashboard_page_bp-wizard tr.groups td.plugin-title span,
127
- .settings_page_bp-components tr.groups td.plugin-title span {
128
- background-position-x: -66px;
129
  }
130
 
131
- .dashboard_page_bp-wizard tr.messages td.plugin-title span,
132
- .settings_page_bp-components tr.messages td.plugin-title span {
133
- background-position-x: -154px;
134
  }
135
 
136
- .dashboard_page_bp-wizard tr.forums td.plugin-title span,
137
- .settings_page_bp-components tr.forums td.plugin-title span {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  background-image: url('../images/menu-wp.png');
139
- background-position-x: -36px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  }
141
 
142
- .dashboard_page_bp-wizard tr.blogs td.plugin-title span,
143
- .settings_page_bp-components tr.blogs td.plugin-title span {
144
- background-position-x: -125px;
145
  }
146
 
147
- .dashboard_page_bp-wizard tr.friends td.plugin-title span,
148
- .settings_page_bp-components tr.friends td.plugin-title span {
149
- background-position-x: -95px;
150
  }
151
 
152
- .dashboard_page_bp-wizard tr.core td.plugin-title span,
153
- .settings_page_bp-components tr.core td.plugin-title span {
154
- background-position-x: -184px;
155
  }
156
 
157
- .dashboard_page_bp-wizard tr.members td.plugin-title span,
158
- .settings_page_bp-components tr.members td.plugin-title span {
159
- background-position-x: -36px;
160
  }
161
 
162
  #bp-admin-component-form .widefat th {
@@ -194,20 +394,29 @@ table.bp-group-members .urole-column {
194
  @media only screen and (-webkit-min-device-pixel-ratio: 1.5) {
195
 
196
  /* Icon 32 */
197
- div#icon-buddypress,
198
- div#icon-buddypress-activity,
199
- div#icon-buddypress-groups {
 
 
 
200
  background-image: url('../images/icons64.png');
201
  background-size: 419px 45px;
202
  }
203
 
204
  /* Backpat */
205
- ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,
206
- ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,
207
- ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,
208
- ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image,
209
- ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,
210
- ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image {
 
 
 
 
 
 
211
  background-image: url('../images/menu-2x.png') !important;
212
  background-size: 209px 64px;
213
  }
7
  /* Icon 32's
8
  ------------------------------------------------------------------------------*/
9
 
10
+ body.branch-3-6 div#icon-buddypress,
11
+ body.branch-3-7 div#icon-buddypress {
12
  background: url('../images/icons32.png') no-repeat -370px -6px;
13
  }
14
 
15
+ body.branch-3-6 div#icon-buddypress-activity,
16
+ body.branch-3-7 div#icon-buddypress-activity {
17
  background: url('../images/icons32.png') no-repeat -10px -6px;
18
  }
19
 
20
+ body.branch-3-6 div#icon-buddypress-groups,
21
+ body.branch-3-7 div#icon-buddypress-groups {
22
  background: url('../images/icons32.png') no-repeat -250px -6px;
23
  }
24
 
26
  ------------------------------------------------------------------------------*/
27
 
28
  /* Backpat */
29
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,
30
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,
31
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,
32
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image {
33
  background-image: url('../images/menu.png') !important;
34
  background-position: -178px -34px;
35
  }
36
 
37
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components:hover .wp-menu-image,
38
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image,
39
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components.wp-has-current-submenu .wp-menu-image,
40
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image,
41
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components:hover .wp-menu-image,
42
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image,
43
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components.wp-has-current-submenu .wp-menu-image,
44
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image {
45
  background-position: -178px -2px;
46
  }
47
 
48
  /* Activity */
49
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,
50
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image,
51
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,
52
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image {
53
  background-image: url('../images/menu.png');
54
  background-position: 0 -34px;
55
  }
56
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity:hover .wp-menu-image,
57
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity.current .wp-menu-image,
58
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity.wp-has-current-submenu .wp-menu-image,
59
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network:hover .wp-menu-image,
60
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network.current .wp-menu-image,
61
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network.wp-has-current-submenu .wp-menu-image,
62
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity:hover .wp-menu-image,
63
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity.current .wp-menu-image,
64
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity.wp-has-current-submenu .wp-menu-image,
65
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network:hover .wp-menu-image,
66
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network.current .wp-menu-image,
67
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network.wp-has-current-submenu .wp-menu-image {
68
  background-position: 0 -2px;
69
  }
70
 
71
  /* Groups */
72
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,
73
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image,
74
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,
75
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image {
76
  background-image: url('../images/menu.png');
77
  background-position: -61px -34px;
78
  }
79
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups:hover .wp-menu-image,
80
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups.current .wp-menu-image,
81
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups.wp-has-current-submenu .wp-menu-image,
82
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network:hover .wp-menu-image,
83
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network.current .wp-menu-image,
84
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network.wp-has-current-submenu .wp-menu-image,
85
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups:hover .wp-menu-image,
86
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups.current .wp-menu-image,
87
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups.wp-has-current-submenu .wp-menu-image,
88
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network:hover .wp-menu-image,
89
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network.current .wp-menu-image,
90
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network.wp-has-current-submenu .wp-menu-image {
91
  background-position: -61px -2px;
92
  }
93
  th.column-gid {
115
  /* Components
116
  ------------------------------------------------------------------------------*/
117
 
118
+ /* Dashicons */
119
+ #adminmenu #toplevel_page_bp-activity .wp-menu-image:before,
120
+ #adminmenu #toplevel_page_bp-activity_user .wp-menu-image:before,
121
+ #adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before {
122
+ content: "\f452";
123
+ }
124
+
125
+ #adminmenu #toplevel_page_bp-groups .wp-menu-image:before,
126
+ #adminmenu #toplevel_page_bp-groups_user .wp-menu-image:before,
127
+ #adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before {
128
+ content: "\f456";
129
+ }
130
+
131
+ #adminmenu #toplevel_page_bp-notifications .wp-menu-image:before,
132
+ #adminmenu #toplevel_page_bp-notifications_user .wp-menu-image:before,
133
+ #adminmenu #toplevel_page_bp-notifications_network .wp-menu-image:before {
134
+ content: "\f439";
135
+ }
136
+
137
+ #adminmenu #toplevel_page_bp-messages .wp-menu-image:before,
138
+ #adminmenu #toplevel_page_bp-messages_user .wp-menu-image:before,
139
+ #adminmenu #toplevel_page_bp-messages_network .wp-menu-image:before {
140
+ content: "\f457";
141
+ }
142
+
143
+ #adminmenu #toplevel_page_bp-friends .wp-menu-image:before,
144
+ #adminmenu #toplevel_page_bp-friends_user .wp-menu-image:before,
145
+ #adminmenu #toplevel_page_bp-friends_network .wp-menu-image:before{
146
+ content: "\f454";
147
+ }
148
+
149
+ #adminmenu #toplevel_page_bp-settings .wp-menu-image:before,
150
+ #adminmenu #toplevel_page_bp-settings_user .wp-menu-image:before,
151
+ #adminmenu #toplevel_page_bp-settings_network .wp-menu-image:before {
152
+ content: "\f108";
153
+ }
154
+
155
+ #adminmenu li.toplevel_page_bp-components .wp-menu-image,
156
+ #adminmenu li.toplevel_page_bp-general-settings .wp-menu-image {
157
+ content: "\f448";
158
+ }
159
+
160
+ /* Dashicons overrides for backward compatibility */
161
+ body.branch-3-6 #adminmenu #toplevel_page_bp-activity .wp-menu-image:before,
162
+ body.branch-3-6 #adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,
163
+ body.branch-3-6 #adminmenu #toplevel_page_bp-groups .wp-menu-image:before,
164
+ body.branch-3-6 #adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,
165
+ body.branch-3-6 #adminmenu li.toplevel_page_bp-components .wp-menu-image,
166
+ body.branch-3-6 #adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,
167
+ body.branch-3-7 #adminmenu #toplevel_page_bp-activity .wp-menu-image:before,
168
+ body.branch-3-7 #adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,
169
+ body.branch-3-7 #adminmenu #toplevel_page_bp-groups .wp-menu-image:before,
170
+ body.branch-3-7 #adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,
171
+ body.branch-3-7 #adminmenu li.toplevel_page_bp-components .wp-menu-image,
172
+ body.branch-3-7 #adminmenu li.toplevel_page_bp-general-settings .wp-menu-image {
173
+ content: "";
174
+ }
175
+
176
+ /* Settings - Dashicons (WP 3.8+) */
177
  .settings_page_bp-components td.plugin-title span {
178
  float: left;
179
  width: 18px;
180
  height: 18px;
181
+ margin-right: 5px;
182
+ }
183
+
184
+ .settings_page_bp-components td.plugin-title span:before {
185
+ font-family: 'dashicons';
186
+ font-size: 18px;
187
+ }
188
+
189
+ .settings_page_bp-components tr.activity td.plugin-title span:before {
190
+ content: "\f452";
191
+ }
192
+
193
+ .settings_page_bp-components tr.notifications td.plugin-title span:before {
194
+ content: "\f339";
195
+ }
196
+
197
+ .settings_page_bp-components tr.xprofile td.plugin-title span:before {
198
+ content: "\f336";
199
+ }
200
+
201
+ .settings_page_bp-components tr.settings td.plugin-title span:before {
202
+ content: "\f108";
203
+ }
204
+
205
+ .settings_page_bp-components tr.groups td.plugin-title span:before {
206
+ content: "\f456";
207
+ }
208
+
209
+ .settings_page_bp-components tr.messages td.plugin-title span:before {
210
+ content: "\f457";
211
+ }
212
+
213
+ .settings_page_bp-components tr.forums td.plugin-title span:before {
214
+ content: "\f452";
215
+ }
216
+
217
+ .settings_page_bp-components tr.blogs td.plugin-title span:before {
218
+ content: "\f120";
219
+ }
220
+
221
+ .settings_page_bp-components tr.friends td.plugin-title span:before {
222
+ content: "\f454";
223
+ }
224
+
225
+ /* Settings - Legacy (< WP 3.8) */
226
+ body.branch-3-6.settings_page_bp-components tr.activity td.plugin-title span:before,
227
+ body.branch-3-6.settings_page_bp-components tr.notifications td.plugin-title span:before,
228
+ body.branch-3-6.settings_page_bp-components tr.xprofile td.plugin-title span:before,
229
+ body.branch-3-6.settings_page_bp-components tr.settings td.plugin-title span:before,
230
+ body.branch-3-6.settings_page_bp-components tr.groups td.plugin-title span:before,
231
+ body.branch-3-6.settings_page_bp-components tr.messages td.plugin-title span:before,
232
+ body.branch-3-6.settings_page_bp-components tr.forums td.plugin-title span:before,
233
+ body.branch-3-6.settings_page_bp-components tr.blogs td.plugin-title span:before,
234
+ body.branch-3-6.settings_page_bp-components tr.friends td.plugin-title span:before,
235
+ body.branch-3-7.settings_page_bp-components tr.activity td.plugin-title span:before,
236
+ body.branch-3-7.settings_page_bp-components tr.notifications td.plugin-title span:before,
237
+ body.branch-3-7.settings_page_bp-components tr.xprofile td.plugin-title span:before,
238
+ body.branch-3-7.settings_page_bp-components tr.settings td.plugin-title span:before,
239
+ body.branch-3-7.settings_page_bp-components tr.groups td.plugin-title span:before,
240
+ body.branch-3-7.settings_page_bp-components tr.messages td.plugin-title span:before,
241
+ body.branch-3-7.settings_page_bp-components tr.forums td.plugin-title span:before,
242
+ body.branch-3-7.settings_page_bp-components tr.blogs td.plugin-title span:before,
243
+ body.branch-3-7.settings_page_bp-components tr.friends td.plugin-title span:before {
244
+ content: "";
245
+ }
246
+
247
+ body.branch-3-6.settings_page_bp-components td.plugin-title span,
248
+ body.branch-3-7.settings_page_bp-components td.plugin-title span {
249
  background-image: url('../images/menu.png');
250
  background-position: -4px -40px;
251
  background-repeat: no-repeat;
 
252
  }
253
 
254
+ body.branch-3-6.settings_page_bp-components tr.active td.plugin-title span,
255
+ body.branch-3-7.settings_page_bp-components tr.active td.plugin-title span {
256
  background-position-y: -7px;
257
  }
258
 
259
+ body.branch-3-6.settings_page_bp-components tr.activity td.plugin-title span,
260
+ body.branch-3-7.settings_page_bp-components tr.activity td.plugin-title span {
261
+ background-position: -4px -40px;
262
+ }
263
+
264
+ body.branch-3-6.settings_page_bp-components tr.activity.active td.plugin-title span,
265
+ body.branch-3-7.settings_page_bp-components tr.activity.active td.plugin-title span {
266
+ background-position: -4px -7px;
267
  }
268
 
269
+ body.branch-3-6.settings_page_bp-components tr.xprofile td.plugin-title span,
270
+ body.branch-3-7.settings_page_bp-components tr.xprofile td.plugin-title span {
271
  background-image: url('../images/menu-wp.png');
272
+ background-position: -305px -40px;
273
+ }
274
+
275
+ body.branch-3-6.settings_page_bp-components tr.xprofile.active td.plugin-title span,
276
+ body.branch-3-7.settings_page_bp-components tr.xprofile.active td.plugin-title span {
277
+ background-position: -305px -7px;
278
  }
279
 
280
+ body.branch-3-6.settings_page_bp-components tr.settings td.plugin-title span,
281
+ body.branch-3-7.settings_page_bp-components tr.settings td.plugin-title span {
282
  background-image: url('../images/menu-wp.png');
283
+ background-position: -334px -40px;
284
  }
285
 
286
+ body.branch-3-6.settings_page_bp-components tr.settings.active td.plugin-title span,
287
+ body.branch-3-7.settings_page_bp-components tr.settings.active td.plugin-title span {
288
+ background-position: -334px -7px;
289
  }
290
 
291
+ body.branch-3-6.settings_page_bp-components tr.groups td.plugin-title span,
292
+ body.branch-3-7.settings_page_bp-components tr.groups td.plugin-title span {
293
+ background-position: -66px -40px;
294
  }
295
 
296
+ body.branch-3-6.settings_page_bp-components tr.groups.active td.plugin-title span,
297
+ body.branch-3-7.settings_page_bp-components tr.groups.active td.plugin-title span {
298
+ background-position: -66px -7px;
299
+ }
300
+
301
+ body.branch-3-6.settings_page_bp-components tr.messages td.plugin-title span,
302
+ body.branch-3-7.settings_page_bp-components tr.messages td.plugin-title span {
303
+ background-position: -154px -40px;
304
+ }
305
+
306
+ body.branch-3-6.settings_page_bp-components tr.messages.active td.plugin-title span,
307
+ body.branch-3-7.settings_page_bp-components tr.messages.active td.plugin-title span {
308
+ background-position: -154px -7px;
309
+ }
310
+
311
+ body.branch-3-6.settings_page_bp-components tr.forums td.plugin-title span,
312
+ body.branch-3-7.settings_page_bp-components tr.forums td.plugin-title span {
313
  background-image: url('../images/menu-wp.png');
314
+ background-position: -36px -40px;
315
+ }
316
+
317
+ body.branch-3-6.settings_page_bp-components tr.forums.active td.plugin-title span,
318
+ body.branch-3-7.settings_page_bp-components tr.forums.active td.plugin-title span {
319
+ background-position: -36px -7px;
320
+ }
321
+
322
+ body.branch-3-6.settings_page_bp-components tr.blogs td.plugin-title span,
323
+ body.branch-3-7.settings_page_bp-components tr.blogs td.plugin-title span {
324
+ background-position: -125px -40px;
325
+ }
326
+
327
+ body.branch-3-6.settings_page_bp-components tr.blogs.active td.plugin-title span,
328
+ body.branch-3-7.settings_page_bp-components tr.blogs.active td.plugin-title span {
329
+ background-position: -125px -7px;
330
+ }
331
+
332
+ body.branch-3-6.settings_page_bp-components tr.friends td.plugin-title span,
333
+ body.branch-3-7.settings_page_bp-components tr.friends td.plugin-title span {
334
+ background-position: -95px -40px;
335
+ }
336
+
337
+ body.branch-3-6.settings_page_bp-components tr.friends.active td.plugin-title span,
338
+ body.branch-3-7.settings_page_bp-components tr.friends.active td.plugin-title span {
339
+ background-position: -95px -7px;
340
  }
341
 
342
+ body.branch-3-6.settings_page_bp-components tr.core td.plugin-title span,
343
+ body.branch-3-7.settings_page_bp-components tr.core td.plugin-title span {
344
+ background-position: -184px -40px;
345
  }
346
 
347
+ body.branch-3-6.settings_page_bp-components tr.core.active td.plugin-title span,
348
+ body.branch-3-7.settings_page_bp-components tr.core.active td.plugin-title span {
349
+ background-position: -184px -7px;
350
  }
351
 
352
+ body.branch-3-6.settings_page_bp-components tr.members td.plugin-title span,
353
+ body.branch-3-7.settings_page_bp-components tr.members td.plugin-title span {
354
+ background-position: -36px -40px;
355
  }
356
 
357
+ body.branch-3-6.settings_page_bp-components tr.members.active td.plugin-title span,
358
+ body.branch-3-7.settings_page_bp-components tr.members.active td.plugin-title span {
359
+ background-position: -36px -7px;
360
  }
361
 
362
  #bp-admin-component-form .widefat th {
394
  @media only screen and (-webkit-min-device-pixel-ratio: 1.5) {
395
 
396
  /* Icon 32 */
397
+ body.branch-3-6 div#icon-buddypress,
398
+ body.branch-3-6 div#icon-buddypress-activity,
399
+ body.branch-3-6 div#icon-buddypress-groups,
400
+ body.branch-3-7 div#icon-buddypress,
401
+ body.branch-3-7 div#icon-buddypress-activity,
402
+ body.branch-3-7 div#icon-buddypress-groups {
403
  background-image: url('../images/icons64.png');
404
  background-size: 419px 45px;
405
  }
406
 
407
  /* Backpat */
408
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,
409
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,
410
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,
411
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image,
412
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,
413
+ body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image,
414
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,
415
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,
416
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,
417
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image,
418
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,
419
+ body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image {
420
  background-image: url('../images/menu-2x.png') !important;
421
  background-size: 209px 64px;
422
  }
bp-core/admin/css/common.min.css CHANGED
@@ -1 +1 @@
1
- div#icon-buddypress{background:url('../images/icons32.png') no-repeat -370px -6px}div#icon-buddypress-activity{background:url('../images/icons32.png') no-repeat -10px -6px}div#icon-buddypress-groups{background:url('../images/icons32.png') no-repeat -250px -6px}ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{background-image:url('../images/menu.png')!important;background-position:-178px -34px}ul#adminmenu li.toplevel_page_bp-components:hover .wp-menu-image,ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image,ul#adminmenu li.toplevel_page_bp-components.wp-has-current-submenu .wp-menu-image,ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image{background-position:-178px -2px}ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image{background-image:url('../images/menu.png');background-position:0 -34px}ul#adminmenu li.toplevel_page_bp-activity:hover .wp-menu-image,ul#adminmenu li.toplevel_page_bp-activity.current .wp-menu-image,ul#adminmenu li.toplevel_page_bp-activity.wp-has-current-submenu .wp-menu-image,ul#adminmenu li.toplevel_page_bp-activity_network:hover .wp-menu-image,ul#adminmenu li.toplevel_page_bp-activity_network.current .wp-menu-image,ul#adminmenu li.toplevel_page_bp-activity_network.wp-has-current-submenu .wp-menu-image{background-position:0 -2px}ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image{background-image:url('../images/menu.png');background-position:-61px -34px}ul#adminmenu li.toplevel_page_bp-groups:hover .wp-menu-image,ul#adminmenu li.toplevel_page_bp-groups.current .wp-menu-image,ul#adminmenu li.toplevel_page_bp-groups.wp-has-current-submenu .wp-menu-image,ul#adminmenu li.toplevel_page_bp-groups_network:hover .wp-menu-image,ul#adminmenu li.toplevel_page_bp-groups_network.current .wp-menu-image,ul#adminmenu li.toplevel_page_bp-groups_network.wp-has-current-submenu .wp-menu-image{background-position:-61px -2px}th.column-gid{width:60px}td.column-gid{vertical-align:middle}table.bp-group-members th,table.bp-group-members td{padding:5px 0}table.bp-group-members .uid-column{padding-left:20px;padding-right:20px}table.bp-group-members .uname-column{width:70%}table.bp-group-members .urole-column{padding-left:20px;padding-right:20px}.dashboard_page_bp-wizard td.plugin-title span,.settings_page_bp-components td.plugin-title span{float:left;width:18px;height:18px;background-image:url('../images/menu.png');background-position:-4px -40px;background-repeat:no-repeat;margin-right:5px}.dashboard_page_bp-wizard tr.active td.plugin-title span,.settings_page_bp-components tr.active td.plugin-title span{background-position-y:-7px}.dashboard_page_bp-wizard tr.activity td.plugin-title span,.settings_page_bp-components tr.activity td.plugin-title span{background-position-x:-4px}.dashboard_page_bp-wizard tr.xprofile td.plugin-title span,.settings_page_bp-components tr.xprofile td.plugin-title span{background-image:url('../images/menu-wp.png');background-position-x:-305px}.dashboard_page_bp-wizard tr.settings td.plugin-title span,.settings_page_bp-components tr.settings td.plugin-title span{background-image:url('../images/menu-wp.png');background-position-x:-334px}.dashboard_page_bp-wizard tr.groups td.plugin-title span,.settings_page_bp-components tr.groups td.plugin-title span{background-position-x:-66px}.dashboard_page_bp-wizard tr.messages td.plugin-title span,.settings_page_bp-components tr.messages td.plugin-title span{background-position-x:-154px}.dashboard_page_bp-wizard tr.forums td.plugin-title span,.settings_page_bp-components tr.forums td.plugin-title span{background-image:url('../images/menu-wp.png');background-position-x:-36px}.dashboard_page_bp-wizard tr.blogs td.plugin-title span,.settings_page_bp-components tr.blogs td.plugin-title span{background-position-x:-125px}.dashboard_page_bp-wizard tr.friends td.plugin-title span,.settings_page_bp-components tr.friends td.plugin-title span{background-position-x:-95px}.dashboard_page_bp-wizard tr.core td.plugin-title span,.settings_page_bp-components tr.core td.plugin-title span{background-position-x:-184px}.dashboard_page_bp-wizard tr.members td.plugin-title span,.settings_page_bp-components tr.members td.plugin-title span{background-position-x:-36px}#bp-admin-component-form .widefat th{display:table-cell;vertical-align:top}.bp-badge{padding-top:142px;height:50px;width:173px;color:#fafafa;font-weight:bold;font-size:14px;text-align:center;margin:0 -5px;background:url('../images/badge.png') no-repeat}.about-wrap .bp-badge{position:absolute;top:0;right:0}body.rtl .about-wrap .bp-badge{right:auto;left:0}@media only screen and (-webkit-min-device-pixel-ratio:1.5){div#icon-buddypress,div#icon-buddypress-activity,div#icon-buddypress-groups{background-image:url('../images/icons64.png');background-size:419px 45px}ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image,ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image{background-image:url('../images/menu-2x.png')!important;background-size:209px 64px}.bp-badge{background-image:url('../images/badge-2x.png');background-size:173px 194px}}
1
+ body.branch-3-6 div#icon-buddypress,body.branch-3-7 div#icon-buddypress{background:url('../images/icons32.png') no-repeat -370px -6px}body.branch-3-6 div#icon-buddypress-activity,body.branch-3-7 div#icon-buddypress-activity{background:url('../images/icons32.png') no-repeat -10px -6px}body.branch-3-6 div#icon-buddypress-groups,body.branch-3-7 div#icon-buddypress-groups{background:url('../images/icons32.png') no-repeat -250px -6px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{background-image:url('../images/menu.png') !important;background-position:-178px -34px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components:hover .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image{background-position:-178px -2px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image{background-image:url('../images/menu.png');background-position:0 -34px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity:hover .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity.current .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network:hover .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network.current .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity.current .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network.current .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network.wp-has-current-submenu .wp-menu-image{background-position:0 -2px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image{background-image:url('../images/menu.png');background-position:-61px -34px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups:hover .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups.current .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network:hover .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network.current .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups.current .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network.current .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network.wp-has-current-submenu .wp-menu-image{background-position:-61px -2px}th.column-gid{width:60px}td.column-gid{vertical-align:middle}table.bp-group-members th,table.bp-group-members td{padding:5px 0}table.bp-group-members .uid-column{padding-left:20px;padding-right:20px}table.bp-group-members .uname-column{width:70%}table.bp-group-members .urole-column{padding-left:20px;padding-right:20px}#adminmenu #toplevel_page_bp-activity .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_user .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before{content:"\f452"}#adminmenu #toplevel_page_bp-groups .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_user .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before{content:"\f456"}#adminmenu #toplevel_page_bp-notifications .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_user .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_network .wp-menu-image:before{content:"\f439"}#adminmenu #toplevel_page_bp-messages .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_user .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_network .wp-menu-image:before{content:"\f457"}#adminmenu #toplevel_page_bp-friends .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_user .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_network .wp-menu-image:before{content:"\f454"}#adminmenu #toplevel_page_bp-settings .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_user .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_network .wp-menu-image:before{content:"\f108"}#adminmenu li.toplevel_page_bp-components .wp-menu-image,#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{content:"\f448"}body.branch-3-6 #adminmenu #toplevel_page_bp-activity .wp-menu-image:before,body.branch-3-6 #adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,body.branch-3-6 #adminmenu #toplevel_page_bp-groups .wp-menu-image:before,body.branch-3-6 #adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,body.branch-3-6 #adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-6 #adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,body.branch-3-7 #adminmenu #toplevel_page_bp-activity .wp-menu-image:before,body.branch-3-7 #adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,body.branch-3-7 #adminmenu #toplevel_page_bp-groups .wp-menu-image:before,body.branch-3-7 #adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,body.branch-3-7 #adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-7 #adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{content:""}.settings_page_bp-components td.plugin-title span{float:left;width:18px;height:18px;margin-right:5px}.settings_page_bp-components td.plugin-title span:before{font-family:'dashicons';font-size:18px}.settings_page_bp-components tr.activity td.plugin-title span:before{content:"\f452"}.settings_page_bp-components tr.notifications td.plugin-title span:before{content:"\f339"}.settings_page_bp-components tr.xprofile td.plugin-title span:before{content:"\f336"}.settings_page_bp-components tr.settings td.plugin-title span:before{content:"\f108"}.settings_page_bp-components tr.groups td.plugin-title span:before{content:"\f456"}.settings_page_bp-components tr.messages td.plugin-title span:before{content:"\f457"}.settings_page_bp-components tr.forums td.plugin-title span:before{content:"\f452"}.settings_page_bp-components tr.blogs td.plugin-title span:before{content:"\f120"}.settings_page_bp-components tr.friends td.plugin-title span:before{content:"\f454"}body.branch-3-6.settings_page_bp-components tr.activity td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.notifications td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.xprofile td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.settings td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.groups td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.messages td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.forums td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.blogs td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.friends td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.activity td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.notifications td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.xprofile td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.settings td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.groups td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.messages td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.forums td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.blogs td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.friends td.plugin-title span:before{content:""}body.branch-3-6.settings_page_bp-components td.plugin-title span,body.branch-3-7.settings_page_bp-components td.plugin-title span{background-image:url('../images/menu.png');background-position:-4px -40px;background-repeat:no-repeat}body.branch-3-6.settings_page_bp-components tr.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.active td.plugin-title span{background-position-y:-7px}body.branch-3-6.settings_page_bp-components tr.activity td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.activity td.plugin-title span{background-position:-4px -40px}body.branch-3-6.settings_page_bp-components tr.activity.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.activity.active td.plugin-title span{background-position:-4px -7px}body.branch-3-6.settings_page_bp-components tr.xprofile td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.xprofile td.plugin-title span{background-image:url('../images/menu-wp.png');background-position:-305px -40px}body.branch-3-6.settings_page_bp-components tr.xprofile.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.xprofile.active td.plugin-title span{background-position:-305px -7px}body.branch-3-6.settings_page_bp-components tr.settings td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.settings td.plugin-title span{background-image:url('../images/menu-wp.png');background-position:-334px -40px}body.branch-3-6.settings_page_bp-components tr.settings.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.settings.active td.plugin-title span{background-position:-334px -7px}body.branch-3-6.settings_page_bp-components tr.groups td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.groups td.plugin-title span{background-position:-66px -40px}body.branch-3-6.settings_page_bp-components tr.groups.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.groups.active td.plugin-title span{background-position:-66px -7px}body.branch-3-6.settings_page_bp-components tr.messages td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.messages td.plugin-title span{background-position:-154px -40px}body.branch-3-6.settings_page_bp-components tr.messages.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.messages.active td.plugin-title span{background-position:-154px -7px}body.branch-3-6.settings_page_bp-components tr.forums td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.forums td.plugin-title span{background-image:url('../images/menu-wp.png');background-position:-36px -40px}body.branch-3-6.settings_page_bp-components tr.forums.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.forums.active td.plugin-title span{background-position:-36px -7px}body.branch-3-6.settings_page_bp-components tr.blogs td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.blogs td.plugin-title span{background-position:-125px -40px}body.branch-3-6.settings_page_bp-components tr.blogs.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.blogs.active td.plugin-title span{background-position:-125px -7px}body.branch-3-6.settings_page_bp-components tr.friends td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.friends td.plugin-title span{background-position:-95px -40px}body.branch-3-6.settings_page_bp-components tr.friends.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.friends.active td.plugin-title span{background-position:-95px -7px}body.branch-3-6.settings_page_bp-components tr.core td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.core td.plugin-title span{background-position:-184px -40px}body.branch-3-6.settings_page_bp-components tr.core.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.core.active td.plugin-title span{background-position:-184px -7px}body.branch-3-6.settings_page_bp-components tr.members td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.members td.plugin-title span{background-position:-36px -40px}body.branch-3-6.settings_page_bp-components tr.members.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.members.active td.plugin-title span{background-position:-36px -7px}#bp-admin-component-form .widefat th{display:table-cell;vertical-align:top}.bp-badge{padding-top:142px;height:50px;width:173px;color:#fafafa;font-weight:bold;font-size:14px;text-align:center;margin:0 -5px;background:url('../images/badge.png') no-repeat}.about-wrap .bp-badge{position:absolute;top:0;right:0}body.rtl .about-wrap .bp-badge{right:auto;left:0}@media only screen and (-webkit-min-device-pixel-ratio:1.5){body.branch-3-6 div#icon-buddypress,body.branch-3-6 div#icon-buddypress-activity,body.branch-3-6 div#icon-buddypress-groups,body.branch-3-7 div#icon-buddypress,body.branch-3-7 div#icon-buddypress-activity,body.branch-3-7 div#icon-buddypress-groups{background-image:url('../images/icons64.png');background-size:419px 45px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image{background-image:url('../images/menu-2x.png') !important;background-size:209px 64px}.bp-badge{background-image:url('../images/badge-2x.png');background-size:173px 194px}}
bp-core/bp-core-admin.php CHANGED
@@ -150,6 +150,9 @@ class BP_Admin {
150
  // Add settings
151
  add_action( 'bp_register_admin_settings', array( $this, 'register_admin_settings' ) );
152
 
 
 
 
153
  /** Filters ***********************************************************/
154
 
155
  // Add link to settings page
@@ -334,6 +337,24 @@ class BP_Admin {
334
  }
335
  }
336
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
337
  /**
338
  * Add Settings link to plugins area.
339
  *
@@ -406,11 +427,22 @@ class BP_Admin {
406
  <h1><?php printf( __( 'Welcome to BuddyPress %s', 'buddypress' ), $display_version ); ?></h1>
407
  <div class="about-text">
408
  <?php if ( $is_new_install ) : ?>
409
- <?php printf( __( 'BuddyPress %s is our safest, fastest, most flexible version ever.', 'buddypress' ), $display_version ); ?>
410
  <?php else : ?>
411
- <?php printf( __( 'Thank you for updating! BuddyPress %s is our safest, fastest, most flexible version ever.', 'buddypress' ), $display_version ); ?>
412
  <?php endif; ?>
413
  </div>
 
 
 
 
 
 
 
 
 
 
 
414
  <div class="bp-badge"><?php printf( __( 'Version %s', 'buddypress' ), $display_version ); ?></div>
415
 
416
  <h2 class="nav-tab-wrapper">
@@ -450,62 +482,57 @@ class BP_Admin {
450
 
451
  <?php endif; ?>
452
 
 
453
  <div class="changelog">
454
- <h3><?php _e( 'Improved Theme Integration', 'buddypress' ); ?></h3>
455
 
456
  <div class="feature-section">
457
- <h4><?php _e( 'Hey, Good Lookin&#8217;', 'buddypress' ); ?></h4>
458
- <p><?php _e( 'We&#8217;ve streamlined our stylesheets, so that BuddyPress content looks more at home in your theme. And theme developers will love BP&#8217;s new hierarchies that make it easy to override specific top-level templates, stylesheets, and JavaScript files.', 'buddypress' ) ?></p>
459
  </div>
460
  </div>
461
 
 
462
  <div class="changelog">
463
- <h3><?php _e( 'Better Group Member Management', 'buddypress' ); ?></h3>
464
 
465
  <div class="feature-section">
466
- <h4><?php _e( '<em>Add</em>, <em>Remove</em>, and More, in a Snap', 'buddypress' ); ?></h4>
467
-
468
- <?php
469
- $group_admin_text = __( 'Groups administration panel', 'buddypress' );
470
- if ( bp_is_active( 'groups' ) ) {
471
- $group_admin_text = '<a href="' . bp_get_admin_url( add_query_arg( array( 'page' => 'bp-groups' ), 'admin.php' ) ) . '">' . $group_admin_text . '</a>';
472
- }
473
- ?>
474
-
475
- <p><?php printf(
476
- __( 'The Manage Members section of the %s has been rewritten, to make it easier to handle groups with many members. We&#8217;ve also made the interface nicer to use, to ensure that you don&#8217;t make changes and then forget to save them.', 'buddypress' ),
477
- $group_admin_text
478
- ); ?></p>
479
  </div>
480
  </div>
481
 
 
482
  <div class="changelog">
483
- <h3><?php _e( 'Under the Hood', 'buddypress' ); ?></h3>
484
 
485
- <div class="feature-section three-col">
486
- <div>
487
- <h4><?php _e( 'Superpowered Group Extensions', 'buddypress' ); ?></h4>
488
- <p><?php _e( '<code>BP_Group_Extension</code> has been overhauled, making it easier than ever before to add custom functionality to groups.', 'buddypress' ); ?></p>
 
 
 
 
489
 
490
- <h4><?php _e( 'Filter Groups or Activity by Metadata', 'buddypress' ); ?></h4>
491
- <p><?php _e( '<code>bp_has_groups()</code> and <code>bp_has_activities()</code> now accept a <code>meta_query</code> paramater, for more powerful directory queries.', 'buddypress' ); ?></p>
492
- </div>
493
 
494
- <div>
495
- <h4><?php _e( 'Feed Me, Seymour', 'buddypress' ); ?></h4>
496
- <p><?php _e( 'The new <code>BP_Activity_Feed</code> class centralizes BP&#8217;s RSS logic, making our feeds more standards-compliant, and giving developers more tools for building custom feeds.', 'buddypress' ); ?></p>
 
 
 
 
 
497
 
498
- <h4><?php _e( 'Disable @-Mentions', 'buddypress' ); ?></h4>
499
- <p><?php _e( "Not using @-mentions? Disable them with <code>add_filter( 'bp_activity_do_mentions', '__return_false' );</code>", 'buddypress' ); ?></p>
500
- </div>
501
- </div>
502
 
503
- <div class="return-to-dashboard">
504
- <a href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), $this->settings_page ) ) ); ?>"><?php _e( 'Go to the BuddyPress Settings page', 'buddypress' ); ?></a>
505
  </div>
506
 
507
- </div>
508
-
509
  <?php
510
  }
511
 
@@ -523,7 +550,7 @@ class BP_Admin {
523
 
524
  <div class="wrap about-wrap">
525
  <h1><?php printf( __( 'Welcome to BuddyPress %s', 'buddypress' ), $display_version ); ?></h1>
526
- <div class="about-text"><?php printf( __( 'Thank you for updating to the latest version! BuddyPress %s is ready to make your community a safer, faster, and better looking place to hang out!', 'buddypress' ), $display_version ); ?></div>
527
  <div class="bp-badge"><?php printf( __( 'Version %s', 'buddypress' ), $display_version ); ?></div>
528
 
529
  <h2 class="nav-tab-wrapper">
@@ -598,11 +625,14 @@ class BP_Admin {
598
  <a href="http://profiles.wordpress.org/ddean/">ddean</a>,
599
  <a href="http://profiles.wordpress.org/DennisSmolek/">DennisSmolek</a>,
600
  <a href="http://profiles.wordpress.org/dimensionmedia/">dimensionmedia</a>,
 
601
  <a href="http://profiles.wordpress.org/dtc7240/">dtc7240</a>,
602
  <a href="http://profiles.wordpress.org/ericlewis/">ericlewis</a>,
603
  <a href="http://profiles.wordpress.org/gametako/">gametako</a>,
604
  <a href="http://profiles.wordpress.org/geoffroycochard/">geoffroycochard</a>,
 
605
  <a href="http://profiles.wordpress.org/hanni/">hanni</a>,
 
606
  <a href="http://profiles.wordpress.org/henrywright/">henrywright</a>,
607
  <a href="http://profiles.wordpress.org/hnla/">hnla</a>,
608
  <a href="http://profiles.wordpress.org/imath/">imath</a>,
150
  // Add settings
151
  add_action( 'bp_register_admin_settings', array( $this, 'register_admin_settings' ) );
152
 
153
+ // Add a link to BuddyPress About page to the admin bar
154
+ add_action( 'admin_bar_menu', array( $this, 'admin_bar_about_link' ), 15 );
155
+
156
  /** Filters ***********************************************************/
157
 
158
  // Add link to settings page
337
  }
338
  }
339
 
340
+ /**
341
+ * Add a link to BuddyPress About page to the admin bar.
342
+ *
343
+ * @since BuddyPress (1.9.0)
344
+ *
345
+ * @param WP_Admin_Bar $wp_admin_bar As passed to 'admin_bar_menu'.
346
+ */
347
+ public function admin_bar_about_link( $wp_admin_bar ) {
348
+ if ( is_user_logged_in() ) {
349
+ $wp_admin_bar->add_menu( array(
350
+ 'parent' => 'wp-logo',
351
+ 'id' => 'bp-about',
352
+ 'title' => esc_html__( 'About BuddyPress', 'buddypress' ),
353
+ 'href' => add_query_arg( array( 'page' => 'bp-about' ), bp_get_admin_url( 'index.php' ) ),
354
+ ) );
355
+ }
356
+ }
357
+
358
  /**
359
  * Add Settings link to plugins area.
360
  *
427
  <h1><?php printf( __( 'Welcome to BuddyPress %s', 'buddypress' ), $display_version ); ?></h1>
428
  <div class="about-text">
429
  <?php if ( $is_new_install ) : ?>
430
+ <?php printf( __( 'It&#8217;s a great time to use BuddyPress! %s is our first version with a new component in over two years. Not only that, there are plenty of new features, enhancements, and bug fixes.', 'buddypress' ), $display_version ); ?>
431
  <?php else : ?>
432
+ <?php printf( __( 'Thanks for updating! BuddyPress %s is our first version with a new component in over two years. Not only that, there are plenty of new features, enhancements, and bug fixes.', 'buddypress' ), $display_version ); ?>
433
  <?php endif; ?>
434
  </div>
435
+
436
+ <div class="changelog">
437
+ <h3><?php _e( 'Check out the highlights:', 'buddypress' ); ?></h3>
438
+
439
+ <ul>
440
+ <li><strong><?php _e( 'You can now add dynamic BuddyPress links to custom navigation menus.', 'buddypress' ); ?></strong></li>
441
+ <li><strong><?php _e( 'Notifications have been moved into their own component.', 'buddypress' ); ?></strong></li>
442
+ <li><strong><?php _e( 'Three new widgets, allowing easier site customization.', 'buddypress' ); ?></strong></li>
443
+ <ul>
444
+ </div>
445
+
446
  <div class="bp-badge"><?php printf( __( 'Version %s', 'buddypress' ), $display_version ); ?></div>
447
 
448
  <h2 class="nav-tab-wrapper">
482
 
483
  <?php endif; ?>
484
 
485
+ <hr />
486
  <div class="changelog">
487
+ <h3><?php _e( 'Dynamic links for custom navigation menus', 'buddypress' ); ?></h3>
488
 
489
  <div class="feature-section">
490
+ <p><?php printf( __( 'It&#8217;s now easy to add BuddyPress-specific links to your menus through <a href="%s">Appearance &gt; Menus</a>. For example, you can now add a link to a specific user profile screen, and each person will end up at that screen inside their own user profile.', 'buddypress' ), admin_url( 'nav-menus.php' ) ); ?></p>
 
491
  </div>
492
  </div>
493
 
494
+ <hr />
495
  <div class="changelog">
496
+ <h3><?php _e( 'Notifications component', 'buddypress' ); ?></h3>
497
 
498
  <div class="feature-section">
499
+ <p><?php _e( 'The notification features have been promoted into a new component. Use it to keep your site&#8217;s members abreast of the latest connections and @mentions within the site, via email notifications and Toolbar alerts.', 'buddypress' ); ?></p>
500
+
 
 
 
 
 
 
 
 
 
 
 
501
  </div>
502
  </div>
503
 
504
+ <hr />
505
  <div class="changelog">
506
+ <h3><?php _e( 'Widgets', 'buddypress' ); ?></h3>
507
 
508
+ <div class="feature-section">
509
+ <ul>
510
+ <li><?php _e( '<strong>Friends Widget</strong>: a list of recently active, popular, and newest friends of the displayed member.', 'buddypress' ); ?></li>
511
+ <li><?php _e( '<strong>Log In Widget</strong>: adds a simple &ldquo;Log In&rdquo; form to your site.', 'buddypress' ); ?></li>
512
+ <li><?php _e( '<strong>Sitewide Notices Widget</strong>: display Sitewide Notices from the Private Messaging component.', 'buddypress' ); ?></li>
513
+ </ul>
514
+ </div>
515
+ </div>
516
 
517
+ <hr />
518
+ <div class="changelog">
519
+ <h3><?php _e( 'Developer changes', 'buddypress' ); ?></h3>
520
 
521
+ <div class="feature-section">
522
+ <ul>
523
+ <li><?php _e( '<code>bp_redirect_canonical()</code> functionality has been reinstated', 'buddypress' ); ?></li>
524
+ <li><?php _e( 'Improved phpDoc inline documentation', 'buddypress' ); ?></li>
525
+ <li><?php printf( __( 'Improved compatibility with <a href="%s">develop.svn.wordpress.org</a> unit-test suite', 'buddypress' ), 'https://develop.svn.wordpress.org/' ); ?></li>
526
+ <li><?php printf( __( '<a href="%s">&hellip;and lots more!</a>' ), 'http://codex.buddypress.org/releases/version-1-9' ); ?></li>
527
+ </ul>
528
+ </div>
529
 
530
+ <div class="return-to-dashboard">
531
+ <a href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), $this->settings_page ) ) ); ?>"><?php _e( 'Go to the BuddyPress Settings page', 'buddypress' ); ?></a>
532
+ </div>
 
533
 
 
 
534
  </div>
535
 
 
 
536
  <?php
537
  }
538
 
550
 
551
  <div class="wrap about-wrap">
552
  <h1><?php printf( __( 'Welcome to BuddyPress %s', 'buddypress' ), $display_version ); ?></h1>
553
+ <div class="about-text"><?php printf( __( 'BuddyPress %s is our first version with a new component in over two years. Not only that, there are plenty of new features, enhancements, and bug fixes.', 'buddypress' ), $display_version ); ?></div>
554
  <div class="bp-badge"><?php printf( __( 'Version %s', 'buddypress' ), $display_version ); ?></div>
555
 
556
  <h2 class="nav-tab-wrapper">
625
  <a href="http://profiles.wordpress.org/ddean/">ddean</a>,
626
  <a href="http://profiles.wordpress.org/DennisSmolek/">DennisSmolek</a>,
627
  <a href="http://profiles.wordpress.org/dimensionmedia/">dimensionmedia</a>,
628
+ <a href="http://profiles.wordpress.org/djpaul/">DJPaul</a>,
629
  <a href="http://profiles.wordpress.org/dtc7240/">dtc7240</a>,
630
  <a href="http://profiles.wordpress.org/ericlewis/">ericlewis</a>,
631
  <a href="http://profiles.wordpress.org/gametako/">gametako</a>,
632
  <a href="http://profiles.wordpress.org/geoffroycochard/">geoffroycochard</a>,
633
+ <a href="http://profiles.wordpress.org/graham-washbrook/">graham-washbrook</a>,
634
  <a href="http://profiles.wordpress.org/hanni/">hanni</a>,
635
+ <a href="http://profiles.wordpress.org/haykayltduk/">haykayltduk</a>,
636
  <a href="http://profiles.wordpress.org/henrywright/">henrywright</a>,
637
  <a href="http://profiles.wordpress.org/hnla/">hnla</a>,
638
  <a href="http://profiles.wordpress.org/imath/">imath</a>,
bp-core/bp-core-classes.php CHANGED
@@ -460,6 +460,14 @@ class BP_User_Query {
460
 
461
  ), $this ) );
462
 
 
 
 
 
 
 
 
 
463
  // Reindex for easier matching
464
  $r = array();
465
  foreach ( $wp_user_query->results as $u ) {
460
 
461
  ), $this ) );
462
 
463
+ // We calculate total_users using a standalone query, except
464
+ // when a whitelist of user_ids is passed to the constructor.
465
+ // This clause covers the latter situation, and ensures that
466
+ // pagination works when querying by $user_ids.
467
+ if ( empty( $this->total_users ) ) {
468
+ $this->total_users = count( $wp_user_query->results );
469
+ }
470
+
471
  // Reindex for easier matching
472
  $r = array();
473
  foreach ( $wp_user_query->results as $u ) {
bp-core/bp-core-functions.php CHANGED
@@ -476,22 +476,27 @@ function bp_core_component_slug_from_root_slug( $root_slug ) {
476
  * WordPress pages and this function is now a convenience for compatibility
477
  * with the new method.
478
  *
479
- * @global $bp BuddyPress global settings.
480
- *
481
  * @param string $slug The slug of the component being added to the root list.
482
  */
483
  function bp_core_add_root_component( $slug ) {
484
- global $bp;
485
 
486
- if ( empty( $bp->pages ) )
487
  $bp->pages = bp_core_get_directory_pages();
 
488
 
489
  $match = false;
490
 
491
  // Check if the slug is registered in the $bp->pages global
492
  foreach ( (array) $bp->pages as $key => $page ) {
493
- if ( $key == $slug || $page->slug == $slug )
494
  $match = true;
 
 
 
 
 
 
495
  }
496
 
497
  // If there was no match, add a page for this root component
476
  * WordPress pages and this function is now a convenience for compatibility
477
  * with the new method.
478
  *
 
 
479
  * @param string $slug The slug of the component being added to the root list.
480
  */
481
  function bp_core_add_root_component( $slug ) {
482
+ $bp = buddypress();
483
 
484
+ if ( empty( $bp->pages ) ) {
485
  $bp->pages = bp_core_get_directory_pages();
486
+ }
487
 
488
  $match = false;
489
 
490
  // Check if the slug is registered in the $bp->pages global
491
  foreach ( (array) $bp->pages as $key => $page ) {
492
+ if ( $key == $slug || $page->slug == $slug ) {
493
  $match = true;
494
+ }
495
+ }
496
+
497
+ // Maybe create the add_root array
498
+ if ( empty( $bp->add_root ) ) {
499
+ $bp->add_root = array();
500
  }
501
 
502
  // If there was no match, add a page for this root component
bp-core/bp-core-template.php CHANGED
@@ -2365,6 +2365,12 @@ function bp_the_body_class() {
2365
  if ( in_array( 'custom-background', (array) $wp_classes ) )
2366
  $bp_classes[] = 'custom-background';
2367
 
 
 
 
 
 
 
2368
  // Preserve any custom classes already set
2369
  if ( !empty( $custom_classes ) ) {
2370
  $wp_classes = (array) $custom_classes;
2365
  if ( in_array( 'custom-background', (array) $wp_classes ) )
2366
  $bp_classes[] = 'custom-background';
2367
 
2368
+ // Observe WP admin bar body classes
2369
+ if ( in_array( 'admin-bar', (array) $wp_classes ) )
2370
+ $bp_classes[] = 'admin-bar';
2371
+ if ( in_array( 'no-customize-support', (array) $wp_classes ) )
2372
+ $bp_classes[] = 'no-customize-support';
2373
+
2374
  // Preserve any custom classes already set
2375
  if ( !empty( $custom_classes ) ) {
2376
  $wp_classes = (array) $custom_classes;
bp-core/bp-core-theme-compatibility.php CHANGED
@@ -249,7 +249,7 @@ function bp_use_theme_compat_with_current_theme() {
249
  bp_detect_theme_compat_with_current_theme();
250
  }
251
 
252
- return buddypress()->theme_compat->use_with_current_theme;
253
  }
254
 
255
  /**
249
  bp_detect_theme_compat_with_current_theme();
250
  }
251
 
252
+ return apply_filters( 'bp_use_theme_compat_with_current_theme', buddypress()->theme_compat->use_with_current_theme );
253
  }
254
 
255
  /**
bp-friends/bp-friends-functions.php CHANGED
@@ -159,7 +159,13 @@ function friends_withdraw_friendship( $initiator_userid, $friend_userid ) {
159
  $friendship = new BP_Friends_Friendship( $friendship_id, true, false );
160
 
161
  if ( empty( $friendship->is_confirmed ) && BP_Friends_Friendship::withdraw( $friendship_id ) ) {
 
 
162
  do_action_ref_array( 'friends_friendship_whithdrawn', array( $friendship_id, &$friendship ) );
 
 
 
 
163
  return true;
164
  }
165
 
159
  $friendship = new BP_Friends_Friendship( $friendship_id, true, false );
160
 
161
  if ( empty( $friendship->is_confirmed ) && BP_Friends_Friendship::withdraw( $friendship_id ) ) {
162
+
163
+ // @deprecated Since 1.9
164
  do_action_ref_array( 'friends_friendship_whithdrawn', array( $friendship_id, &$friendship ) );
165
+
166
+ // @since 1.9
167
+ do_action_ref_array( 'friends_friendship_withdrawn', array( $friendship_id, &$friendship ) );
168
+
169
  return true;
170
  }
171
 
bp-friends/bp-friends-widgets.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package BuddyPress
6
  * @subpackage Friends
7
- * @since 1.9.0
8
  */
9
 
10
  // Exit if accessed directly
@@ -187,7 +187,7 @@ class BP_Core_Friends_Widget extends WP_Widget {
187
  }
188
  }
189
 
190
- /** Widget AJAX ******************/
191
 
192
  /**
193
  * Process AJAX pagination or filtering for the Friends widget.
@@ -248,4 +248,3 @@ function bp_core_ajax_widget_friends() {
248
  }
249
  add_action( 'wp_ajax_widget_friends', 'bp_core_ajax_widget_friends' );
250
  add_action( 'wp_ajax_nopriv_widget_friends', 'bp_core_ajax_widget_friends' );
251
-
4
  *
5
  * @package BuddyPress
6
  * @subpackage Friends
7
+ * @since BuddyPress (1.9.0)
8
  */
9
 
10
  // Exit if accessed directly
187
  }
188
  }
189
 
190
+ /** Widget AJAX ***************************************************************/
191
 
192
  /**
193
  * Process AJAX pagination or filtering for the Friends widget.
248
  }
249
  add_action( 'wp_ajax_widget_friends', 'bp_core_ajax_widget_friends' );
250
  add_action( 'wp_ajax_nopriv_widget_friends', 'bp_core_ajax_widget_friends' );
 
bp-groups/bp-groups-buddybar.php CHANGED
@@ -11,9 +11,10 @@
11
  if ( !defined( 'ABSPATH' ) ) exit;
12
 
13
  /**
14
- * Adds menu items to the BuddyBar
 
 
15
  *
16
- * @since BuddyPress (1.0)
17
  * @global BuddyPress $bp
18
  */
19
  function bp_groups_adminbar_admin_menu() {
11
  if ( !defined( 'ABSPATH' ) ) exit;
12
 
13
  /**
14
+ * Add menu items to the BuddyBar.
15
+ *
16
+ * @since BuddyPress (1.0.0)
17
  *
 
18
  * @global BuddyPress $bp
19
  */
20
  function bp_groups_adminbar_admin_menu() {
bp-groups/bp-groups-cache.php CHANGED
@@ -14,17 +14,18 @@
14
  if ( !defined( 'ABSPATH' ) ) exit;
15
 
16
  /**
17
- * Slurps up groupmeta
18
  *
19
  * This function is called in two places in the BP_Groups_Group class:
20
  * - in the populate() method, when single group objects are populated
21
  * - in the get() method, when multiple groups are queried
22
  *
23
- * It grabs all groupmeta associated with all of the groups passed in $group_ids and adds it to
24
- * the WP cache. This improves efficiency when using groupmeta inline
 
25
  *
26
- * @param int|str|array $group_ids Accepts a single group_id, or a comma-separated list or array of
27
- * group ids
28
  */
29
  function bp_groups_update_meta_cache( $group_ids = false ) {
30
  global $bp;
@@ -40,6 +41,11 @@ function bp_groups_update_meta_cache( $group_ids = false ) {
40
  bp_update_meta_cache( $cache_args );
41
  }
42
 
 
 
 
 
 
43
  function groups_clear_group_object_cache( $group_id ) {
44
  wp_cache_delete( 'bp_total_group_count', 'bp' );
45
  }
@@ -50,10 +56,11 @@ add_action( 'groups_group_avatar_updated', 'groups_clear_group_object_cach
50
  add_action( 'groups_create_group_step_complete', 'groups_clear_group_object_cache' );
51
 
52
  /**
53
- * Bust group caches when editing or deleting
54
  *
55
- * @since BuddyPress (1.7)
56
- * @param int $group_id The group being edited
 
57
  */
58
  function bp_groups_delete_group_cache( $group_id = 0 ) {
59
  wp_cache_delete( 'bp_groups_group_' . $group_id . '_load_users', 'bp' );
@@ -65,11 +72,12 @@ add_action( 'groups_details_updated', 'bp_groups_delete_group_cache' );
65
  add_action( 'groups_settings_updated', 'bp_groups_delete_group_cache' );
66
 
67
  /**
68
- * Clears caches for the group creator when a group is created
 
 
69
  *
70
- * @param int $group_id
71
- * @param BP_Groups_Group $group_obj
72
- * @since BuddyPress (1.6)
73
  */
74
  function bp_groups_clear_group_creator_cache( $group_id, $group_obj ) {
75
  // Clears the 'total groups' for this user
@@ -80,9 +88,10 @@ add_action( 'groups_created_group', 'bp_groups_clear_group_creator_cache', 10, 2
80
  /**
81
  * Clears caches for all members in a group when a group is deleted
82
  *
83
- * @param BP_Groups_Group $group_obj
84
- * @param array User IDs who were in this group
85
- * @since BuddyPress (1.6)
 
86
  */
87
  function bp_groups_clear_group_members_caches( $group_obj, $user_ids ) {
88
  // Clears the 'total groups' cache for each member in a group
@@ -91,6 +100,12 @@ function bp_groups_clear_group_members_caches( $group_obj, $user_ids ) {
91
  }
92
  add_action( 'bp_groups_delete_group', 'bp_groups_clear_group_members_caches', 10, 2 );
93
 
 
 
 
 
 
 
94
  function groups_clear_group_user_object_cache( $group_id, $user_id ) {
95
  wp_cache_delete( 'bp_total_groups_for_user_' . $user_id, 'bp' );
96
  }
14
  if ( !defined( 'ABSPATH' ) ) exit;
15
 
16
  /**
17
+ * Slurp up metadata for a set of groups.
18
  *
19
  * This function is called in two places in the BP_Groups_Group class:
20
  * - in the populate() method, when single group objects are populated
21
  * - in the get() method, when multiple groups are queried
22
  *
23
+ * It grabs all groupmeta associated with all of the groups passed in
24
+ * $group_ids and adds it to WP cache. This improves efficiency when using
25
+ * groupmeta within a loop context.
26
  *
27
+ * @param int|str|array $group_ids Accepts a single group_id, or a
28
+ * comma-separated list or array of group ids.
29
  */
30
  function bp_groups_update_meta_cache( $group_ids = false ) {
31
  global $bp;
41
  bp_update_meta_cache( $cache_args );
42
  }
43
 
44
+ /**
45
+ * Clear the cached group count.
46
+ *
47
+ * @param $group_id Not used.
48
+ */
49
  function groups_clear_group_object_cache( $group_id ) {
50
  wp_cache_delete( 'bp_total_group_count', 'bp' );
51
  }
56
  add_action( 'groups_create_group_step_complete', 'groups_clear_group_object_cache' );
57
 
58
  /**
59
+ * Bust group caches when editing or deleting.
60
  *
61
+ * @since BuddyPress (1.7.0)
62
+ *
63
+ * @param int $group_id The group being edited.
64
  */
65
  function bp_groups_delete_group_cache( $group_id = 0 ) {
66
  wp_cache_delete( 'bp_groups_group_' . $group_id . '_load_users', 'bp' );
72
  add_action( 'groups_settings_updated', 'bp_groups_delete_group_cache' );
73
 
74
  /**
75
+ * Clear caches for the group creator when a group is created.
76
+ *
77
+ * @since BuddyPress (1.6.0)
78
  *
79
+ * @param int $group_id ID of the group.
80
+ * @param BP_Groups_Group $group_obj Group object.
 
81
  */
82
  function bp_groups_clear_group_creator_cache( $group_id, $group_obj ) {
83
  // Clears the 'total groups' for this user
88
  /**
89
  * Clears caches for all members in a group when a group is deleted
90
  *
91
+ * @since BuddyPress (1.6.0)
92
+ *
93
+ * @param BP_Groups_Group $group_obj Group object.
94
+ * @param array User IDs who were in this group.
95
  */
96
  function bp_groups_clear_group_members_caches( $group_obj, $user_ids ) {
97
  // Clears the 'total groups' cache for each member in a group
100
  }
101
  add_action( 'bp_groups_delete_group', 'bp_groups_clear_group_members_caches', 10, 2 );
102
 
103
+ /**
104
+ * Clear a user's cached group count.
105
+ *
106
+ * @param int $group_id ID of the group. Not used in this function.
107
+ * @param int $user_id ID of the user whose group count is being changed.
108
+ */
109
  function groups_clear_group_user_object_cache( $group_id, $user_id ) {
110
  wp_cache_delete( 'bp_total_groups_for_user_' . $user_id, 'bp' );
111
  }
bp-groups/bp-groups-classes.php CHANGED
@@ -10,24 +10,105 @@
10
  // Exit if accessed directly
11
  if ( !defined( 'ABSPATH' ) ) exit;
12
 
 
 
 
13
  class BP_Groups_Group {
 
 
 
 
 
 
 
14
  public $id;
 
 
 
 
 
 
 
15
  public $creator_id;
 
 
 
 
 
 
 
16
  public $name;
 
 
 
 
 
 
 
17
  public $slug;
 
 
 
 
 
 
 
18
  public $description;
 
 
 
 
 
 
 
 
 
19
  public $status;
 
 
 
 
 
 
 
20
  public $enable_forum;
 
 
 
 
 
 
 
21
  public $date_created;
22
 
 
 
 
 
 
 
23
  public $admins;
 
 
 
 
 
 
 
24
  public $mods;
 
 
 
 
 
 
 
25
  public $total_member_count;
26
 
27
  /**
28
  * Is the current user a member of this group?
29
  *
30
- * @since BuddyPress (1.2)
31
  * @var bool
32
  */
33
  public $is_member;
@@ -51,7 +132,7 @@ class BP_Groups_Group {
51
  /**
52
  * Timestamp of the last activity that happened in this group.
53
  *
54
- * @since BuddyPress (1.2)
55
  * @var string
56
  */
57
  public $last_activity;
@@ -59,11 +140,17 @@ class BP_Groups_Group {
59
  /**
60
  * If this is a private or hidden group, does the current user have access?
61
  *
62
- * @since BuddyPress (1.6)
63
  * @var bool
64
  */
65
  public $user_has_access;
66
 
 
 
 
 
 
 
67
  public function __construct( $id = null ) {
68
  if ( !empty( $id ) ) {
69
  $this->id = $id;
@@ -71,6 +158,9 @@ class BP_Groups_Group {
71
  }
72
  }
73
 
 
 
 
74
  public function populate() {
75
  global $wpdb, $bp;
76
 
@@ -114,6 +204,11 @@ class BP_Groups_Group {
114
  }
115
  }
116
 
 
 
 
 
 
117
  public function save() {
118
  global $wpdb, $bp;
119
 
@@ -185,6 +280,11 @@ class BP_Groups_Group {
185
  return true;
186
  }
187
 
 
 
 
 
 
188
  public function delete() {
189
  global $wpdb, $bp;
190
 
@@ -212,8 +312,16 @@ class BP_Groups_Group {
212
  return true;
213
  }
214
 
215
- /** Static Methods ********************************************************/
216
 
 
 
 
 
 
 
 
 
217
  public static function group_exists( $slug, $table_name = false ) {
218
  global $wpdb, $bp;
219
 
@@ -226,15 +334,48 @@ class BP_Groups_Group {
226
  return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$table_name} WHERE slug = %s", strtolower( $slug ) ) );
227
  }
228
 
 
 
 
 
 
 
 
 
229
  public static function get_id_from_slug( $slug ) {
230
  return BP_Groups_Group::group_exists( $slug );
231
  }
232
 
 
 
 
 
 
 
 
 
233
  public static function get_invites( $user_id, $group_id ) {
234
  global $wpdb, $bp;
235
  return $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM {$bp->groups->table_name_members} WHERE group_id = %d and is_confirmed = 0 AND inviter_id = %d", $group_id, $user_id ) );
236
  }
237
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
  public static function filter_user_groups( $filter, $user_id = 0, $order = false, $limit = null, $page = null ) {
239
  global $wpdb, $bp;
240
 
@@ -263,7 +404,21 @@ class BP_Groups_Group {
263
  }
264
 
265
  /**
266
- * @todo Deprecate in favor of get()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  */
268
  public static function search_groups( $filter, $limit = null, $page = null, $sort_by = false, $order = false ) {
269
  global $wpdb, $bp;
@@ -290,18 +445,36 @@ class BP_Groups_Group {
290
  return array( 'groups' => $paged_groups, 'total' => $total_groups );
291
  }
292
 
 
 
 
 
 
 
293
  public static function check_slug( $slug ) {
294
  global $wpdb, $bp;
295
 
296
  return $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM {$bp->groups->table_name} WHERE slug = %s", $slug ) );
297
  }
298
 
 
 
 
 
 
 
299
  public static function get_slug( $group_id ) {
300
  global $wpdb, $bp;
301
 
302
  return $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM {$bp->groups->table_name} WHERE id = %d", $group_id ) );
303
  }
304
 
 
 
 
 
 
 
305
  public static function has_members( $group_id ) {
306
  global $wpdb, $bp;
307
 
@@ -313,12 +486,33 @@ class BP_Groups_Group {
313
  return true;
314
  }
315
 
 
 
 
 
 
 
 
316
  public static function has_membership_requests( $group_id ) {
317
  global $wpdb, $bp;
318
 
319
  return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 0", $group_id ) );
320
  }
321
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
  public static function get_membership_requests( $group_id, $limit = null, $page = null ) {
323
  global $wpdb, $bp;
324
 
@@ -332,6 +526,55 @@ class BP_Groups_Group {
332
  return array( 'requests' => $paged_requests, 'total' => $total_requests );
333
  }
334
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
335
  public static function get( $args = array() ) {
336
  global $wpdb, $bp;
337
 
@@ -546,12 +789,12 @@ class BP_Groups_Group {
546
  * WP_Query, we have to alter the return value (stripping the leading
547
  * AND keyword from the 'where' clause).
548
  *
549
- * @since BuddyPress (1.8)
550
  * @access protected
551
  *
552
  * @param array $meta_query An array of meta_query filters. See the
553
- * documentation for WP_Meta_Query for details.
554
- * @return array $sql_array 'join' and 'where' clauses
555
  */
556
  protected static function get_meta_query_sql( $meta_query = array() ) {
557
  global $wpdb;
@@ -598,12 +841,16 @@ class BP_Groups_Group {
598
  }
599
 
600
  /**
601
- * Convert the 'type' parameter to 'order' and 'orderby'
602
  *
603
- * @since BuddyPress (1.8)
604
  * @access protected
605
- * @param string $type The 'type' shorthand param
606
- * @return array 'order' and 'orderby'
 
 
 
 
607
  */
608
  protected static function convert_type_to_order_orderby( $type = '' ) {
609
  $order = $orderby = '';
@@ -639,12 +886,13 @@ class BP_Groups_Group {
639
  }
640
 
641
  /**
642
- * Convert the 'orderby' param into a proper SQL term/column
643
  *
644
- * @since BuddyPress (1.8)
645
  * @access protected
646
- * @param string $orderby
647
- * @return string $order_by_term
 
648
  */
649
  protected static function convert_orderby_to_order_by_term( $orderby ) {
650
  $order_by_term = '';
@@ -675,6 +923,28 @@ class BP_Groups_Group {
675
  return $order_by_term;
676
  }
677
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
678
  public static function get_by_most_forum_topics( $limit = null, $page = null, $user_id = 0, $search_terms = false, $populate_extras = true, $exclude = false ) {
679
  global $wpdb, $bp, $bbdb;
680
 
@@ -717,6 +987,28 @@ class BP_Groups_Group {
717
  return array( 'groups' => $paged_groups, 'total' => $total_groups );
718
  }
719
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
720
  public static function get_by_most_forum_posts( $limit = null, $page = null, $search_terms = false, $populate_extras = true, $exclude = false ) {
721
  global $wpdb, $bp, $bbdb;
722
 
@@ -759,6 +1051,25 @@ class BP_Groups_Group {
759
  return array( 'groups' => $paged_groups, 'total' => $total_groups );
760
  }
761
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
762
  public static function get_by_letter( $letter, $limit = null, $page = null, $populate_extras = true, $exclude = false ) {
763
  global $wpdb, $bp;
764
 
@@ -803,6 +1114,30 @@ class BP_Groups_Group {
803
  return array( 'groups' => $paged_groups, 'total' => $total_groups );
804
  }
805
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
806
  public static function get_random( $limit = null, $page = null, $user_id = 0, $search_terms = false, $populate_extras = true, $exclude = false ) {
807
  global $wpdb, $bp;
808
 
@@ -844,6 +1179,23 @@ class BP_Groups_Group {
844
  return array( 'groups' => $paged_groups, 'total' => $total_groups );
845
  }
846
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
847
  public static function get_group_extras( &$paged_groups, &$group_ids, $type = false ) {
848
  global $bp, $wpdb;
849
 
@@ -901,12 +1253,28 @@ class BP_Groups_Group {
901
  return $paged_groups;
902
  }
903
 
 
 
 
 
 
 
 
 
904
  public static function delete_all_invites( $group_id ) {
905
  global $wpdb, $bp;
906
 
907
  return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE group_id = %d AND invite_sent = 1", $group_id ) );
908
  }
909
 
 
 
 
 
 
 
 
 
910
  public static function get_total_group_count() {
911
  global $wpdb, $bp;
912
 
@@ -917,6 +1285,13 @@ class BP_Groups_Group {
917
  return $wpdb->get_var( "SELECT COUNT(id) FROM {$bp->groups->table_name} {$hidden_sql}" );
918
  }
919
 
 
 
 
 
 
 
 
920
  public static function get_global_forum_topic_count( $type ) {
921
  global $bbdb, $wpdb, $bp;
922
 
@@ -933,6 +1308,12 @@ class BP_Groups_Group {
933
  return $wpdb->get_var( "SELECT COUNT(t.topic_id) FROM {$bbdb->topics} AS t, {$bp->groups->table_name} AS g LEFT JOIN {$bp->groups->table_name_groupmeta} AS gm ON g.id = gm.group_id WHERE (gm.meta_key = 'forum_id' AND gm.meta_value = t.forum_id) AND g.status = 'public' AND t.topic_status = '0' AND t.topic_sticky != '2' {$extra_sql} " );
934
  }
935
 
 
 
 
 
 
 
936
  public static function get_total_member_count( $group_id ) {
937
  global $wpdb, $bp;
938
 
@@ -942,10 +1323,10 @@ class BP_Groups_Group {
942
  /**
943
  * Get a total count of all topics of a given status, across groups/forums
944
  *
945
- * @package BuddyPress
946
- * @since BuddyPress (1.5)
947
  *
948
- * @param string $status 'public', 'private', 'hidden', 'all' Which group types to count
 
949
  * @return int The topic count
950
  */
951
  public static function get_global_topic_count( $status = 'public', $search_terms = false ) {
@@ -985,12 +1366,12 @@ class BP_Groups_Group {
985
  }
986
 
987
  /**
988
- * Get an array containing ids for each group type
989
  *
990
  * A bit of a kludge workaround for some issues
991
- * with bp_has_groups()
992
  *
993
- * @since BuddyPress (1.7)
994
  *
995
  * @return array
996
  */
@@ -1009,23 +1390,24 @@ class BP_Groups_Group {
1009
  }
1010
 
1011
  /**
1012
- * Query for the members of a group
1013
  *
1014
- * @since BuddyPress (1.8)
1015
  */
1016
  class BP_Group_Member_Query extends BP_User_Query {
 
1017
  /**
1018
- * Array of group member ids, cached to prevent redundant lookups
1019
  *
1020
- * @var null|array Null if not yet defined, otherwise an array of ints
1021
  * @since BuddyPress (1.8.1)
 
1022
  */
1023
  protected $group_member_ids;
1024
 
1025
  /**
1026
- * Set up action hooks
1027
  *
1028
- * @since BuddyPress (1.8)
1029
  */
1030
  public function setup_hooks() {
1031
  // Take this early opportunity to set the default 'type' param
@@ -1043,13 +1425,15 @@ class BP_Group_Member_Query extends BP_User_Query {
1043
  }
1044
 
1045
  /**
1046
- * Get a list of user_ids to include in the IN clause of the main query
1047
  *
1048
  * Overrides BP_User_Query::get_include_ids(), adding our additional
1049
  * group-member logic.
1050
  *
1051
- * @since BuddyPress (1.8)
1052
- * @param array
 
 
1053
  * @return array
1054
  */
1055
  public function get_include_ids( $include = array() ) {
@@ -1080,10 +1464,11 @@ class BP_Group_Member_Query extends BP_User_Query {
1080
  }
1081
 
1082
  /**
1083
- * Get the members of the queried group
1084
  *
1085
- * @since BuddyPress (1.8)
1086
- * @return array $ids User IDs of relevant group member ids
 
1087
  */
1088
  protected function get_group_member_ids() {
1089
  global $wpdb;
@@ -1176,12 +1561,12 @@ class BP_Group_Member_Query extends BP_User_Query {
1176
  }
1177
 
1178
  /**
1179
- * Tell BP_User_Query to order by the order of our query results
1180
  *
1181
  * This implementation assumes the 'last_modified' sort order
1182
  * hardcoded in BP_Group_Member_Query::get_group_member_ids().
1183
  *
1184
- * @param object $query BP_User_Query object
1185
  */
1186
  public function set_orderby( $query ) {
1187
  $gm_ids = $this->get_group_member_ids();
@@ -1201,9 +1586,15 @@ class BP_Group_Member_Query extends BP_User_Query {
1201
  }
1202
 
1203
  /**
1204
- * Fetch additional data required in bp_group_has_members() loops
 
 
 
 
 
 
 
1205
  *
1206
- * @since BuddyPress (1.8)
1207
  * @param object $query BP_User_Query object. Because we're filtering
1208
  * the current object, we use $this inside of the method instead
1209
  * @param string $user_ids_sql Sanitized, comma-separated string of
@@ -1229,21 +1620,138 @@ class BP_Group_Member_Query extends BP_User_Query {
1229
  }
1230
  }
1231
 
 
 
 
1232
  class BP_Groups_Member {
 
 
 
 
 
 
 
1233
  var $id;
 
 
 
 
 
 
 
1234
  var $group_id;
 
 
 
 
 
 
 
1235
  var $user_id;
 
 
 
 
 
 
 
1236
  var $inviter_id;
 
 
 
 
 
 
 
1237
  var $is_admin;
 
 
 
 
 
 
 
1238
  var $is_mod;
 
 
 
 
 
 
 
1239
  var $is_banned;
 
 
 
 
 
 
 
 
 
1240
  var $user_title;
 
 
 
 
 
 
 
 
 
1241
  var $date_modified;
 
 
 
 
 
 
 
1242
  var $is_confirmed;
 
 
 
 
 
 
 
 
 
 
1243
  var $comments;
 
 
 
 
 
 
 
 
 
 
 
 
1244
  var $invite_sent;
 
 
 
 
 
 
 
1245
  var $user;
1246
 
 
 
 
 
 
 
 
 
 
 
 
1247
  public function __construct( $user_id = 0, $group_id = 0, $id = false, $populate = true ) {
1248
 
1249
  // User and group are not empty, and ID is
@@ -1266,6 +1774,9 @@ class BP_Groups_Member {
1266
  }
1267
  }
1268
 
 
 
 
1269
  public function populate() {
1270
  global $wpdb, $bp;
1271
 
@@ -1295,6 +1806,11 @@ class BP_Groups_Member {
1295
  }
1296
  }
1297
 
 
 
 
 
 
1298
  public function save() {
1299
  global $wpdb, $bp;
1300
 
@@ -1339,6 +1855,12 @@ class BP_Groups_Member {
1339
  return true;
1340
  }
1341
 
 
 
 
 
 
 
1342
  public function promote( $status = 'mod' ) {
1343
  if ( 'mod' == $status ) {
1344
  $this->is_admin = 0;
@@ -1355,6 +1877,11 @@ class BP_Groups_Member {
1355
  return $this->save();
1356
  }
1357
 
 
 
 
 
 
1358
  public function demote() {
1359
  $this->is_mod = 0;
1360
  $this->is_admin = 0;
@@ -1363,6 +1890,11 @@ class BP_Groups_Member {
1363
  return $this->save();
1364
  }
1365
 
 
 
 
 
 
1366
  public function ban() {
1367
  if ( !empty( $this->is_admin ) )
1368
  return false;
@@ -1373,6 +1905,11 @@ class BP_Groups_Member {
1373
  return $this->save();
1374
  }
1375
 
 
 
 
 
 
1376
  public function unban() {
1377
  if ( !empty( $this->is_admin ) )
1378
  return false;
@@ -1382,17 +1919,28 @@ class BP_Groups_Member {
1382
  return $this->save();
1383
  }
1384
 
 
 
 
1385
  public function accept_invite() {
1386
  $this->inviter_id = 0;
1387
  $this->is_confirmed = 1;
1388
  $this->date_modified = bp_core_current_time();
1389
  }
1390
 
 
 
 
1391
  public function accept_request() {
1392
  $this->is_confirmed = 1;
1393
  $this->date_modified = bp_core_current_time();
1394
  }
1395
 
 
 
 
 
 
1396
  public function remove() {
1397
  global $wpdb, $bp;
1398
 
@@ -1410,30 +1958,39 @@ class BP_Groups_Member {
1410
  return $result;
1411
  }
1412
 
1413
- /** Static Methods ********************************************************/
1414
 
1415
  /**
1416
- * Refresh the total_group_count for a user
1417
  *
1418
- * @since BuddyPress (1.8)
1419
- * @param int $user_id
1420
- * @return bool True on success
 
1421
  */
1422
  public static function refresh_total_group_count_for_user( $user_id ) {
1423
  return bp_update_user_meta( $user_id, 'total_group_count', (int) self::total_group_count( $user_id ) );
1424
  }
1425
 
1426
  /**
1427
- * Refresh the total_member_count for a group
1428
  *
1429
- * @since BuddyPress (1.8)
1430
- * @param int $group_id
1431
- * @return bool True on success
 
1432
  */
1433
  public static function refresh_total_member_count_for_group( $group_id ) {
1434
  return groups_update_groupmeta( $group_id, 'total_member_count', (int) BP_Groups_Group::get_total_member_count( $group_id ) );
1435
  }
1436
 
 
 
 
 
 
 
 
1437
  public static function delete( $user_id, $group_id ) {
1438
  global $wpdb, $bp;
1439
 
@@ -1448,6 +2005,19 @@ class BP_Groups_Member {
1448
  return $remove;
1449
  }
1450
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1451
  public static function get_group_ids( $user_id, $limit = false, $page = false ) {
1452
  global $wpdb, $bp;
1453
 
@@ -1469,6 +2039,21 @@ class BP_Groups_Member {
1469
  return array( 'groups' => $groups, 'total' => (int) $total_groups );
1470
  }
1471
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1472
  public static function get_recently_joined( $user_id, $limit = false, $page = false, $filter = false ) {
1473
  global $wpdb, $bp;
1474
 
@@ -1491,6 +2076,21 @@ class BP_Groups_Member {
1491
  return array( 'groups' => $paged_groups, 'total' => $total_groups );
1492
  }
1493
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1494
  public static function get_is_admin_of( $user_id, $limit = false, $page = false, $filter = false ) {
1495
  global $wpdb, $bp;
1496
 
@@ -1513,6 +2113,21 @@ class BP_Groups_Member {
1513
  return array( 'groups' => $paged_groups, 'total' => $total_groups );
1514
  }
1515
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1516
  public static function get_is_mod_of( $user_id, $limit = false, $page = false, $filter = false ) {
1517
  global $wpdb, $bp;
1518
 
@@ -1535,6 +2150,12 @@ class BP_Groups_Member {
1535
  return array( 'groups' => $paged_groups, 'total' => $total_groups );
1536
  }
1537
 
 
 
 
 
 
 
1538
  public static function total_group_count( $user_id = 0 ) {
1539
  global $bp, $wpdb;
1540
 
@@ -1548,6 +2169,21 @@ class BP_Groups_Member {
1548
  }
1549
  }
1550
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1551
  public static function get_invites( $user_id, $limit = false, $page = false, $exclude = false ) {
1552
  global $wpdb, $bp;
1553
 
@@ -1566,6 +2202,16 @@ class BP_Groups_Member {
1566
  return array( 'groups' => $paged_groups, 'total' => $total_groups );
1567
  }
1568
 
 
 
 
 
 
 
 
 
 
 
1569
  public static function check_has_invite( $user_id, $group_id, $type = 'sent' ) {
1570
  global $wpdb, $bp;
1571
 
@@ -1580,6 +2226,13 @@ class BP_Groups_Member {
1580
  return $wpdb->get_var( $wpdb->prepare( $sql, $user_id, $group_id ) );
1581
  }
1582
 
 
 
 
 
 
 
 
1583
  public static function delete_invite( $user_id, $group_id ) {
1584
  global $wpdb, $bp;
1585
 
@@ -1589,6 +2242,13 @@ class BP_Groups_Member {
1589
  return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND inviter_id != 0 AND invite_sent = 1", $user_id, $group_id ) );
1590
  }
1591
 
 
 
 
 
 
 
 
1592
  public static function delete_request( $user_id, $group_id ) {
1593
  global $wpdb, $bp;
1594
 
@@ -1598,6 +2258,14 @@ class BP_Groups_Member {
1598
  return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND inviter_id = 0 AND invite_sent = 0", $user_id, $group_id ) );
1599
  }
1600
 
 
 
 
 
 
 
 
 
1601
  public static function check_is_admin( $user_id, $group_id ) {
1602
  global $wpdb, $bp;
1603
 
@@ -1607,6 +2275,14 @@ class BP_Groups_Member {
1607
  return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_admin = 1 AND is_banned = 0", $user_id, $group_id ) );
1608
  }
1609
 
 
 
 
 
 
 
 
 
1610
  public static function check_is_mod( $user_id, $group_id ) {
1611
  global $wpdb, $bp;
1612
 
@@ -1616,6 +2292,14 @@ class BP_Groups_Member {
1616
  return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_mod = 1 AND is_banned = 0", $user_id, $group_id ) );
1617
  }
1618
 
 
 
 
 
 
 
 
 
1619
  public static function check_is_member( $user_id, $group_id ) {
1620
  global $wpdb, $bp;
1621
 
@@ -1625,6 +2309,14 @@ class BP_Groups_Member {
1625
  return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 1 AND is_banned = 0", $user_id, $group_id ) );
1626
  }
1627
 
 
 
 
 
 
 
 
 
1628
  public static function check_is_banned( $user_id, $group_id ) {
1629
  global $wpdb, $bp;
1630
 
@@ -1637,11 +2329,12 @@ class BP_Groups_Member {
1637
  /**
1638
  * Is the specified user the creator of the group?
1639
  *
1640
- * @global object $bp BuddyPress global settings
1641
- * @global wpdb $wpdb WordPress database object
1642
- * @param int $user_id
1643
- * @param int $group_id
1644
  * @since BuddyPress (1.2.6)
 
 
 
 
 
1645
  */
1646
  public static function check_is_creator( $user_id, $group_id ) {
1647
  global $bp, $wpdb;
@@ -1652,6 +2345,13 @@ class BP_Groups_Member {
1652
  return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name} WHERE creator_id = %d AND id = %d", $user_id, $group_id ) );
1653
  }
1654
 
 
 
 
 
 
 
 
1655
  public static function check_for_membership_request( $user_id, $group_id ) {
1656
  global $wpdb, $bp;
1657
 
@@ -1661,6 +2361,13 @@ class BP_Groups_Member {
1661
  return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND is_banned = 0 AND inviter_id = 0", $user_id, $group_id ) );
1662
  }
1663
 
 
 
 
 
 
 
 
1664
  public static function get_random_groups( $user_id = 0, $total_groups = 5 ) {
1665
  global $wpdb, $bp;
1666
 
@@ -1672,30 +2379,59 @@ class BP_Groups_Member {
1672
  }
1673
  }
1674
 
 
 
 
 
 
 
1675
  public static function get_group_member_ids( $group_id ) {
1676
  global $bp, $wpdb;
1677
 
1678
  return $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 AND is_banned = 0", $group_id ) );
1679
  }
1680
 
 
 
 
 
 
 
1681
  public static function get_group_administrator_ids( $group_id ) {
1682
  global $bp, $wpdb;
1683
 
1684
  return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_admin = 1 AND is_banned = 0", $group_id ) );
1685
  }
1686
 
 
 
 
 
 
 
1687
  public static function get_group_moderator_ids( $group_id ) {
1688
  global $bp, $wpdb;
1689
 
1690
  return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_mod = 1 AND is_banned = 0", $group_id ) );
1691
  }
1692
 
 
 
 
 
 
 
1693
  public static function get_all_membership_request_user_ids( $group_id ) {
1694
  global $bp, $wpdb;
1695
 
1696
  return $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 0 AND inviter_id = 0", $group_id ) );
1697
  }
1698
 
 
 
 
 
 
1699
  public static function get_all_for_group( $group_id, $limit = false, $page = false, $exclude_admins_mods = true, $exclude_banned = true, $exclude = false ) {
1700
  global $bp, $wpdb;
1701
 
@@ -1755,6 +2491,12 @@ class BP_Groups_Member {
1755
  return array( 'members' => $members, 'count' => $total_member_count );
1756
  }
1757
 
 
 
 
 
 
 
1758
  public static function delete_all( $group_id ) {
1759
  global $wpdb, $bp;
1760
 
@@ -1762,13 +2504,11 @@ class BP_Groups_Member {
1762
  }
1763
 
1764
  /**
1765
- * Delete all group membership information for the specified user
 
 
1766
  *
1767
- * @global object $bp BuddyPress global settings
1768
- * @global wpdb $wpdb WordPress database object
1769
- * @param int $user_id
1770
- * @since BuddyPress (1.0)
1771
- * @uses BP_Groups_Member
1772
  */
1773
  public static function delete_all_for_user( $user_id ) {
1774
  global $bp, $wpdb;
@@ -1861,115 +2601,152 @@ class BP_Groups_Member {
1861
  *
1862
  * @package BuddyPress
1863
  * @subpackage Groups
1864
- * @since BuddyPress (1.1)
1865
  */
1866
  class BP_Group_Extension {
1867
 
1868
- /** Public ****************************************************************/
1869
 
1870
  /**
1871
- * @var array Information about this extension's screens
1872
- * @since BuddyPress (1.8)
 
 
1873
  */
1874
  public $screens = array();
1875
 
1876
  /**
1877
- * @var string The name of the extending class
1878
- * @since BuddyPress (1.8)
 
 
1879
  */
1880
  public $class_name = '';
1881
 
1882
  /**
1883
- * @var object A ReflectionClass object of the current extension
1884
- * @since BuddyPress (1.8)
 
 
1885
  */
1886
  public $class_reflection = null;
1887
 
1888
  /**
1889
- * @var array Parsed configuration paramaters for the extension
1890
- * @since BuddyPress (1.8)
 
 
1891
  */
1892
  public $params = array();
1893
 
1894
  /**
1895
- * @var int The id of the current group
1896
- * @since BuddyPress (1.8)
 
 
1897
  */
1898
  public $group_id = 0;
1899
 
1900
  /**
1901
- * @var string The slug of the current extension
 
 
1902
  */
1903
  public $slug = '';
1904
 
1905
  /**
1906
- * @var string The translatable name of the current extension
 
 
1907
  */
1908
  public $name = '';
1909
 
1910
  /**
1911
- * @var string Whether the extension tab is visible. 'public'
1912
- * or 'private'
 
1913
  */
1914
  public $visibility = 'public';
1915
 
1916
  /**
1917
- * @var int The numeric position of the main nav item
 
 
1918
  */
1919
  public $nav_item_position = 81;
1920
 
1921
  /**
1922
- * @var bool Whether to show the nav item
 
 
1923
  */
1924
  public $enable_nav_item = true;
1925
 
1926
  /**
1927
- * @var string The text of the nav item. Defaults to self::name
 
 
1928
  */
1929
  public $nav_item_name = '';
1930
 
1931
  /**
1932
- * @var string The WP action that self::widget_display() is attached to.
1933
- * Defaults to 'groups_custom_group_boxes'
 
 
 
1934
  */
1935
  public $display_hook = 'groups_custom_group_boxes';
1936
 
1937
  /**
1938
- * @var string The template file used to load the plugin content.
1939
- * Defaults to 'groups/single/plugins'
 
 
 
1940
  */
1941
  public $template_file = 'groups/single/plugins';
1942
 
1943
- /** Protected *************************************************************/
1944
 
1945
  /**
1946
- * @var bool Has the extension been initialized?
1947
- * @since BuddyPress (1.8)
 
 
1948
  */
1949
  protected $initialized = false;
1950
 
1951
  /**
1952
- * @var array Extension properties as set by legacy extensions
1953
- * @since BuddyPress (1.8)
 
 
1954
  */
1955
  protected $legacy_properties = array();
1956
 
1957
  /**
1958
- * @var array Extension properties as set by legacy extensions, but
1959
- * converted to match the new format for params
1960
- * @since BuddyPress (1.8)
 
 
 
 
1961
  */
1962
  protected $legacy_properties_converted = array();
1963
 
1964
  /**
1965
- * @var array Miscellaneous data as set by the __set() magic method
1966
- * @since BuddyPress (1.8)
 
 
1967
  */
1968
  protected $data = array();
1969
 
1970
- /** Screen Overrides ******************************************************/
1971
 
1972
- /**
1973
  * Screen override methods are how your extension will display content
1974
  * and handle form submits. Your extension should only override those
1975
  * methods that it needs for its purposes.
@@ -2014,7 +2791,33 @@ class BP_Group_Extension {
2014
  * }
2015
  *
2016
  * @since BuddyPress (1.8)
2017
- * @param array $args See inline definition below for arguments
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2018
  */
2019
  public function init( $args = array() ) {
2020
 
@@ -2043,7 +2846,7 @@ class BP_Group_Extension {
2043
  }
2044
 
2045
  /**
2046
- * The main setup routine for the extension
2047
  *
2048
  * This method contains the primary logic for setting up an extension's
2049
  * configuration, setting up backward compatibility for legacy plugins,
@@ -2054,7 +2857,7 @@ class BP_Group_Extension {
2054
  * is called automatically at the right point in the load order by
2055
  * bp_register_group_extension().
2056
  *
2057
- * @since BuddyPress (1.1)
2058
  */
2059
  public function _register() {
2060
 
@@ -2092,13 +2895,13 @@ class BP_Group_Extension {
2092
  }
2093
 
2094
  /**
2095
- * Set up some basic info about the Extension
2096
  *
2097
  * Here we collect the name of the extending class, as well as a
2098
  * ReflectionClass that is used in get_screen_callback() to determine
2099
  * whether your extension overrides certain callback methods.
2100
  *
2101
- * @since BuddyPress (1.8)
2102
  */
2103
  protected function setup_class_info() {
2104
  if ( empty( $this->class_name ) ) {
@@ -2111,14 +2914,14 @@ class BP_Group_Extension {
2111
  }
2112
 
2113
  /**
2114
- * Get the current group id
2115
  *
2116
  * Check for:
2117
  * - current group
2118
  * - new group
2119
  * - group admin
2120
  *
2121
- * @since BuddyPress (1.8)
2122
  */
2123
  public static function get_group_id() {
2124
 
@@ -2147,9 +2950,9 @@ class BP_Group_Extension {
2147
  }
2148
 
2149
  /**
2150
- * Gather configuration data about your screens
2151
  *
2152
- * @since BuddyPress (1.8)
2153
  */
2154
  protected function get_default_screens() {
2155
  $this->setup_class_info();
@@ -2180,9 +2983,9 @@ class BP_Group_Extension {
2180
  }
2181
 
2182
  /**
2183
- * Set up screens array based on params
2184
  *
2185
- * @since BuddyPress (1.8)
2186
  */
2187
  protected function setup_screens() {
2188
  foreach ( (array) $this->params['screens'] as $context => $screen ) {
@@ -2198,12 +3001,12 @@ class BP_Group_Extension {
2198
  }
2199
  }
2200
 
2201
- /** Display ***************************************************************/
2202
 
2203
  /**
2204
- * Hook this extension's group tab into BuddyPress, if necessary
2205
  *
2206
- * @since BuddyPress (1.8)
2207
  */
2208
  protected function setup_display_hooks() {
2209
 
@@ -2243,19 +3046,19 @@ class BP_Group_Extension {
2243
  }
2244
 
2245
  /**
2246
- * Hooks the main display method, and loads the template file
2247
  */
2248
  public function _display_hook() {
2249
  add_action( 'bp_template_content', array( &$this, 'display' ) );
2250
  bp_core_load_template( apply_filters( 'bp_core_template_plugin', $this->template_file ) );
2251
  }
2252
 
2253
- /** Create ****************************************************************/
2254
 
2255
  /**
2256
- * Hook this extension's Create step into BuddyPress, if necessary
2257
  *
2258
- * @since BuddyPress (1.8)
2259
  */
2260
  protected function setup_create_hooks() {
2261
  if ( ! $this->is_screen_enabled( 'create' ) ) {
@@ -2281,9 +3084,9 @@ class BP_Group_Extension {
2281
  }
2282
 
2283
  /**
2284
- * Call the create_screen() method, if we're on the right page
2285
  *
2286
- * @since BuddyPress (1.8)
2287
  */
2288
  public function maybe_create_screen() {
2289
  if ( ! bp_is_group_creation_step( $this->screens['create']['slug'] ) ) {
@@ -2299,9 +3102,9 @@ class BP_Group_Extension {
2299
  }
2300
 
2301
  /**
2302
- * Call the create_screen_save() method, if we're on the right page
2303
  *
2304
- * @since BuddyPress (1.8)
2305
  */
2306
  public function maybe_create_screen_save() {
2307
  if ( ! bp_is_group_creation_step( $this->screens['create']['slug'] ) ) {
@@ -2312,12 +3115,12 @@ class BP_Group_Extension {
2312
  call_user_func( $this->screens['create']['screen_save_callback'], $this->group_id );
2313
  }
2314
 
2315
- /** Edit ******************************************************************/
2316
 
2317
  /**
2318
- * Hook this extension's Edit panel into BuddyPress, if necessary
2319
  *
2320
- * @since BuddyPress (1.8)
2321
  */
2322
  protected function setup_edit_hooks() {
2323
 
@@ -2362,7 +3165,7 @@ class BP_Group_Extension {
2362
  }
2363
 
2364
  /**
2365
- * Call the edit_screen() method
2366
  *
2367
  * Previous versions of BP_Group_Extension required plugins to provide
2368
  * their own Submit button and nonce fields when building markup. In
@@ -2374,7 +3177,7 @@ class BP_Group_Extension {
2374
  * button, as would be present in legacy plugins; if one is found, we
2375
  * do not auto-add our own button.
2376
  *
2377
- * @since BuddyPress (1.8)
2378
  */
2379
  public function call_edit_screen() {
2380
  ob_start();
@@ -2388,9 +3191,9 @@ class BP_Group_Extension {
2388
  }
2389
 
2390
  /**
2391
- * Check the nonce, and call the edit_screen_save() method
2392
  *
2393
- * @since BuddyPress (1.8)
2394
  */
2395
  public function call_edit_screen_save() {
2396
  if ( empty( $_POST ) ) {
@@ -2408,7 +3211,7 @@ class BP_Group_Extension {
2408
  }
2409
 
2410
  /**
2411
- * Load the template that houses the Edit screen
2412
  *
2413
  * Separated out into a callback so that it can run after all other
2414
  * Group Extensions have had a chance to register their navigation, to
@@ -2416,16 +3219,17 @@ class BP_Group_Extension {
2416
  *
2417
  * Hooked to 'bp_screens'.
2418
  *
2419
- * @see BP_Group_Extension::setup_edit_hooks()
2420
  * @access public So that do_action() has access. Do not call directly.
2421
- * @since BuddyPress (1.8)
 
2422
  */
2423
  public function call_edit_screen_template_loader() {
2424
  bp_core_load_template( $this->edit_screen_template );
2425
  }
2426
 
2427
  /**
2428
- * Add a submit button to the edit form, if it needs one
2429
  *
2430
  * There's an inconsistency in the way that the group Edit and Create
2431
  * screens are rendered: the Create screen has a submit button built
@@ -2434,9 +3238,11 @@ class BP_Group_Extension {
2434
  * use on both the Create and Edit screens - BP will provide the button
2435
  * if one is not found.
2436
  *
2437
- * @since BuddyPress (1.8)
2438
- * @param string $screen The screen markup, captured in the output buffer
2439
- * @param string $screen The same markup, with a submit button added
 
 
2440
  */
2441
  protected function maybe_add_submit_button( $screen = '' ) {
2442
  if ( $this->has_submit_button( $screen ) ) {
@@ -2454,9 +3260,10 @@ class BP_Group_Extension {
2454
  /**
2455
  * Does the given markup have a submit button?
2456
  *
2457
- * @since BuddyPress (1.8)
2458
- * @param string $screen The markup to check
2459
- * @return bool
 
2460
  */
2461
  public static function has_submit_button( $screen = '' ) {
2462
  $pattern = "/<input[^>]+type=[\'\"]submit[\'\"]/";
@@ -2464,12 +3271,12 @@ class BP_Group_Extension {
2464
  return ! empty( $matches[0] );
2465
  }
2466
 
2467
- /** Admin *****************************************************************/
2468
 
2469
  /**
2470
- * Hook this extension's Admin metabox into BuddyPress, if necessary
2471
  *
2472
- * @since BuddyPress (1.8)
2473
  */
2474
  protected function setup_admin_hooks() {
2475
  if ( ! $this->is_screen_enabled( 'admin' ) || ! is_admin() ) {
@@ -2487,9 +3294,9 @@ class BP_Group_Extension {
2487
  }
2488
 
2489
  /**
2490
- * Call the admin_screen() method, and add a nonce field
2491
  *
2492
- * @since BuddyPress (1.8)
2493
  */
2494
  public function call_admin_screen() {
2495
  call_user_func( $this->screens['admin']['screen_callback'], $this->group_id );
@@ -2499,7 +3306,7 @@ class BP_Group_Extension {
2499
  /**
2500
  * Check the nonce, and call the admin_screen_save() method
2501
  *
2502
- * @since BuddyPress (1.8)
2503
  */
2504
  public function call_admin_screen_save() {
2505
  $this->check_nonce( 'admin' );
@@ -2507,9 +3314,9 @@ class BP_Group_Extension {
2507
  }
2508
 
2509
  /**
2510
- * Create the Dashboard meta box for this extension
2511
  *
2512
- * @since BuddyPress (1.7)
2513
  */
2514
  public function _meta_box_display_callback() {
2515
  $group_id = isset( $_GET['gid'] ) ? (int) $_GET['gid'] : 0;
@@ -2526,10 +3333,10 @@ class BP_Group_Extension {
2526
  }
2527
 
2528
 
2529
- /** Utilities *************************************************************/
2530
 
2531
  /**
2532
- * Generate the nonce fields for a settings form
2533
  *
2534
  * The nonce field name (the second param passed to wp_nonce_field)
2535
  * contains this extension's slug and is thus unique to this extension.
@@ -2537,20 +3344,24 @@ class BP_Group_Extension {
2537
  * more than one extension may generate nonces on the same page, and we
2538
  * must avoid name clashes.
2539
  *
2540
- * @since BuddyPress (1.8)
 
2541
  * @uses wp_nonce_field()
2542
- * @param string $context 'create', 'edit', 'admin'
 
2543
  */
2544
  public function nonce_field( $context = '' ) {
2545
  wp_nonce_field( 'bp_group_extension_' . $this->slug . '_' . $context, '_bp_group_' . $context . '_nonce_' . $this->slug );
2546
  }
2547
 
2548
  /**
2549
- * Check the nonce on a submitted settings form
 
 
2550
  *
2551
- * @since BuddyPress (1.8)
2552
  * @uses check_admin_referer()
2553
- * @param string $context 'create', 'edit', 'admin'
 
2554
  */
2555
  public function check_nonce( $context = '' ) {
2556
  check_admin_referer( 'bp_group_extension_' . $this->slug . '_' . $context, '_bp_group_' . $context . '_nonce_' . $this->slug );
@@ -2563,9 +3374,11 @@ class BP_Group_Extension {
2563
  * (legacy: $this->enable_create_step, etc), and its screen_callback
2564
  * must also exist and be callable.
2565
  *
2566
- * @since BuddyPress (1.8)
2567
- * @param string $context 'create', 'edit', 'admin'
2568
- * @return bool
 
 
2569
  */
2570
  public function is_screen_enabled( $context = '' ) {
2571
  $enabled = false;
@@ -2578,7 +3391,7 @@ class BP_Group_Extension {
2578
  }
2579
 
2580
  /**
2581
- * Get the appropriate screen callback for the specified context/type
2582
  *
2583
  * BP Group Extensions have three special "screen contexts": create,
2584
  * admin, and edit. Each of these contexts has a corresponding
@@ -2609,10 +3422,12 @@ class BP_Group_Extension {
2609
  * The get_screen_callback() method uses a ReflectionClass object to
2610
  * determine whether your extension has provided a given callback.
2611
  *
2612
- * @since BuddyPress (1.8)
2613
- * @param string $context 'create', 'edit', 'admin'
2614
- * @param string $type 'screen', 'screen_save'
2615
- * @return mixed A callable function handle
 
 
2616
  */
2617
  public function get_screen_callback( $context = '', $type = 'screen' ) {
2618
  $callback = '';
@@ -2636,7 +3451,7 @@ class BP_Group_Extension {
2636
  }
2637
 
2638
  /**
2639
- * Recursive argument parsing
2640
  *
2641
  * This acts like a multi-dimensional version of wp_parse_args() (minus
2642
  * the querystring parsing - you must pass arrays).
@@ -2657,10 +3472,11 @@ class BP_Group_Extension {
2657
  * in unexpected results when used with data in the wild. See, eg,
2658
  * http://core.trac.wordpress.org/ticket/19888
2659
  *
2660
- * @since BuddyPress (1.8)
2661
- * @arg array $a
2662
- * @arg array $b
2663
- * @return array
 
2664
  */
2665
  public static function parse_args_r( &$a, $b ) {
2666
  $a = (array) $a;
@@ -2680,7 +3496,7 @@ class BP_Group_Extension {
2680
 
2681
  /** Legacy Support ********************************************************/
2682
 
2683
- /**
2684
  * In BuddyPress 1.8, the recommended technique for configuring
2685
  * extensions changed from directly setting various object properties
2686
  * in the class constructor, to passing a configuration array to
@@ -2690,7 +3506,7 @@ class BP_Group_Extension {
2690
  */
2691
 
2692
  /**
2693
- * Provide access to otherwise unavailable object properties
2694
  *
2695
  * This magic method is here for backward compatibility with plugins
2696
  * that refer to config properties that have moved to a different
@@ -2700,9 +3516,10 @@ class BP_Group_Extension {
2700
  * The legacy_properties array is set up in
2701
  * self::setup_legacy_properties().
2702
  *
2703
- * @since BuddyPress (1.8)
2704
- * @param string $key
2705
- * @return mixed
 
2706
  */
2707
  public function __get( $key ) {
2708
  if ( isset( $this->legacy_properties[ $key ] ) ) {
@@ -2715,17 +3532,18 @@ class BP_Group_Extension {
2715
  }
2716
 
2717
  /**
2718
- * Provide a fallback for isset( $this->foo ) when foo is unavailable
2719
  *
2720
- * This magit method is here for backward compatibility with plugins
2721
  * that have set their class config options directly in the class
2722
  * constructor. The parse_legacy_properties() method of the current
2723
  * class needs to check whether any legacy keys have been put into the
2724
  * $this->data array.
2725
  *
2726
- * @since BuddyPress (1.8)
2727
- * @param string $key
2728
- * @return bool
 
2729
  */
2730
  public function __isset( $key ) {
2731
  if ( isset( $this->legacy_properties[ $key ] ) ) {
@@ -2738,16 +3556,17 @@ class BP_Group_Extension {
2738
  }
2739
 
2740
  /**
2741
- * Allow plugins to set otherwise unavailable object properties
2742
  *
2743
  * This magic method is here for backward compatibility with plugins
2744
  * that may attempt to modify the group extension by manually assigning
2745
  * a value to an object property that no longer exists, such as
2746
  * $this->enable_create_step.
2747
  *
2748
- * @since BuddyPress (1.8)
2749
- * @param string $key
2750
- * @param mixed $value
 
2751
  */
2752
  public function __set( $key, $value ) {
2753
 
@@ -2804,13 +3623,14 @@ class BP_Group_Extension {
2804
  }
2805
 
2806
  /**
2807
- * Returns a list of legacy properties
2808
  *
2809
  * The legacy implementation of BP_Group_Extension used all of these
2810
  * object properties for configuration. Some have been moved.
2811
  *
2812
- * @since BuddyPress (1.8)
2813
- * @return array
 
2814
  */
2815
  protected function get_legacy_property_list() {
2816
  return array(
@@ -2836,7 +3656,7 @@ class BP_Group_Extension {
2836
  }
2837
 
2838
  /**
2839
- * Parse legacy properties
2840
  *
2841
  * The old standard for BP_Group_Extension was for plugins to register
2842
  * their settings as properties in their constructor. The new method is
@@ -2844,7 +3664,7 @@ class BP_Group_Extension {
2844
  * legacy plugins, we slurp up legacy properties, and later on we'll
2845
  * parse them into the new init() array.
2846
  *
2847
- * @since BuddyPress (1.8)
2848
  */
2849
  protected function parse_legacy_properties() {
2850
 
@@ -2918,16 +3738,16 @@ class BP_Group_Extension {
2918
  }
2919
 
2920
  /**
2921
- * Set up legacy properties
2922
  *
2923
  * This method is responsible for ensuring that all legacy config
2924
  * properties are stored in an array $this->legacy_properties, so that
2925
  * they remain available to plugins that reference the variables at
2926
  * their old locations.
2927
  *
2928
- * @see self::__get()
2929
  *
2930
- * @since BuddyPress (1.8)
2931
  */
2932
  protected function setup_legacy_properties() {
2933
 
@@ -2996,6 +3816,12 @@ class BP_Group_Extension {
2996
  }
2997
  }
2998
 
 
 
 
 
 
 
2999
  function bp_register_group_extension( $group_extension_class = '' ) {
3000
 
3001
  if ( ! class_exists( $group_extension_class ) ) {
10
  // Exit if accessed directly
11
  if ( !defined( 'ABSPATH' ) ) exit;
12
 
13
+ /**
14
+ * BuddyPress Group object.
15
+ */
16
  class BP_Groups_Group {
17
+
18
+ /**
19
+ * ID of the group.
20
+ *
21
+ * @access public
22
+ * @var int
23
+ */
24
  public $id;
25
+
26
+ /**
27
+ * User ID of the group's creator.
28
+ *
29
+ * @access public
30
+ * @var int
31
+ */
32
  public $creator_id;
33
+
34
+ /**
35
+ * Name of the group.
36
+ *
37
+ * @access public
38
+ * @var string
39
+ */
40
  public $name;
41
+
42
+ /**
43
+ * Group slug.
44
+ *
45
+ * @access public
46
+ * @var string
47
+ */
48
  public $slug;
49
+
50
+ /**
51
+ * Group description.
52
+ *
53
+ * @access public
54
+ * @var string
55
+ */
56
  public $description;
57
+
58
+ /**
59
+ * Group status.
60
+ *
61
+ * Core statuses are 'public', 'private', and 'hidden'.
62
+ *
63
+ * @access public
64
+ * @var string
65
+ */
66
  public $status;
67
+
68
+ /**
69
+ * Should (legacy) bbPress forums be enabled for this group?
70
+ *
71
+ * @access public
72
+ * @var int
73
+ */
74
  public $enable_forum;
75
+
76
+ /**
77
+ * Date the group was created.
78
+ *
79
+ * @access public
80
+ * @var string
81
+ */
82
  public $date_created;
83
 
84
+ /**
85
+ * Data about the group's admins.
86
+ *
87
+ * @access public
88
+ * @var array
89
+ */
90
  public $admins;
91
+
92
+ /**
93
+ * Data about the group's moderators.
94
+ *
95
+ * @access public
96
+ * @var array
97
+ */
98
  public $mods;
99
+
100
+ /**
101
+ * Total count of group members.
102
+ *
103
+ * @access public
104
+ * @var int
105
+ */
106
  public $total_member_count;
107
 
108
  /**
109
  * Is the current user a member of this group?
110
  *
111
+ * @since BuddyPress (1.2.0)
112
  * @var bool
113
  */
114
  public $is_member;
132
  /**
133
  * Timestamp of the last activity that happened in this group.
134
  *
135
+ * @since BuddyPress (1.2.0)
136
  * @var string
137
  */
138
  public $last_activity;
140
  /**
141
  * If this is a private or hidden group, does the current user have access?
142
  *
143
+ * @since BuddyPress (1.6.0)
144
  * @var bool
145
  */
146
  public $user_has_access;
147
 
148
+ /**
149
+ * Constructor method.
150
+ *
151
+ * @param int $id Optional. If the ID of an existing group is provided,
152
+ * the object will be pre-populated with info about that group.
153
+ */
154
  public function __construct( $id = null ) {
155
  if ( !empty( $id ) ) {
156
  $this->id = $id;
158
  }
159
  }
160
 
161
+ /**
162
+ * Set up data about the current group.
163
+ */
164
  public function populate() {
165
  global $wpdb, $bp;
166
 
204
  }
205
  }
206
 
207
+ /**
208
+ * Save the current group to the database.
209
+ *
210
+ * @return bool True on success, false on failure.
211
+ */
212
  public function save() {
213
  global $wpdb, $bp;
214
 
280
  return true;
281
  }
282
 
283
+ /**
284
+ * Delete the current group.
285
+ *
286
+ * @return bool True on success, false on failure.
287
+ */
288
  public function delete() {
289
  global $wpdb, $bp;
290
 
312
  return true;
313
  }
314
 
315
+ /** Static Methods ****************************************************/
316
 
317
+ /**
318
+ * Get whether a group exists for a given slug.
319
+ *
320
+ * @param string $slug Slug to check.
321
+ * @param string $table_name Optional. Name of the table to check
322
+ * against. Default: $bp->groups->table_name.
323
+ * @return string|null ID of the group, if one is found, else null.
324
+ */
325
  public static function group_exists( $slug, $table_name = false ) {
326
  global $wpdb, $bp;
327
 
334
  return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$table_name} WHERE slug = %s", strtolower( $slug ) ) );
335
  }
336
 
337
+ /**
338
+ * Get the ID of a group by the group's slug.
339
+ *
340
+ * Alias of {@link BP_Groups_Group::group_exists()}.
341
+ *
342
+ * @param string $slug See {@link BP_Groups_Group::group_exists()}.
343
+ * @return string|null See {@link BP_Groups_Group::group_exists()}.
344
+ */
345
  public static function get_id_from_slug( $slug ) {
346
  return BP_Groups_Group::group_exists( $slug );
347
  }
348
 
349
+ /**
350
+ * Get IDs of users with outstanding invites to a given group from a specified user.
351
+ *
352
+ * @param int $user_id ID of the inviting user.
353
+ * @param int $group_id ID of the group.
354
+ * @return array IDs of users who have been invited to the group by the
355
+ * user but have not yet accepted.
356
+ */
357
  public static function get_invites( $user_id, $group_id ) {
358
  global $wpdb, $bp;
359
  return $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM {$bp->groups->table_name_members} WHERE group_id = %d and is_confirmed = 0 AND inviter_id = %d", $group_id, $user_id ) );
360
  }
361
 
362
+ /**
363
+ * Get a list of a user's groups, filtered by a search string.
364
+ *
365
+ * @param string $filter Search term. Matches against 'name' and
366
+ * 'description' fields.
367
+ * @param int $user_id ID of the user whose groups are being searched.
368
+ * Default: the displayed user.
369
+ * @param mixed $order Not used.
370
+ * @param int $limit Optional. The max number of results to return.
371
+ * Default: null (no limit).
372
+ * @param int $page Optional. The page offset of results to return.
373
+ * Default: null (no limit).
374
+ * @return array {
375
+ * @type array $groups Array of matched and paginated group objects.
376
+ * @type int $total Total count of groups matching the query.
377
+ * }
378
+ */
379
  public static function filter_user_groups( $filter, $user_id = 0, $order = false, $limit = null, $page = null ) {
380
  global $wpdb, $bp;
381
 
404
  }
405
 
406
  /**
407
+ * Get a list of groups, filtered by a search string.
408
+ *
409
+ * @param string $filter Search term. Matches against 'name' and
410
+ * 'description' fields.
411
+ * @param int $limit Optional. The max number of results to return.
412
+ * Default: null (no limit).
413
+ * @param int $page Optional. The page offset of results to return.
414
+ * Default: null (no limit).
415
+ * @param string $sort_by Column to sort by. Default: false (default
416
+ * sort).
417
+ * @param string $order ASC or DESC. Default: false (default sort).
418
+ * @return array {
419
+ * @type array $groups Array of matched and paginated group objects.
420
+ * @type int $total Total count of groups matching the query.
421
+ * }
422
  */
423
  public static function search_groups( $filter, $limit = null, $page = null, $sort_by = false, $order = false ) {
424
  global $wpdb, $bp;
445
  return array( 'groups' => $paged_groups, 'total' => $total_groups );
446
  }
447
 
448
+ /**
449
+ * Check for the existence of a slug.
450
+ *
451
+ * @param string $slug Slug to check.
452
+ * @return string|null The slug, if found. Otherwise null.
453
+ */
454
  public static function check_slug( $slug ) {
455
  global $wpdb, $bp;
456
 
457
  return $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM {$bp->groups->table_name} WHERE slug = %s", $slug ) );
458
  }
459
 
460
+ /**
461
+ * Get the slug for a given group ID.
462
+ *
463
+ * @param int $group_id ID of the group.
464
+ * @return string|null The slug, if found. Otherwise null.
465
+ */
466
  public static function get_slug( $group_id ) {
467
  global $wpdb, $bp;
468
 
469
  return $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM {$bp->groups->table_name} WHERE id = %d", $group_id ) );
470
  }
471
 
472
+ /**
473
+ * Check whether a given group has any members.
474
+ *
475
+ * @param int $group_id ID of the group.
476
+ * @return bool True if the group has members, otherwise false.
477
+ */
478
  public static function has_members( $group_id ) {
479
  global $wpdb, $bp;
480
 
486
  return true;
487
  }
488
 
489
+ /**
490
+ * Check whether a group has outstanding membership requests.
491
+ *
492
+ * @param int $group_id ID of the group.
493
+ * @return int|null The number of outstanding requests, or null if
494
+ * none are found.
495
+ */
496
  public static function has_membership_requests( $group_id ) {
497
  global $wpdb, $bp;
498
 
499
  return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 0", $group_id ) );
500
  }
501
 
502
+ /**
503
+ * Get outstanding membership requests for a group.
504
+ *
505
+ * @param int $group_id ID of the group.
506
+ * @param int $limit Optional. Max number of results to return.
507
+ * Default: null (no limit).
508
+ * @param int $page Optional. Page offset of results returned. Default:
509
+ * null (no limit).
510
+ * @return array {
511
+ * @type array $requests The requested page of located requests.
512
+ * @type int $total Total number of requests outstanding for the
513
+ * group.
514
+ * }
515
+ */
516
  public static function get_membership_requests( $group_id, $limit = null, $page = null ) {
517
  global $wpdb, $bp;
518
 
526
  return array( 'requests' => $paged_requests, 'total' => $total_requests );
527
  }
528
 
529
+ /**
530
+ * Query for groups.
531
+ *
532
+ * @see WP_Meta_Query::queries for a description of the 'meta_query'
533
+ * parameter format.
534
+ *
535
+ * @param array {
536
+ * Array of parameters. All items are optional.
537
+ * @type string $type Optional. Shorthand for certain orderby/
538
+ * order combinations. 'newest', 'active', 'popular',
539
+ * 'alphabetical', 'random'. When present, will override
540
+ * orderby and order params. Default: null.
541
+ * @type string $orderby Optional. Property to sort by.
542
+ * 'date_created', 'last_activity', 'total_member_count',
543
+ * 'name', 'random'. Default: 'date_created'.
544
+ * @type string $order Optional. Sort order. 'ASC' or 'DESC'.
545
+ * Default: 'DESC'.
546
+ * @type int $per_page Optional. Number of items to return per page
547
+ * of results. Default: null (no limit).
548
+ * @type int $page Optional. Page offset of results to return.
549
+ * Default: null (no limit).
550
+ * @type int $user_id Optional. If provided, results will be limited
551
+ * to groups of which the specified user is a member. Default:
552
+ * null.
553
+ * @type string $search_terms Optional. If provided, only groups
554
+ * whose names or descriptions match the search terms will be
555
+ * returned. Default: false.
556
+ * @type array $meta_query Optional. An array of meta_query
557
+ * conditions. See {@link WP_Meta_Query::queries} for
558
+ * description.
559
+ * @type array|string Optional. Array or comma-separated list of
560
+ * group IDs. Results will be limited to groups within the
561
+ * list. Default: false.
562
+ * @type bool $populate_extras Whether to fetch additional
563
+ * information (such as member count) about groups. Default:
564
+ * true.
565
+ * @type array|string Optional. Array or comma-separated list of
566
+ * group IDs. Results will exclude the listed groups.
567
+ * Default: false.
568
+ * @type bool $show_hidden Whether to include hidden groups in
569
+ * results. Default: false.
570
+ * }
571
+ * @return array {
572
+ * @type array $groups Array of group objects returned by the
573
+ * paginated query.
574
+ * @type int $total Total count of all groups matching non-
575
+ * paginated query params.
576
+ * }
577
+ */
578
  public static function get( $args = array() ) {
579
  global $wpdb, $bp;
580
 
789
  * WP_Query, we have to alter the return value (stripping the leading
790
  * AND keyword from the 'where' clause).
791
  *
792
+ * @since BuddyPress (1.8.0)
793
  * @access protected
794
  *
795
  * @param array $meta_query An array of meta_query filters. See the
796
+ * documentation for {@link WP_Meta_Query} for details.
797
+ * @return array $sql_array 'join' and 'where' clauses.
798
  */
799
  protected static function get_meta_query_sql( $meta_query = array() ) {
800
  global $wpdb;
841
  }
842
 
843
  /**
844
+ * Convert the 'type' parameter to 'order' and 'orderby'.
845
  *
846
+ * @since BuddyPress (1.8.0)
847
  * @access protected
848
+ *
849
+ * @param string $type The 'type' shorthand param.
850
+ * @return array {
851
+ * @type string $order SQL-friendly order string.
852
+ * @type string $orderby SQL-friendly orderby column name.
853
+ * }
854
  */
855
  protected static function convert_type_to_order_orderby( $type = '' ) {
856
  $order = $orderby = '';
886
  }
887
 
888
  /**
889
+ * Convert the 'orderby' param into a proper SQL term/column.
890
  *
891
+ * @since BuddyPress (1.8.0)
892
  * @access protected
893
+ *
894
+ * @param string $orderby Orderby term as passed to get().
895
+ * @return string $order_by_term SQL-friendly orderby term.
896
  */
897
  protected static function convert_orderby_to_order_by_term( $orderby ) {
898
  $order_by_term = '';
923
  return $order_by_term;
924
  }
925
 
926
+ /**
927
+ * Get a list of groups, sorted by those that have the most legacy forum topics.
928
+ *
929
+ * @param int $limit Optional. The max number of results to return.
930
+ * Default: null (no limit).
931
+ * @param int $page Optional. The page offset of results to return.
932
+ * Default: null (no limit).
933
+ * @param int $user_id Optional. If present, groups will be limited to
934
+ * those of which the specified user is a member.
935
+ * @param string $search_terms Optional. Limit groups to those whose
936
+ * name or description field contain the search string.
937
+ * @param bool $populate_extras Optional. Whether to fetch extra
938
+ * information about the groups. Default: true.
939
+ * @param string|array Optional. Array or comma-separated list of group
940
+ * IDs to exclude from results.
941
+ * @return array {
942
+ * @type array $groups Array of group objects returned by the
943
+ * paginated query.
944
+ * @type int $total Total count of all groups matching non-
945
+ * paginated query params.
946
+ * }
947
+ */
948
  public static function get_by_most_forum_topics( $limit = null, $page = null, $user_id = 0, $search_terms = false, $populate_extras = true, $exclude = false ) {
949
  global $wpdb, $bp, $bbdb;
950
 
987
  return array( 'groups' => $paged_groups, 'total' => $total_groups );
988
  }
989
 
990
+ /**
991
+ * Get a list of groups, sorted by those that have the most legacy forum posts.
992
+ *
993
+ * @param int $limit Optional. The max number of results to return.
994
+ * Default: null (no limit).
995
+ * @param int $page Optional. The page offset of results to return.
996
+ * Default: null (no limit).
997
+ * @param int $user_id Optional. If present, groups will be limited to
998
+ * those of which the specified user is a member.
999
+ * @param string $search_terms Optional. Limit groups to those whose
1000
+ * name or description field contain the search string.
1001
+ * @param bool $populate_extras Optional. Whether to fetch extra
1002
+ * information about the groups. Default: true.
1003
+ * @param string|array Optional. Array or comma-separated list of group
1004
+ * IDs to exclude from results.
1005
+ * @return array {
1006
+ * @type array $groups Array of group objects returned by the
1007
+ * paginated query.
1008
+ * @type int $total Total count of all groups matching non-
1009
+ * paginated query params.
1010
+ * }
1011
+ */
1012
  public static function get_by_most_forum_posts( $limit = null, $page = null, $search_terms = false, $populate_extras = true, $exclude = false ) {
1013
  global $wpdb, $bp, $bbdb;
1014
 
1051
  return array( 'groups' => $paged_groups, 'total' => $total_groups );
1052
  }
1053
 
1054
+ /**
1055
+ * Get a list of groups whose names start with a given letter.
1056
+ *
1057
+ * @param string $letter The letter.
1058
+ * @param int $limit Optional. The max number of results to return.
1059
+ * Default: null (no limit).
1060
+ * @param int $page Optional. The page offset of results to return.
1061
+ * Default: null (no limit).
1062
+ * @param bool $populate_extras Optional. Whether to fetch extra
1063
+ * information about the groups. Default: true.
1064
+ * @param string|array Optional. Array or comma-separated list of group
1065
+ * IDs to exclude from results.
1066
+ * @return array {
1067
+ * @type array $groups Array of group objects returned by the
1068
+ * paginated query.
1069
+ * @type int $total Total count of all groups matching non-
1070
+ * paginated query params.
1071
+ * }
1072
+ */
1073
  public static function get_by_letter( $letter, $limit = null, $page = null, $populate_extras = true, $exclude = false ) {
1074
  global $wpdb, $bp;
1075
 
1114
  return array( 'groups' => $paged_groups, 'total' => $total_groups );
1115
  }
1116
 
1117
+ /**
1118
+ * Get a list of random groups.
1119
+ *
1120
+ * Use BP_Groups_Group::get() with 'type' = 'random' instead.
1121
+ *
1122
+ * @param int $limit Optional. The max number of results to return.
1123
+ * Default: null (no limit).
1124
+ * @param int $page Optional. The page offset of results to return.
1125
+ * Default: null (no limit).
1126
+ * @param int $user_id Optional. If present, groups will be limited to
1127
+ * those of which the specified user is a member.
1128
+ * @param string $search_terms Optional. Limit groups to those whose
1129
+ * name or description field contain the search string.
1130
+ * @param bool $populate_extras Optional. Whether to fetch extra
1131
+ * information about the groups. Default: true.
1132
+ * @param string|array Optional. Array or comma-separated list of group
1133
+ * IDs to exclude from results.
1134
+ * @return array {
1135
+ * @type array $groups Array of group objects returned by the
1136
+ * paginated query.
1137
+ * @type int $total Total count of all groups matching non-
1138
+ * paginated query params.
1139
+ * }
1140
+ */
1141
  public static function get_random( $limit = null, $page = null, $user_id = 0, $search_terms = false, $populate_extras = true, $exclude = false ) {
1142
  global $wpdb, $bp;
1143
 
1179
  return array( 'groups' => $paged_groups, 'total' => $total_groups );
1180
  }
1181
 
1182
+ /**
1183
+ * Fetch extra data for a list of groups.
1184
+ *
1185
+ * This method is used throughout the class, by methods that take a
1186
+ * $populate_extras parameter.
1187
+ *
1188
+ * Data fetched:
1189
+ *
1190
+ * - Logged-in user's status within each group (is_member,
1191
+ * is_confirmed, is_pending, is_banned)
1192
+ *
1193
+ * @param array $paged_groups Array of groups.
1194
+ * @param string|array Array or comma-separated list of IDs matching
1195
+ * $paged_groups.
1196
+ * @param string $type Not used.
1197
+ * @return array $paged_groups
1198
+ */
1199
  public static function get_group_extras( &$paged_groups, &$group_ids, $type = false ) {
1200
  global $bp, $wpdb;
1201
 
1253
  return $paged_groups;
1254
  }
1255
 
1256
+ /**
1257
+ * Delete all invitations to a given group.
1258
+ *
1259
+ * @param int $group_id ID of the group whose invitations are being
1260
+ * deleted.
1261
+ * @return int|null Number of rows records deleted on success, null on
1262
+ * failure.
1263
+ */
1264
  public static function delete_all_invites( $group_id ) {
1265
  global $wpdb, $bp;
1266
 
1267
  return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE group_id = %d AND invite_sent = 1", $group_id ) );
1268
  }
1269
 
1270
+ /**
1271
+ * Get a total group count for the site.
1272
+ *
1273
+ * Will include hidden groups in the count only if
1274
+ * current_user_can( 'bp_moderate' ).
1275
+ *
1276
+ * @return int Group count.
1277
+ */
1278
  public static function get_total_group_count() {
1279
  global $wpdb, $bp;
1280
 
1285
  return $wpdb->get_var( "SELECT COUNT(id) FROM {$bp->groups->table_name} {$hidden_sql}" );
1286
  }
1287
 
1288
+ /**
1289
+ * Get global count of forum topics in public groups (legacy forums).
1290
+ *
1291
+ * @param $type Optional. If 'unreplied', count will be limited to
1292
+ * those topics that have received no replies.
1293
+ * @return int Forum topic count.
1294
+ */
1295
  public static function get_global_forum_topic_count( $type ) {
1296
  global $bbdb, $wpdb, $bp;
1297
 
1308
  return $wpdb->get_var( "SELECT COUNT(t.topic_id) FROM {$bbdb->topics} AS t, {$bp->groups->table_name} AS g LEFT JOIN {$bp->groups->table_name_groupmeta} AS gm ON g.id = gm.group_id WHERE (gm.meta_key = 'forum_id' AND gm.meta_value = t.forum_id) AND g.status = 'public' AND t.topic_status = '0' AND t.topic_sticky != '2' {$extra_sql} " );
1309
  }
1310
 
1311
+ /**
1312
+ * Get the member count for a group.
1313
+ *
1314
+ * @param int $group_id Group ID.
1315
+ * @return int Count of confirmed members for the group.
1316
+ */
1317
  public static function get_total_member_count( $group_id ) {
1318
  global $wpdb, $bp;
1319
 
1323
  /**
1324
  * Get a total count of all topics of a given status, across groups/forums
1325
  *
1326
+ * @since BuddyPress (1.5.0)
 
1327
  *
1328
+ * @param string $status Which group type to count. 'public', 'private',
1329
+ * 'hidden', or 'all'. Default: 'public'.
1330
  * @return int The topic count
1331
  */
1332
  public static function get_global_topic_count( $status = 'public', $search_terms = false ) {
1366
  }
1367
 
1368
  /**
1369
+ * Get an array containing ids for each group type.
1370
  *
1371
  * A bit of a kludge workaround for some issues
1372
+ * with bp_has_groups().
1373
  *
1374
+ * @since BuddyPress (1.7.0)
1375
  *
1376
  * @return array
1377
  */
1390
  }
1391
 
1392
  /**
1393
+ * Query for the members of a group.
1394
  *
1395
+ * @since BuddyPress (1.8.0)
1396
  */
1397
  class BP_Group_Member_Query extends BP_User_Query {
1398
+
1399
  /**
1400
+ * Array of group member ids, cached to prevent redundant lookups.
1401
  *
 
1402
  * @since BuddyPress (1.8.1)
1403
+ * @var null|array Null if not yet defined, otherwise an array of ints.
1404
  */
1405
  protected $group_member_ids;
1406
 
1407
  /**
1408
+ * Set up action hooks.
1409
  *
1410
+ * @since BuddyPress (1.8.0)
1411
  */
1412
  public function setup_hooks() {
1413
  // Take this early opportunity to set the default 'type' param
1425
  }
1426
 
1427
  /**
1428
+ * Get a list of user_ids to include in the IN clause of the main query.
1429
  *
1430
  * Overrides BP_User_Query::get_include_ids(), adding our additional
1431
  * group-member logic.
1432
  *
1433
+ * @since BuddyPress (1.8.0)
1434
+ *
1435
+ * @param array $include Existing group IDs in the $include parameter,
1436
+ * as calculated in BP_User_Query.
1437
  * @return array
1438
  */
1439
  public function get_include_ids( $include = array() ) {
1464
  }
1465
 
1466
  /**
1467
+ * Get the members of the queried group.
1468
  *
1469
+ * @since BuddyPress (1.8.0)
1470
+ *
1471
+ * @return array $ids User IDs of relevant group member ids.
1472
  */
1473
  protected function get_group_member_ids() {
1474
  global $wpdb;
1561
  }
1562
 
1563
  /**
1564
+ * Tell BP_User_Query to order by the order of our query results.
1565
  *
1566
  * This implementation assumes the 'last_modified' sort order
1567
  * hardcoded in BP_Group_Member_Query::get_group_member_ids().
1568
  *
1569
+ * @param BP_User_Query $query BP_User_Query object.
1570
  */
1571
  public function set_orderby( $query ) {
1572
  $gm_ids = $this->get_group_member_ids();
1586
  }
1587
 
1588
  /**
1589
+ * Fetch additional data required in bp_group_has_members() loops.
1590
+ *
1591
+ * Additional data fetched:
1592
+ *
1593
+ * - is_banned
1594
+ * - date_modified
1595
+ *
1596
+ * @since BuddyPress (1.8.0)
1597
  *
 
1598
  * @param object $query BP_User_Query object. Because we're filtering
1599
  * the current object, we use $this inside of the method instead
1600
  * @param string $user_ids_sql Sanitized, comma-separated string of
1620
  }
1621
  }
1622
 
1623
+ /**
1624
+ * BuddyPress Group Membership objects.
1625
+ */
1626
  class BP_Groups_Member {
1627
+
1628
+ /**
1629
+ * ID of the membership.
1630
+ *
1631
+ * @access public
1632
+ * @var int
1633
+ */
1634
  var $id;
1635
+
1636
+ /**
1637
+ * ID of the group associated with the membership.
1638
+ *
1639
+ * @access public
1640
+ * @var int
1641
+ */
1642
  var $group_id;
1643
+
1644
+ /**
1645
+ * ID of the user associated with the membership.
1646
+ *
1647
+ * @access public
1648
+ * @var int
1649
+ */
1650
  var $user_id;
1651
+
1652
+ /**
1653
+ * ID of the user whose invitation initiated the membership.
1654
+ *
1655
+ * @access public
1656
+ * @var int
1657
+ */
1658
  var $inviter_id;
1659
+
1660
+ /**
1661
+ * Whether the member is an admin of the group.
1662
+ *
1663
+ * @access public
1664
+ * @var int
1665
+ */
1666
  var $is_admin;
1667
+
1668
+ /**
1669
+ * Whether the member is a mod of the group.
1670
+ *
1671
+ * @access public
1672
+ * @var int
1673
+ */
1674
  var $is_mod;
1675
+
1676
+ /**
1677
+ * Whether the member is banned from the group.
1678
+ *
1679
+ * @access public
1680
+ * @var int
1681
+ */
1682
  var $is_banned;
1683
+
1684
+ /**
1685
+ * Title used to describe the group member's role in the group.
1686
+ *
1687
+ * Eg, 'Group Admin'.
1688
+ *
1689
+ * @access public
1690
+ * @var int
1691
+ */
1692
  var $user_title;
1693
+
1694
+ /**
1695
+ * Last modified date of the membership.
1696
+ *
1697
+ * This value is updated when, eg, invitations are accepted.
1698
+ *
1699
+ * @access public
1700
+ * @var string
1701
+ */
1702
  var $date_modified;
1703
+
1704
+ /**
1705
+ * Whether the membership has been confirmed.
1706
+ *
1707
+ * @access public
1708
+ * @var int
1709
+ */
1710
  var $is_confirmed;
1711
+
1712
+ /**
1713
+ * Comments associated with the membership.
1714
+ *
1715
+ * In BP core, these are limited to the optional message users can
1716
+ * include when requesting membership to a private group.
1717
+ *
1718
+ * @access public
1719
+ * @var string
1720
+ */
1721
  var $comments;
1722
+
1723
+ /**
1724
+ * Whether an invitation has been sent for this membership.
1725
+ *
1726
+ * The purpose of this flag is to mark when an invitation has been
1727
+ * "drafted" (the user has been added via the interface at Send
1728
+ * Invites), but the Send button has not been pressed, so the
1729
+ * invitee has not yet been notified.
1730
+ *
1731
+ * @access public
1732
+ * @var int
1733
+ */
1734
  var $invite_sent;
1735
+
1736
+ /**
1737
+ * WP_User object representing the membership's user.
1738
+ *
1739
+ * @access public
1740
+ * @var WP_User
1741
+ */
1742
  var $user;
1743
 
1744
+ /**
1745
+ * Constructor method.
1746
+ *
1747
+ * @param int $user_id Optional. Along with $group_id, can be used to
1748
+ * look up a membership.
1749
+ * @param int $group_id Optional. Along with $user_id, can be used to
1750
+ * look up a membership.
1751
+ * @param int $id Optional. The unique ID of the membership object.
1752
+ * @param bool $populate Whether to populate the properties of the
1753
+ * located membership. Default: true.
1754
+ */
1755
  public function __construct( $user_id = 0, $group_id = 0, $id = false, $populate = true ) {
1756
 
1757
  // User and group are not empty, and ID is
1774
  }
1775
  }
1776
 
1777
+ /**
1778
+ * Populate the object's properties.
1779
+ */
1780
  public function populate() {
1781
  global $wpdb, $bp;
1782
 
1806
  }
1807
  }
1808
 
1809
+ /**
1810
+ * Save the membership data to the database.
1811
+ *
1812
+ * @return bool True on success, false on failure.
1813
+ */
1814
  public function save() {
1815
  global $wpdb, $bp;
1816
 
1855
  return true;
1856
  }
1857
 
1858
+ /**
1859
+ * Promote a member to a new status.
1860
+ *
1861
+ * @param string $status The new status. 'mod' or 'admin'.
1862
+ * @return bool True on success, false on failure.
1863
+ */
1864
  public function promote( $status = 'mod' ) {
1865
  if ( 'mod' == $status ) {
1866
  $this->is_admin = 0;
1877
  return $this->save();
1878
  }
1879
 
1880
+ /**
1881
+ * Demote membership to Member status (non-admin, non-mod).
1882
+ *
1883
+ * @return bool True on success, false on failure.
1884
+ */
1885
  public function demote() {
1886
  $this->is_mod = 0;
1887
  $this->is_admin = 0;
1890
  return $this->save();
1891
  }
1892
 
1893
+ /**
1894
+ * Ban the user from the group.
1895
+ *
1896
+ * @return bool True on success, false on failure.
1897
+ */
1898
  public function ban() {
1899
  if ( !empty( $this->is_admin ) )
1900
  return false;
1905
  return $this->save();
1906
  }
1907
 
1908
+ /**
1909
+ * Unban the user from the group.
1910
+ *
1911
+ * @return bool True on success, false on failure.
1912
+ */
1913
  public function unban() {
1914
  if ( !empty( $this->is_admin ) )
1915
  return false;
1919
  return $this->save();
1920
  }
1921
 
1922
+ /**
1923
+ * Mark a pending invitation as accepted.
1924
+ */
1925
  public function accept_invite() {
1926
  $this->inviter_id = 0;
1927
  $this->is_confirmed = 1;
1928
  $this->date_modified = bp_core_current_time();
1929
  }
1930
 
1931
+ /**
1932
+ * Confirm a membership request.
1933
+ */
1934
  public function accept_request() {
1935
  $this->is_confirmed = 1;
1936
  $this->date_modified = bp_core_current_time();
1937
  }
1938
 
1939
+ /**
1940
+ * Remove the current membership.
1941
+ *
1942
+ * @return bool True on success, false on failure.
1943
+ */
1944
  public function remove() {
1945
  global $wpdb, $bp;
1946
 
1958
  return $result;
1959
  }
1960
 
1961
+ /** Static Methods ****************************************************/
1962
 
1963
  /**
1964
+ * Refresh the total_group_count for a user.
1965
  *
1966
+ * @since BuddyPress (1.8.0)
1967
+ *
1968
+ * @param int $user_id ID of the user.
1969
+ * @return bool True on success, false on failure.
1970
  */
1971
  public static function refresh_total_group_count_for_user( $user_id ) {
1972
  return bp_update_user_meta( $user_id, 'total_group_count', (int) self::total_group_count( $user_id ) );
1973
  }
1974
 
1975
  /**
1976
+ * Refresh the total_member_count for a group.
1977
  *
1978
+ * @since BuddyPress (1.8.0)
1979
+ *
1980
+ * @param int $group_id ID of the group.
1981
+ * @return bool True on success, false on failure.
1982
  */
1983
  public static function refresh_total_member_count_for_group( $group_id ) {
1984
  return groups_update_groupmeta( $group_id, 'total_member_count', (int) BP_Groups_Group::get_total_member_count( $group_id ) );
1985
  }
1986
 
1987
+ /**
1988
+ * Delete a membership, based on user + group IDs.
1989
+ *
1990
+ * @param int $user_id ID of the user.
1991
+ * @param int $group_id ID of the group.
1992
+ * @return True on success, false on failure.
1993
+ */
1994
  public static function delete( $user_id, $group_id ) {
1995
  global $wpdb, $bp;
1996
 
2005
  return $remove;
2006
  }
2007
 
2008
+ /**
2009
+ * Get the IDs of the groups of which a specified user is a member.
2010
+ *
2011
+ * @param int $user_id ID of the user.
2012
+ * @param int $limit Optional. Max number of results to return.
2013
+ * Default: false (no limit).
2014
+ * @param int $page Optional. Page offset of results to return.
2015
+ * Default: false (no limit).
2016
+ * @return array {
2017
+ * @type array $groups Array of groups returned by paginated query.
2018
+ * @type int $total Count of groups matching query.
2019
+ * }
2020
+ */
2021
  public static function get_group_ids( $user_id, $limit = false, $page = false ) {
2022
  global $wpdb, $bp;
2023
 
2039
  return array( 'groups' => $groups, 'total' => (int) $total_groups );
2040
  }
2041
 
2042
+ /**
2043
+ * Get the IDs of the groups of which a specified user is a member, sorted by the date joined.
2044
+ *
2045
+ * @param int $user_id ID of the user.
2046
+ * @param int $limit Optional. Max number of results to return.
2047
+ * Default: false (no limit).
2048
+ * @param int $page Optional. Page offset of results to return.
2049
+ * Default: false (no limit).
2050
+ * @param string $filter Optional. Limit results to groups whose name or
2051
+ * description field matches search terms.
2052
+ * @return array {
2053
+ * @type array $groups Array of groups returned by paginated query.
2054
+ * @type int $total Count of groups matching query.
2055
+ * }
2056
+ */
2057
  public static function get_recently_joined( $user_id, $limit = false, $page = false, $filter = false ) {
2058
  global $wpdb, $bp;
2059
 
2076
  return array( 'groups' => $paged_groups, 'total' => $total_groups );
2077
  }
2078
 
2079
+ /**
2080
+ * Get the IDs of the groups of which a specified user is an admin.
2081
+ *
2082
+ * @param int $user_id ID of the user.
2083
+ * @param int $limit Optional. Max number of results to return.
2084
+ * Default: false (no limit).
2085
+ * @param int $page Optional. Page offset of results to return.
2086
+ * Default: false (no limit).
2087
+ * @param string $filter Optional. Limit results to groups whose name or
2088
+ * description field matches search terms.
2089
+ * @return array {
2090
+ * @type array $groups Array of groups returned by paginated query.
2091
+ * @type int $total Count of groups matching query.
2092
+ * }
2093
+ */
2094
  public static function get_is_admin_of( $user_id, $limit = false, $page = false, $filter = false ) {
2095
  global $wpdb, $bp;
2096
 
2113
  return array( 'groups' => $paged_groups, 'total' => $total_groups );
2114
  }
2115
 
2116
+ /**
2117
+ * Get the IDs of the groups of which a specified user is a moderator.
2118
+ *
2119
+ * @param int $user_id ID of the user.
2120
+ * @param int $limit Optional. Max number of results to return.
2121
+ * Default: false (no limit).
2122
+ * @param int $page Optional. Page offset of results to return.
2123
+ * Default: false (no limit).
2124
+ * @param string $filter Optional. Limit results to groups whose name or
2125
+ * description field matches search terms.
2126
+ * @return array {
2127
+ * @type array $groups Array of groups returned by paginated query.
2128
+ * @type int $total Count of groups matching query.
2129
+ * }
2130
+ */
2131
  public static function get_is_mod_of( $user_id, $limit = false, $page = false, $filter = false ) {
2132
  global $wpdb, $bp;
2133
 
2150
  return array( 'groups' => $paged_groups, 'total' => $total_groups );
2151
  }
2152
 
2153
+ /**
2154
+ * Get the count of groups of which the specified user is a member.
2155
+ *
2156
+ * @param int $user_id Optional. Default: ID of the displayed user.
2157
+ * @return int Group count.
2158
+ */
2159
  public static function total_group_count( $user_id = 0 ) {
2160
  global $bp, $wpdb;
2161
 
2169
  }
2170
  }
2171
 
2172
+ /**
2173
+ * Get a user's outstanding group invitations.
2174
+ *
2175
+ * @param int $user_id ID of the invitee.
2176
+ * @param int $limit Optional. Max number of results to return.
2177
+ * Default: false (no limit).
2178
+ * @param int $page Optional. Page offset of results to return.
2179
+ * Default: false (no limit).
2180
+ * @param string|array $exclude Optional. Array or comma-separated list
2181
+ * of group IDs to exclude from results.
2182
+ * @return array {
2183
+ * @type array $groups Array of groups returned by paginated query.
2184
+ * @type int $total Count of groups matching query.
2185
+ * }
2186
+ */
2187
  public static function get_invites( $user_id, $limit = false, $page = false, $exclude = false ) {
2188
  global $wpdb, $bp;
2189
 
2202
  return array( 'groups' => $paged_groups, 'total' => $total_groups );
2203
  }
2204
 
2205
+ /**
2206
+ * Check whether a user has an outstanding invitation to a given group.
2207
+ *
2208
+ * @param int $user_id ID of the potential invitee.
2209
+ * @param int $group_id ID of the group.
2210
+ * @param string $type If 'sent', results are limited to those
2211
+ * invitations that have actually been sent (non-draft).
2212
+ * Default: 'sent'.
2213
+ * @return int|null The ID of the invitation if found, otherwise null.
2214
+ */
2215
  public static function check_has_invite( $user_id, $group_id, $type = 'sent' ) {
2216
  global $wpdb, $bp;
2217
 
2226
  return $wpdb->get_var( $wpdb->prepare( $sql, $user_id, $group_id ) );
2227
  }
2228
 
2229
+ /**
2230
+ * Delete an invitation, by specifying user ID and group ID.
2231
+ *
2232
+ * @param int $user_id ID of the user.
2233
+ * @param int $group_id ID of the group.
2234
+ * @return int Number of records deleted.
2235
+ */
2236
  public static function delete_invite( $user_id, $group_id ) {
2237
  global $wpdb, $bp;
2238
 
2242
  return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND inviter_id != 0 AND invite_sent = 1", $user_id, $group_id ) );
2243
  }
2244
 
2245
+ /**
2246
+ * Delete an unconfirmed membership request, by user ID and group ID.
2247
+ *
2248
+ * @param int $user_id ID of the user.
2249
+ * @param int $group_id ID of the group.
2250
+ * @return int Number of records deleted.
2251
+ */
2252
  public static function delete_request( $user_id, $group_id ) {
2253
  global $wpdb, $bp;
2254
 
2258
  return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND inviter_id = 0 AND invite_sent = 0", $user_id, $group_id ) );
2259
  }
2260
 
2261
+ /**
2262
+ * Check whether a user is an admin of a given group.
2263
+ *
2264
+ * @param int $user_id ID of the user.
2265
+ * @param int $group_id ID of the group.
2266
+ * @param int|null ID of the membership if the user is an admin,
2267
+ * otherwise null.
2268
+ */
2269
  public static function check_is_admin( $user_id, $group_id ) {
2270
  global $wpdb, $bp;
2271
 
2275
  return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_admin = 1 AND is_banned = 0", $user_id, $group_id ) );
2276
  }
2277
 
2278
+ /**
2279
+ * Check whether a user is a mod of a given group.
2280
+ *
2281
+ * @param int $user_id ID of the user.
2282
+ * @param int $group_id ID of the group.
2283
+ * @param int|null ID of the membership if the user is a mod,
2284
+ * otherwise null.
2285
+ */
2286
  public static function check_is_mod( $user_id, $group_id ) {
2287
  global $wpdb, $bp;
2288
 
2292
  return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_mod = 1 AND is_banned = 0", $user_id, $group_id ) );
2293
  }
2294
 
2295
+ /**
2296
+ * Check whether a user is a member of a given group.
2297
+ *
2298
+ * @param int $user_id ID of the user.
2299
+ * @param int $group_id ID of the group.
2300
+ * @param int|null ID of the membership if the user is a member,
2301
+ * otherwise null.
2302
+ */
2303
  public static function check_is_member( $user_id, $group_id ) {
2304
  global $wpdb, $bp;
2305
 
2309
  return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 1 AND is_banned = 0", $user_id, $group_id ) );
2310
  }
2311
 
2312
+ /**
2313
+ * Check whether a user is banned from a given group.
2314
+ *
2315
+ * @param int $user_id ID of the user.
2316
+ * @param int $group_id ID of the group.
2317
+ * @param int|null ID of the membership if the user is banned,
2318
+ * otherwise null.
2319
+ */
2320
  public static function check_is_banned( $user_id, $group_id ) {
2321
  global $wpdb, $bp;
2322
 
2329
  /**
2330
  * Is the specified user the creator of the group?
2331
  *
 
 
 
 
2332
  * @since BuddyPress (1.2.6)
2333
+ *
2334
+ * @param int $user_id ID of the user.
2335
+ * @param int $group_id ID of the group.
2336
+ * @return int|null ID of the group if the user is the creator,
2337
+ * otherwise false.
2338
  */
2339
  public static function check_is_creator( $user_id, $group_id ) {
2340
  global $bp, $wpdb;
2345
  return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name} WHERE creator_id = %d AND id = %d", $user_id, $group_id ) );
2346
  }
2347
 
2348
+ /**
2349
+ * Check whether a user has an outstanding membership request for a given group.
2350
+ *
2351
+ * @param int $user_id ID of the user.
2352
+ * @param int $group_id ID of the group.
2353
+ * @return int|null ID of the membership if found, otherwise false.
2354
+ */
2355
  public static function check_for_membership_request( $user_id, $group_id ) {
2356
  global $wpdb, $bp;
2357
 
2361
  return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND is_banned = 0 AND inviter_id = 0", $user_id, $group_id ) );
2362
  }
2363
 
2364
+ /**
2365
+ * Get a list of randomly selected IDs of groups that the member belongs to.
2366
+ *
2367
+ * @param int $user_id ID of the user.
2368
+ * @param int $total_groups Max number of group IDs to return. Default: 5.
2369
+ * @return array Group IDs.
2370
+ */
2371
  public static function get_random_groups( $user_id = 0, $total_groups = 5 ) {
2372
  global $wpdb, $bp;
2373
 
2379
  }
2380
  }
2381
 
2382
+ /**
2383
+ * Get the IDs of all a given group's members.
2384
+ *
2385
+ * @param int $group_id ID of the group.
2386
+ * @return array IDs of all group members.
2387
+ */
2388
  public static function get_group_member_ids( $group_id ) {
2389
  global $bp, $wpdb;
2390
 
2391
  return $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 AND is_banned = 0", $group_id ) );
2392
  }
2393
 
2394
+ /**
2395
+ * Get a list of all a given group's admins.
2396
+ *
2397
+ * @param int $group_id ID of the group.
2398
+ * @return array Info about group admins (user_id + date_modified).
2399
+ */
2400
  public static function get_group_administrator_ids( $group_id ) {
2401
  global $bp, $wpdb;
2402
 
2403
  return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_admin = 1 AND is_banned = 0", $group_id ) );
2404
  }
2405
 
2406
+ /**
2407
+ * Get a list of all a given group's moderators.
2408
+ *
2409
+ * @param int $group_id ID of the group.
2410
+ * @return array Info about group mods (user_id + date_modified).
2411
+ */
2412
  public static function get_group_moderator_ids( $group_id ) {
2413
  global $bp, $wpdb;
2414
 
2415
  return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_mod = 1 AND is_banned = 0", $group_id ) );
2416
  }
2417
 
2418
+ /**
2419
+ * Get the IDs users with outstanding membership requests to the group.
2420
+ *
2421
+ * @param int $group_id ID of the group.
2422
+ * @return array IDs of users with outstanding membership requests.
2423
+ */
2424
  public static function get_all_membership_request_user_ids( $group_id ) {
2425
  global $bp, $wpdb;
2426
 
2427
  return $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 0 AND inviter_id = 0", $group_id ) );
2428
  }
2429
 
2430
+ /**
2431
+ * Get members of a group.
2432
+ *
2433
+ * @deprecated BuddyPress (1.8.0)
2434
+ */
2435
  public static function get_all_for_group( $group_id, $limit = false, $page = false, $exclude_admins_mods = true, $exclude_banned = true, $exclude = false ) {
2436
  global $bp, $wpdb;
2437
 
2491
  return array( 'members' => $members, 'count' => $total_member_count );
2492
  }
2493
 
2494
+ /**
2495
+ * Delete all memberships for a given group.
2496
+ *
2497
+ * @param int $group_id ID of the group.
2498
+ * @return int Number of records deleted.
2499
+ */
2500
  public static function delete_all( $group_id ) {
2501
  global $wpdb, $bp;
2502
 
2504
  }
2505
 
2506
  /**
2507
+ * Delete all group membership information for the specified user.
2508
+ *
2509
+ * @since BuddyPress (1.0.0)
2510
  *
2511
+ * @param int $user_id ID of the user.
 
 
 
 
2512
  */
2513
  public static function delete_all_for_user( $user_id ) {
2514
  global $bp, $wpdb;
2601
  *
2602
  * @package BuddyPress
2603
  * @subpackage Groups
2604
+ * @since BuddyPress (1.1.0)
2605
  */
2606
  class BP_Group_Extension {
2607
 
2608
+ /** Public ************************************************************/
2609
 
2610
  /**
2611
+ * Information about this extension's screens.
2612
+ *
2613
+ * @since BuddyPress (1.8.0)
2614
+ * @var array
2615
  */
2616
  public $screens = array();
2617
 
2618
  /**
2619
+ * The name of the extending class.
2620
+ *
2621
+ * @since BuddyPress (1.8.0)
2622
+ * @var string
2623
  */
2624
  public $class_name = '';
2625
 
2626
  /**
2627
+ * A ReflectionClass object of the current extension.
2628
+ *
2629
+ * @since BuddyPress (1.8.0)
2630
+ * @var ReflectionClass
2631
  */
2632
  public $class_reflection = null;
2633
 
2634
  /**
2635
+ * Parsed configuration paramaters for the extension.
2636
+ *
2637
+ * @since BuddyPress (1.8.0)
2638
+ * @var array
2639
  */
2640
  public $params = array();
2641
 
2642
  /**
2643
+ * The ID of the current group.
2644
+ *
2645
+ * @since BuddyPress (1.8.0)
2646
+ * @var int
2647
  */
2648
  public $group_id = 0;
2649
 
2650
  /**
2651
+ * The slug of the current extension.
2652
+ *
2653
+ * @var string
2654
  */
2655
  public $slug = '';
2656
 
2657
  /**
2658
+ * The translatable name of the current extension.
2659
+ *
2660
+ * @var string
2661
  */
2662
  public $name = '';
2663
 
2664
  /**
2665
+ * The visibility of the extension tab. 'public' or 'private'.
2666
+ *
2667
+ * @var string
2668
  */
2669
  public $visibility = 'public';
2670
 
2671
  /**
2672
+ * The numeric position of the main nav item.
2673
+ *
2674
+ * @var int
2675
  */
2676
  public $nav_item_position = 81;
2677
 
2678
  /**
2679
+ * Whether to show the nav item.
2680
+ *
2681
+ * @var bool
2682
  */
2683
  public $enable_nav_item = true;
2684
 
2685
  /**
2686
+ * The text of the nav item. Defaults to self::name.
2687
+ *
2688
+ * @var string
2689
  */
2690
  public $nav_item_name = '';
2691
 
2692
  /**
2693
+ * The WP action that self::widget_display() is attached to.
2694
+ *
2695
+ * Default: 'groups_custom_group_boxes'.
2696
+ *
2697
+ * @var string
2698
  */
2699
  public $display_hook = 'groups_custom_group_boxes';
2700
 
2701
  /**
2702
+ * The template file used to load the plugin content.
2703
+ *
2704
+ * Default: 'groups/single/plugins'.
2705
+ *
2706
+ * @var string
2707
  */
2708
  public $template_file = 'groups/single/plugins';
2709
 
2710
+ /** Protected *********************************************************/
2711
 
2712
  /**
2713
+ * Has the extension been initialized?
2714
+ *
2715
+ * @since BuddyPress (1.8.0)
2716
+ * @var bool
2717
  */
2718
  protected $initialized = false;
2719
 
2720
  /**
2721
+ * Extension properties as set by legacy extensions.
2722
+ *
2723
+ * @since BuddyPress (1.8.0)
2724
+ * @var array
2725
  */
2726
  protected $legacy_properties = array();
2727
 
2728
  /**
2729
+ * Converted legacy parameters.
2730
+ *
2731
+ * These are the extension properties as set by legacy extensions, but
2732
+ * then converted to match the new format for params.
2733
+ *
2734
+ * @since BuddyPress (1.8.0)
2735
+ * @var array
2736
  */
2737
  protected $legacy_properties_converted = array();
2738
 
2739
  /**
2740
+ * Miscellaneous data as set by the __set() magic method.
2741
+ *
2742
+ * @since BuddyPress (1.8.0)
2743
+ * @var array
2744
  */
2745
  protected $data = array();
2746
 
2747
+ /** Screen Overrides **************************************************/
2748
 
2749
+ /*
2750
  * Screen override methods are how your extension will display content
2751
  * and handle form submits. Your extension should only override those
2752
  * methods that it needs for its purposes.
2791
  * }
2792
  *
2793
  * @since BuddyPress (1.8)
2794
+ * @param array $args {
2795
+ * Array of initialization arguments.
2796
+ * @type string $slug Unique, URL-safe identifier for your
2797
+ * extension.
2798
+ * @type string $name Translatable name for your extension. Used to
2799
+ * populate navigation items.
2800
+ * @type string $visibility Optional. Set to 'public' for your
2801
+ * extension (the main tab as well as the widget) to be
2802
+ * available to anyone who can access the group; set to
2803
+ * 'private' otherwise. Default: 'public'.
2804
+ * @type int $nav_item_position Optional. Location of the nav item
2805
+ * in the tab list. Default: 81.
2806
+ * @type bool $enable_nav_item Optional. Whether the extension's
2807
+ * tab should be accessible to anyone who can view the group.
2808
+ * Default: true.
2809
+ * @type string $nav_item_name Optional. The translatable text you
2810
+ * want to appear in the nav tab. Default: the value of $name.
2811
+ * @type string $display_hook Optional. The WordPress action that
2812
+ * the widget_display() method is hooked to.
2813
+ * Default: 'groups_custom_group_boxes'.
2814
+ * @type string $template_file Optional. Theme-relative path to the
2815
+ * template file BP should use to load the content of your
2816
+ * main extension tab. Default: 'groups/single/plugins.php'.
2817
+ * @type array $screens A multi-dimensional array of configuration
2818
+ * information for the extension screens. See docblock of
2819
+ * {@link BP_Group_Extension} for more details.
2820
+ * }
2821
  */
2822
  public function init( $args = array() ) {
2823
 
2846
  }
2847
 
2848
  /**
2849
+ * The main setup routine for the extension.
2850
  *
2851
  * This method contains the primary logic for setting up an extension's
2852
  * configuration, setting up backward compatibility for legacy plugins,
2857
  * is called automatically at the right point in the load order by
2858
  * bp_register_group_extension().
2859
  *
2860
+ * @since BuddyPress (1.1.0)
2861
  */
2862
  public function _register() {
2863
 
2895
  }
2896
 
2897
  /**
2898
+ * Set up some basic info about the Extension.
2899
  *
2900
  * Here we collect the name of the extending class, as well as a
2901
  * ReflectionClass that is used in get_screen_callback() to determine
2902
  * whether your extension overrides certain callback methods.
2903
  *
2904
+ * @since BuddyPress (1.8.0)
2905
  */
2906
  protected function setup_class_info() {
2907
  if ( empty( $this->class_name ) ) {
2914
  }
2915
 
2916
  /**
2917
+ * Get the current group ID.
2918
  *
2919
  * Check for:
2920
  * - current group
2921
  * - new group
2922
  * - group admin
2923
  *
2924
+ * @since BuddyPress (1.8.0)
2925
  */
2926
  public static function get_group_id() {
2927
 
2950
  }
2951
 
2952
  /**
2953
+ * Gather configuration data about your screens.
2954
  *
2955
+ * @since BuddyPress (1.8.0)
2956
  */
2957
  protected function get_default_screens() {
2958
  $this->setup_class_info();
2983
  }
2984
 
2985
  /**
2986
+ * Set up screens array based on params.
2987
  *
2988
+ * @since BuddyPress (1.8.0)
2989
  */
2990
  protected function setup_screens() {
2991
  foreach ( (array) $this->params['screens'] as $context => $screen ) {
3001
  }
3002
  }
3003
 
3004
+ /** Display ***********************************************************/
3005
 
3006
  /**
3007
+ * Hook this extension's group tab into BuddyPress, if necessary.
3008
  *
3009
+ * @since BuddyPress (1.8.0)
3010
  */
3011
  protected function setup_display_hooks() {
3012
 
3046
  }
3047
 
3048
  /**
3049
+ * Hook the main display method, and loads the template file
3050
  */
3051
  public function _display_hook() {
3052
  add_action( 'bp_template_content', array( &$this, 'display' ) );
3053
  bp_core_load_template( apply_filters( 'bp_core_template_plugin', $this->template_file ) );
3054
  }
3055
 
3056
+ /** Create ************************************************************/
3057
 
3058
  /**
3059
+ * Hook this extension's Create step into BuddyPress, if necessary.
3060
  *
3061
+ * @since BuddyPress (1.8.0)
3062
  */
3063
  protected function setup_create_hooks() {
3064
  if ( ! $this->is_screen_enabled( 'create' ) ) {
3084
  }
3085
 
3086
  /**
3087
+ * Call the create_screen() method, if we're on the right page.
3088
  *
3089
+ * @since BuddyPress (1.8.0)
3090
  */
3091
  public function maybe_create_screen() {
3092
  if ( ! bp_is_group_creation_step( $this->screens['create']['slug'] ) ) {
3102
  }
3103
 
3104
  /**
3105
+ * Call the create_screen_save() method, if we're on the right page.
3106
  *
3107
+ * @since BuddyPress (1.8.0)
3108
  */
3109
  public function maybe_create_screen_save() {
3110
  if ( ! bp_is_group_creation_step( $this->screens['create']['slug'] ) ) {
3115
  call_user_func( $this->screens['create']['screen_save_callback'], $this->group_id );
3116
  }
3117
 
3118
+ /** Edit **************************************************************/
3119
 
3120
  /**
3121
+ * Hook this extension's Edit panel into BuddyPress, if necessary.
3122
  *
3123
+ * @since BuddyPress (1.8.0)
3124
  */
3125
  protected function setup_edit_hooks() {
3126
 
3165
  }
3166
 
3167
  /**
3168
+ * Call the edit_screen() method.
3169
  *
3170
  * Previous versions of BP_Group_Extension required plugins to provide
3171
  * their own Submit button and nonce fields when building markup. In
3177
  * button, as would be present in legacy plugins; if one is found, we
3178
  * do not auto-add our own button.
3179
  *
3180
+ * @since BuddyPress (1.8.0)
3181
  */
3182
  public function call_edit_screen() {
3183
  ob_start();
3191
  }
3192
 
3193
  /**
3194
+ * Check the nonce, and call the edit_screen_save() method.
3195
  *
3196
+ * @since BuddyPress (1.8.0)
3197
  */
3198
  public function call_edit_screen_save() {
3199
  if ( empty( $_POST ) ) {
3211
  }
3212
 
3213
  /**
3214
+ * Load the template that houses the Edit screen.
3215
  *
3216
  * Separated out into a callback so that it can run after all other
3217
  * Group Extensions have had a chance to register their navigation, to
3219
  *
3220
  * Hooked to 'bp_screens'.
3221
  *
3222
+ * @since BuddyPress (1.8.0)
3223
  * @access public So that do_action() has access. Do not call directly.
3224
+ *
3225
+ * @see BP_Group_Extension::setup_edit_hooks()
3226
  */
3227
  public function call_edit_screen_template_loader() {
3228
  bp_core_load_template( $this->edit_screen_template );
3229
  }
3230
 
3231
  /**
3232
+ * Add a submit button to the edit form, if it needs one.
3233
  *
3234
  * There's an inconsistency in the way that the group Edit and Create
3235
  * screens are rendered: the Create screen has a submit button built
3238
  * use on both the Create and Edit screens - BP will provide the button
3239
  * if one is not found.
3240
  *
3241
+ * @since BuddyPress (1.8.0)
3242
+ *
3243
+ * @param string $screen The screen markup, captured in the output
3244
+ * buffer.
3245
+ * @param string $screen The same markup, with a submit button added.
3246
  */
3247
  protected function maybe_add_submit_button( $screen = '' ) {
3248
  if ( $this->has_submit_button( $screen ) ) {
3260
  /**
3261
  * Does the given markup have a submit button?
3262
  *
3263
+ * @since BuddyPress (1.8.0)
3264
+ *
3265
+ * @param string $screen The markup to check.
3266
+ * @return bool True if a Submit button is found, otherwise false.
3267
  */
3268
  public static function has_submit_button( $screen = '' ) {
3269
  $pattern = "/<input[^>]+type=[\'\"]submit[\'\"]/";
3271
  return ! empty( $matches[0] );
3272
  }
3273
 
3274
+ /** Admin *************************************************************/
3275
 
3276
  /**
3277
+ * Hook this extension's Admin metabox into BuddyPress, if necessary.
3278
  *
3279
+ * @since BuddyPress (1.8.0)
3280
  */
3281
  protected function setup_admin_hooks() {
3282
  if ( ! $this->is_screen_enabled( 'admin' ) || ! is_admin() ) {
3294
  }
3295
 
3296
  /**
3297
+ * Call the admin_screen() method, and add a nonce field.
3298
  *
3299
+ * @since BuddyPress (1.8.0)
3300
  */
3301
  public function call_admin_screen() {
3302
  call_user_func( $this->screens['admin']['screen_callback'], $this->group_id );
3306
  /**
3307
  * Check the nonce, and call the admin_screen_save() method
3308
  *
3309
+ * @since BuddyPress (1.8.0)
3310
  */
3311
  public function call_admin_screen_save() {
3312
  $this->check_nonce( 'admin' );
3314
  }
3315
 
3316
  /**
3317
+ * Create the Dashboard meta box for this extension.
3318
  *
3319
+ * @since BuddyPress (1.7.0)
3320
  */
3321
  public function _meta_box_display_callback() {
3322
  $group_id = isset( $_GET['gid'] ) ? (int) $_GET['gid'] : 0;
3333
  }
3334
 
3335
 
3336
+ /** Utilities *********************************************************/
3337
 
3338
  /**
3339
+ * Generate the nonce fields for a settings form.
3340
  *
3341
  * The nonce field name (the second param passed to wp_nonce_field)
3342
  * contains this extension's slug and is thus unique to this extension.
3344
  * more than one extension may generate nonces on the same page, and we
3345
  * must avoid name clashes.
3346
  *
3347
+ * @since BuddyPress (1.8.0)
3348
+ *
3349
  * @uses wp_nonce_field()
3350
+ *
3351
+ * @param string $context Screen context. 'create', 'edit', or 'admin'.
3352
  */
3353
  public function nonce_field( $context = '' ) {
3354
  wp_nonce_field( 'bp_group_extension_' . $this->slug . '_' . $context, '_bp_group_' . $context . '_nonce_' . $this->slug );
3355
  }
3356
 
3357
  /**
3358
+ * Check the nonce on a submitted settings form.
3359
+ *
3360
+ * @since BuddyPress (1.8.0)
3361
  *
 
3362
  * @uses check_admin_referer()
3363
+ *
3364
+ * @param string $context Screen context. 'create', 'edit', or 'admin'.
3365
  */
3366
  public function check_nonce( $context = '' ) {
3367
  check_admin_referer( 'bp_group_extension_' . $this->slug . '_' . $context, '_bp_group_' . $context . '_nonce_' . $this->slug );
3374
  * (legacy: $this->enable_create_step, etc), and its screen_callback
3375
  * must also exist and be callable.
3376
  *
3377
+ * @since BuddyPress (1.8.0)
3378
+ *
3379
+ * @param string $context Screen context. 'create', 'edit', or 'admin'.
3380
+ *
3381
+ * @return bool True if the screen is enabled, otherwise false.
3382
  */
3383
  public function is_screen_enabled( $context = '' ) {
3384
  $enabled = false;
3391
  }
3392
 
3393
  /**
3394
+ * Get the appropriate screen callback for the specified context/type.
3395
  *
3396
  * BP Group Extensions have three special "screen contexts": create,
3397
  * admin, and edit. Each of these contexts has a corresponding
3422
  * The get_screen_callback() method uses a ReflectionClass object to
3423
  * determine whether your extension has provided a given callback.
3424
  *
3425
+ * @since BuddyPress (1.8.0)
3426
+ *
3427
+ * @param string $context Screen context. 'create', 'edit', or 'admin'.
3428
+ * @param string $type Screen type. 'screen' or 'screen_save'. Default:
3429
+ * 'screen'.
3430
+ * @return callable A callable function handle.
3431
  */
3432
  public function get_screen_callback( $context = '', $type = 'screen' ) {
3433
  $callback = '';
3451
  }
3452
 
3453
  /**
3454
+ * Recursive argument parsing.
3455
  *
3456
  * This acts like a multi-dimensional version of wp_parse_args() (minus
3457
  * the querystring parsing - you must pass arrays).
3472
  * in unexpected results when used with data in the wild. See, eg,
3473
  * http://core.trac.wordpress.org/ticket/19888
3474
  *
3475
+ * @since BuddyPress (1.8.0)
3476
+ *
3477
+ * @param array $a First set of arguments.
3478
+ * @param array $b Second set of arguments.
3479
+ * @return array Parsed arguments.
3480
  */
3481
  public static function parse_args_r( &$a, $b ) {
3482
  $a = (array) $a;
3496
 
3497
  /** Legacy Support ********************************************************/
3498
 
3499
+ /*
3500
  * In BuddyPress 1.8, the recommended technique for configuring
3501
  * extensions changed from directly setting various object properties
3502
  * in the class constructor, to passing a configuration array to
3506
  */
3507
 
3508
  /**
3509
+ * Provide access to otherwise unavailable object properties.
3510
  *
3511
  * This magic method is here for backward compatibility with plugins
3512
  * that refer to config properties that have moved to a different
3516
  * The legacy_properties array is set up in
3517
  * self::setup_legacy_properties().
3518
  *
3519
+ * @since BuddyPress (1.8.0)
3520
+ *
3521
+ * @param string $key Property name.
3522
+ * @return mixed The value if found, otherwise null.
3523
  */
3524
  public function __get( $key ) {
3525
  if ( isset( $this->legacy_properties[ $key ] ) ) {
3532
  }
3533
 
3534
  /**
3535
+ * Provide a fallback for isset( $this->foo ) when foo is unavailable.
3536
  *
3537
+ * This magic method is here for backward compatibility with plugins
3538
  * that have set their class config options directly in the class
3539
  * constructor. The parse_legacy_properties() method of the current
3540
  * class needs to check whether any legacy keys have been put into the
3541
  * $this->data array.
3542
  *
3543
+ * @since BuddyPress (1.8.0)
3544
+ *
3545
+ * @param string $key Property name.
3546
+ * @return bool True if the value is set, otherwise false.
3547
  */
3548
  public function __isset( $key ) {
3549
  if ( isset( $this->legacy_properties[ $key ] ) ) {
3556
  }
3557
 
3558
  /**
3559
+ * Allow plugins to set otherwise unavailable object properties.
3560
  *
3561
  * This magic method is here for backward compatibility with plugins
3562
  * that may attempt to modify the group extension by manually assigning
3563
  * a value to an object property that no longer exists, such as
3564
  * $this->enable_create_step.
3565
  *
3566
+ * @since BuddyPress (1.8.0)
3567
+ *
3568
+ * @param string $key Property name.
3569
+ * @param mixed $value Property value.
3570
  */
3571
  public function __set( $key, $value ) {
3572
 
3623
  }
3624
 
3625
  /**
3626
+ * Return a list of legacy properties.
3627
  *
3628
  * The legacy implementation of BP_Group_Extension used all of these
3629
  * object properties for configuration. Some have been moved.
3630
  *
3631
+ * @since BuddyPress (1.8.0)
3632
+ *
3633
+ * @return array List of legacy property keys.
3634
  */
3635
  protected function get_legacy_property_list() {
3636
  return array(
3656
  }
3657
 
3658
  /**
3659
+ * Parse legacy properties.
3660
  *
3661
  * The old standard for BP_Group_Extension was for plugins to register
3662
  * their settings as properties in their constructor. The new method is
3664
  * legacy plugins, we slurp up legacy properties, and later on we'll
3665
  * parse them into the new init() array.
3666
  *
3667
+ * @since BuddyPress (1.8.0)
3668
  */
3669
  protected function parse_legacy_properties() {
3670
 
3738
  }
3739
 
3740
  /**
3741
+ * Set up legacy properties.
3742
  *
3743
  * This method is responsible for ensuring that all legacy config
3744
  * properties are stored in an array $this->legacy_properties, so that
3745
  * they remain available to plugins that reference the variables at
3746
  * their old locations.
3747
  *
3748
+ * @since BuddyPress (1.8.0)
3749
  *
3750
+ * @see BP_Group_Extension::__get()
3751
  */
3752
  protected function setup_legacy_properties() {
3753
 
3816
  }
3817
  }
3818
 
3819
+ /**
3820
+ * Register a new Group Extension.
3821
+ *
3822
+ * @param string Name of the Extension class.
3823
+ * @return bool|null Returns false on failure, otherwise null.
3824
+ */
3825
  function bp_register_group_extension( $group_extension_class = '' ) {
3826
 
3827
  if ( ! class_exists( $group_extension_class ) ) {
bp-groups/bp-groups-notifications.php CHANGED
@@ -59,7 +59,13 @@ To view the group: %2$s
59
  function groups_notification_new_membership_request( $requesting_user_id, $admin_id, $group_id, $membership_id ) {
60
 
61
  if ( bp_is_active( 'notifications' ) ) {
62
- bp_notifications_add_notification( $requesting_user_id, $admin_id, 'groups', 'new_membership_request', $group_id );
 
 
 
 
 
 
63
  }
64
 
65
  if ( 'no' == bp_get_user_meta( $admin_id, 'notification_groups_membership_request', true ) )
@@ -110,11 +116,15 @@ function groups_notification_membership_request_completed( $requesting_user_id,
110
 
111
  // Post a screen notification first.
112
  if ( bp_is_active( 'notifications' ) ) {
113
- if ( $accepted ) {
114
- bp_notifications_add_notification( $group_id, $requesting_user_id, 'groups', 'membership_request_accepted' );
115
- } else {
116
- bp_notifications_add_notification( $group_id, $requesting_user_id, 'groups', 'membership_request_rejected' );
117
- }
 
 
 
 
118
  }
119
 
120
  if ( 'no' == bp_get_user_meta( $requesting_user_id, 'notification_membership_request_completed', true ) )
@@ -181,7 +191,14 @@ function groups_notification_promoted_member( $user_id, $group_id ) {
181
 
182
  // Post a screen notification first.
183
  if ( bp_is_active( 'notifications' ) ) {
184
- bp_notifications_add_notification( $group_id, $user_id, 'groups', $type );
 
 
 
 
 
 
 
185
  }
186
 
187
  if ( 'no' == bp_get_user_meta( $user_id, 'notification_groups_admin_promotion', true ) )
@@ -234,7 +251,12 @@ function groups_notification_group_invites( &$group, &$member, $inviter_user_id
234
 
235
  // Post a screen notification first.
236
  if ( bp_is_active( 'notifications' ) ) {
237
- bp_notifications_add_notification( $group->id, $invited_user_id, 'groups', 'group_invite' );
 
 
 
 
 
238
  }
239
 
240
  if ( 'no' == bp_get_user_meta( $invited_user_id, 'notification_groups_invite', true ) )
@@ -568,8 +590,8 @@ function bp_groups_screen_my_groups_mark_notifications() {
568
  bp_notifications_mark_notifications_by_type( $user_id, $group_id, 'member_promoted_to_admin' );
569
  }
570
  }
571
- add_action( 'groups_screen_my_groups', 'bp_groups_screen_my_groups_mark_notifications', 10 );
572
- add_action( 'groups_screen_home', 'bp_groups_screen_my_groups_mark_notifications', 10 );
573
 
574
  /**
575
  * Mark group invitation notifications read when a member views their invitations
@@ -581,7 +603,7 @@ function bp_groups_screen_invites_mark_notifications() {
581
  bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->groups->id, 'group_invite' );
582
  }
583
  }
584
- add_action( 'groups_screen_invites', 'bp_groups_screen_invites_mark_notifications', 10 );
585
 
586
  /**
587
  * Mark group join requests read when an admin or moderator visits the group
@@ -592,7 +614,7 @@ add_action( 'groups_screen_invites', 'bp_groups_screen_invites_mark_notification
592
  */
593
  function bp_groups_screen_group_admin_requests_mark_notifications( $group_id ) {
594
  if ( bp_is_active( 'notifications' ) ) {
595
- bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), $group_id, 'new_membership_request' );
596
  }
597
  }
598
  add_action( 'groups_screen_group_admin_requests', 'bp_groups_screen_group_admin_requests_mark_notifications', 10 );
59
  function groups_notification_new_membership_request( $requesting_user_id, $admin_id, $group_id, $membership_id ) {
60
 
61
  if ( bp_is_active( 'notifications' ) ) {
62
+ bp_notifications_add_notification( array(
63
+ 'user_id' => $admin_id,
64
+ 'item_id' => $requesting_user_id,
65
+ 'secondary_item_id' => $group_id,
66
+ 'component_name' => buddypress()->groups->id,
67
+ 'component_action' => 'new_membership_request'
68
+ ) );
69
  }
70
 
71
  if ( 'no' == bp_get_user_meta( $admin_id, 'notification_groups_membership_request', true ) )
116
 
117
  // Post a screen notification first.
118
  if ( bp_is_active( 'notifications' ) ) {
119
+
120
+ $type = ! empty( $accepted ) ? 'membership_request_accepted' : 'membership_request_rejected' ;
121
+
122
+ bp_notifications_add_notification( array(
123
+ 'user_id' => $requesting_user_id,
124
+ 'item_id' => $group_id,
125
+ 'component_name' => buddypress()->groups->id,
126
+ 'component_action' => $type
127
+ ) );
128
  }
129
 
130
  if ( 'no' == bp_get_user_meta( $requesting_user_id, 'notification_membership_request_completed', true ) )
191
 
192
  // Post a screen notification first.
193
  if ( bp_is_active( 'notifications' ) ) {
194
+ bp_notifications_add_notification( array(
195
+ 'user_id' => $user_id,
196
+ 'item_id' => $group_id,
197
+ 'component_name' => buddypress()->groups->id,
198
+ 'component_action' => $type,
199
+ 'date_notified' => bp_core_current_time(),
200
+ 'is_new' => 1,
201
+ ) );
202
  }
203
 
204
  if ( 'no' == bp_get_user_meta( $user_id, 'notification_groups_admin_promotion', true ) )
251
 
252
  // Post a screen notification first.
253
  if ( bp_is_active( 'notifications' ) ) {
254
+ bp_notifications_add_notification( array(
255
+ 'user_id' => $invited_user_id,
256
+ 'item_id' => $group->id,
257
+ 'component_name' => buddypress()->groups->id,
258
+ 'component_action' => 'group_invite'
259
+ ) );
260
  }
261
 
262
  if ( 'no' == bp_get_user_meta( $invited_user_id, 'notification_groups_invite', true ) )
590
  bp_notifications_mark_notifications_by_type( $user_id, $group_id, 'member_promoted_to_admin' );
591
  }
592
  }
593
+ add_action( 'groups_screen_my_groups', 'bp_groups_screen_my_groups_mark_notifications', 10 );
594
+ add_action( 'groups_screen_group_home', 'bp_groups_screen_my_groups_mark_notifications', 10 );
595
 
596
  /**
597
  * Mark group invitation notifications read when a member views their invitations
603
  bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->groups->id, 'group_invite' );
604
  }
605
  }
606
+ add_action( 'groups_screen_group_invites', 'bp_groups_screen_invites_mark_notifications', 10 );
607
 
608
  /**
609
  * Mark group join requests read when an admin or moderator visits the group
614
  */
615
  function bp_groups_screen_group_admin_requests_mark_notifications( $group_id ) {
616
  if ( bp_is_active( 'notifications' ) ) {
617
+ bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->groups->id, 'new_membership_request' );
618
  }
619
  }
620
  add_action( 'groups_screen_group_admin_requests', 'bp_groups_screen_group_admin_requests_mark_notifications', 10 );
bp-languages/buddypress.pot CHANGED
@@ -4,7 +4,7 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: BuddyPress \n"
6
  "Report-Msgid-Bugs-To: http://wppolyglots.wordpress.com\n"
7
- "POT-Creation-Date: 2013-12-02 21:35:24+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -145,7 +145,7 @@ msgstr ""
145
  #: bp-activity/bp-activity-loader.php:132
146
  #: bp-activity/bp-activity-loader.php:261
147
  #: bp-activity/bp-activity-screens.php:270
148
- #: bp-activity/bp-activity-screens.php:437 bp-core/bp-core-admin.php:434
149
  msgid "Activity"
150
  msgstr ""
151
 
@@ -158,10 +158,10 @@ msgid "ERROR: The item you are trying to reply to cannot be found, or it has bee
158
  msgstr ""
159
 
160
  #: bp-activity/bp-activity-admin.php:209 bp-activity/bp-activity-admin.php:256
161
- #: bp-core/admin/bp-core-functions.php:434
162
- #: bp-core/admin/bp-core-functions.php:452
163
- #: bp-core/admin/bp-core-functions.php:471
164
- #: bp-core/admin/bp-core-functions.php:490 bp-groups/bp-groups-admin.php:112
165
  #: bp-groups/bp-groups-admin.php:148
166
  msgid "Overview"
167
  msgstr ""
@@ -199,10 +199,10 @@ msgid "For information about when and how BuddyPress uses all of these settings,
199
  msgstr ""
200
 
201
  #: bp-activity/bp-activity-admin.php:228 bp-activity/bp-activity-admin.php:273
202
- #: bp-core/admin/bp-core-functions.php:440
203
- #: bp-core/admin/bp-core-functions.php:458
204
- #: bp-core/admin/bp-core-functions.php:477
205
- #: bp-core/admin/bp-core-functions.php:496 bp-groups/bp-groups-admin.php:120
206
  #: bp-groups/bp-groups-admin.php:164
207
  msgid "For more information:"
208
  msgstr ""
@@ -212,10 +212,10 @@ msgid "<a href=\"http://codex.buddypress.org/buddypress-site-administration/mana
212
  msgstr ""
213
 
214
  #: bp-activity/bp-activity-admin.php:230 bp-activity/bp-activity-admin.php:274
215
- #: bp-core/admin/bp-core-functions.php:442
216
- #: bp-core/admin/bp-core-functions.php:460
217
- #: bp-core/admin/bp-core-functions.php:479
218
- #: bp-core/admin/bp-core-functions.php:498 bp-groups/bp-groups-admin.php:165
219
  msgid "<a href=\"http://buddypress.org/support/\">Support Forums</a>"
220
  msgstr ""
221
 
@@ -531,16 +531,16 @@ msgid "<span>%1$s</span> &mdash; %2$s"
531
  msgstr ""
532
 
533
  #: bp-activity/bp-activity-classes.php:257
534
- #: bp-activity/bp-activity-template.php:143 bp-groups/bp-groups-classes.php:340
535
  #: bp-groups/bp-groups-template.php:114
536
  msgid "Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details."
537
  msgstr ""
538
 
539
- #: bp-activity/bp-activity-classes.php:1151
540
  msgid "RSS feed 'id' must be defined"
541
  msgstr ""
542
 
543
- #: bp-activity/bp-activity-classes.php:1264
544
  msgid "In reply to"
545
  msgstr ""
546
 
@@ -609,10 +609,10 @@ msgstr ""
609
  #: bp-activity/bp-activity-loader.php:306 bp-core/bp-core-template.php:364
610
  #: bp-groups/bp-groups-admin.php:32 bp-groups/bp-groups-admin.php:33
611
  #: bp-groups/bp-groups-admin.php:638 bp-groups/bp-groups-loader.php:516
612
- #: bp-groups/bp-groups-notifications.php:349
613
- #: bp-groups/bp-groups-notifications.php:385
614
- #: bp-groups/bp-groups-notifications.php:421
615
- #: bp-groups/bp-groups-notifications.php:457
616
  #: bp-groups/bp-groups-screens.php:894 bp-groups/bp-groups-screens.php:1026
617
  #: bp-groups/bp-groups-screens.php:1028 bp-groups/bp-groups-screens.php:1087
618
  #: bp-groups/bp-groups-screens.php:1089 bp-groups/bp-groups-widgets.php:53
@@ -687,11 +687,11 @@ msgstr ""
687
  #: bp-friends/bp-friends-notifications.php:56
688
  #: bp-friends/bp-friends-notifications.php:105
689
  #: bp-groups/bp-groups-notifications.php:44
690
- #: bp-groups/bp-groups-notifications.php:96
691
- #: bp-groups/bp-groups-notifications.php:157
692
- #: bp-groups/bp-groups-notifications.php:209
693
- #: bp-groups/bp-groups-notifications.php:267
694
- #: bp-messages/bp-messages-notifications.php:83
695
  msgid "To disable these notifications please log in and go to: %s"
696
  msgstr ""
697
 
@@ -958,7 +958,7 @@ msgstr[1] ""
958
  msgid "Profile picture of site author %s"
959
  msgstr ""
960
 
961
- #: bp-blogs/bp-blogs-template.php:633 bp-core/bp-core-classes.php:796
962
  #: bp-groups/bp-groups-widgets.php:85 bp-groups/bp-groups-widgets.php:188
963
  #: bp-members/bp-members-template.php:596
964
  #: bp-members/bp-members-template.php:871
@@ -1090,7 +1090,7 @@ msgid "Max posts to show:"
1090
  msgstr ""
1091
 
1092
  #: bp-core/admin/bp-core-components.php:26
1093
- #: bp-core/admin/bp-core-functions.php:372
1094
  msgid "Components"
1095
  msgstr ""
1096
 
@@ -1265,43 +1265,43 @@ msgstr ""
1265
  msgid "Components, Pages, Settings, and Forums, have been moved to <a href=\"%s\">Settings &gt; BuddyPress</a>. Profile Fields has been moved into the <a href=\"%s\">Users</a> menu."
1266
  msgstr ""
1267
 
1268
- #: bp-core/admin/bp-core-functions.php:233
1269
  msgid "<strong>BuddyPress is almost ready</strong>. You must <a href=\"%s\">update your permalink structure</a> to something other than the default for it to work."
1270
  msgstr ""
1271
 
1272
- #: bp-core/admin/bp-core-functions.php:257 bp-core/admin/bp-core-slugs.php:135
1273
  #: bp-messages/bp-messages-template.php:601
1274
  #: bp-templates/bp-legacy/buddypress/members/activate.php:29
1275
  #: bp-themes/bp-default/registration/activate.php:38
1276
  msgid "Activate"
1277
  msgstr ""
1278
 
1279
- #: bp-core/admin/bp-core-functions.php:262 bp-core/admin/bp-core-slugs.php:134
1280
  #: bp-members/bp-members-adminbar.php:60
1281
  msgid "Register"
1282
  msgstr ""
1283
 
1284
- #: bp-core/admin/bp-core-functions.php:288
1285
- msgid "The following active BuddyPress Components do not have associated WordPress Pages: %2$s. <a href=\"%1$s\" class=\"button-secondary\">Repair</a>"
1286
  msgstr ""
1287
 
1288
- #: bp-core/admin/bp-core-functions.php:310
1289
- msgid "Each BuddyPress Component needs its own WordPress page. The following WordPress Pages have more than one component associated with them: %2$s. <a href=\"%1$s\" class=\"button-secondary\">Repair</a>"
1290
  msgstr ""
1291
 
1292
- #: bp-core/admin/bp-core-functions.php:376 bp-core/admin/bp-core-slugs.php:26
1293
  msgid "Pages"
1294
  msgstr ""
1295
 
1296
- #: bp-core/admin/bp-core-functions.php:380
1297
- #: bp-core/admin/bp-core-settings.php:258 bp-core/bp-core-admin.php:354
1298
  #: bp-groups/bp-groups-loader.php:304 bp-groups/bp-groups-template.php:1468
1299
  #: bp-settings/bp-settings-loader.php:23 bp-settings/bp-settings-loader.php:73
1300
  #: bp-settings/bp-settings-loader.php:163
1301
  msgid "Settings"
1302
  msgstr ""
1303
 
1304
- #: bp-core/admin/bp-core-functions.php:393 bp-core/bp-core-template.php:370
1305
  #: bp-forums/bp-forums-loader.php:132 bp-forums/bp-forums-loader.php:199
1306
  #: bp-forums/bp-forums-loader.php:240 bp-forums/bp-forums-screens.php:208
1307
  #: bp-forums/bp-forums-screens.php:210 bp-forums/deprecated/1.6.php:42
@@ -1309,62 +1309,62 @@ msgstr ""
1309
  msgid "Forums"
1310
  msgstr ""
1311
 
1312
- #: bp-core/admin/bp-core-functions.php:441
1313
  msgid "<a href=\"http://codex.buddypress.org/getting-started/configure-buddypress-components/#settings-buddypress-components\">Managing Components</a>"
1314
  msgstr ""
1315
 
1316
- #: bp-core/admin/bp-core-functions.php:459
1317
  msgid "<a href=\"http://codex.buddypress.org/getting-started/configure-buddypress-components/#settings-buddypress-pages\">Managing Pages</a>"
1318
  msgstr ""
1319
 
1320
- #: bp-core/admin/bp-core-functions.php:478
1321
  msgid "<a href=\"http://codex.buddypress.org/getting-started/configure-buddypress-components/#settings-buddypress-settings\">Managing Settings</a>"
1322
  msgstr ""
1323
 
1324
- #: bp-core/admin/bp-core-functions.php:497
1325
  msgid "<a href=\"http://codex.buddypress.org/getting-started/configure-buddypress-components/#users-profile-fields\">Managing Profile Fields</a>"
1326
  msgstr ""
1327
 
1328
- #: bp-core/admin/bp-core-functions.php:515
1329
  msgid "By default, all BuddyPress components are enabled. You can selectively disable any of the components by using the form. Your BuddyPress installation will continue to function. However, the features of the disabled components will no longer be accessible to anyone using the site."
1330
  msgstr ""
1331
 
1332
- #: bp-core/admin/bp-core-functions.php:519
1333
  msgid "BuddyPress Components use WordPress Pages for their root directory/archive pages. Here you can change the page associations for each active component."
1334
  msgstr ""
1335
 
1336
- #: bp-core/admin/bp-core-functions.php:523
1337
  msgid "Extra configuration settings."
1338
  msgstr ""
1339
 
1340
- #: bp-core/admin/bp-core-functions.php:527
1341
  msgid "Your users will distinguish themselves through their profile page. Create relevant profile fields that will show on each users profile.</br></br>Note: Any fields in the first group will appear on the signup page."
1342
  msgstr ""
1343
 
1344
- #: bp-core/admin/bp-core-functions.php:687 bp-core/bp-core-admin.php:197
1345
- #: bp-core/bp-core-admin.php:198 bp-core/bp-core-admin.php:218
1346
  msgid "BuddyPress"
1347
  msgstr ""
1348
 
1349
- #: bp-core/admin/bp-core-functions.php:709
1350
- #: bp-core/admin/bp-core-functions.php:718
1351
  msgid "Logged-In"
1352
  msgstr ""
1353
 
1354
- #: bp-core/admin/bp-core-functions.php:712
1355
- #: bp-core/admin/bp-core-functions.php:727
1356
  msgid "Logged-Out"
1357
  msgstr ""
1358
 
1359
- #: bp-core/admin/bp-core-functions.php:719
1360
  msgid "<em>Logged-In</em> links are relative to the current user, and are not visible to visitors who are not logged in."
1361
  msgstr ""
1362
 
1363
- #: bp-core/admin/bp-core-functions.php:728
1364
  msgid "<em>Logged-Out</em> links are not visible to users who are logged in."
1365
  msgstr ""
1366
 
1367
- #: bp-core/admin/bp-core-functions.php:738
1368
  msgid "Add to Menu"
1369
  msgstr ""
1370
 
@@ -1462,124 +1462,144 @@ msgstr ""
1462
  msgid "Associate WordPress Pages with the following BuddyPress Registration pages."
1463
  msgstr ""
1464
 
1465
- #: bp-core/bp-core-admin.php:177 bp-core/bp-core-admin.php:178
1466
- #: bp-core/bp-core-admin.php:186 bp-core/bp-core-admin.php:187
1467
  msgid "Welcome to BuddyPress"
1468
  msgstr ""
1469
 
1470
- #: bp-core/bp-core-admin.php:207
1471
  msgid "BuddyPress Help"
1472
  msgstr ""
1473
 
1474
- #: bp-core/bp-core-admin.php:208
1475
  msgid "Help"
1476
  msgstr ""
1477
 
1478
- #: bp-core/bp-core-admin.php:217
1479
  msgid "BuddyPress Components"
1480
  msgstr ""
1481
 
1482
- #: bp-core/bp-core-admin.php:226 bp-core/bp-core-admin.php:227
1483
  msgid "BuddyPress Pages"
1484
  msgstr ""
1485
 
1486
- #: bp-core/bp-core-admin.php:235 bp-core/bp-core-admin.php:236
1487
  msgid "BuddyPress Settings"
1488
  msgstr ""
1489
 
1490
- #: bp-core/bp-core-admin.php:262
1491
  msgid "Main Settings"
1492
  msgstr ""
1493
 
1494
- #: bp-core/bp-core-admin.php:265 bp-core/bp-core-admin.php:270
1495
  msgid "Toolbar"
1496
  msgstr ""
1497
 
1498
- #: bp-core/bp-core-admin.php:275
1499
  msgid "Account Deletion"
1500
  msgstr ""
1501
 
1502
- #: bp-core/bp-core-admin.php:283
1503
  msgid "Profile Settings"
1504
  msgstr ""
1505
 
1506
- #: bp-core/bp-core-admin.php:286
1507
  msgid "Avatar Uploads"
1508
  msgstr ""
1509
 
1510
- #: bp-core/bp-core-admin.php:290
1511
  msgid "Profile Syncing"
1512
  msgstr ""
1513
 
1514
- #: bp-core/bp-core-admin.php:299
1515
  msgid "Groups Settings"
1516
  msgstr ""
1517
 
1518
- #: bp-core/bp-core-admin.php:302
1519
  msgid "Group Creation"
1520
  msgstr ""
1521
 
1522
- #: bp-core/bp-core-admin.php:311
1523
  msgid "Legacy Group Forums"
1524
  msgstr ""
1525
 
1526
- #: bp-core/bp-core-admin.php:314
1527
  msgid "bbPress Configuration"
1528
  msgstr ""
1529
 
1530
- #: bp-core/bp-core-admin.php:323
1531
  msgid "Activity Settings"
1532
  msgstr ""
1533
 
1534
- #: bp-core/bp-core-admin.php:326
1535
  msgid "Blog &amp; Forum Comments"
1536
  msgstr ""
1537
 
1538
- #: bp-core/bp-core-admin.php:331
1539
  msgid "Akismet"
1540
  msgstr ""
1541
 
1542
- #: bp-core/bp-core-admin.php:355
 
 
 
 
1543
  msgid "About"
1544
  msgstr ""
1545
 
1546
- #: bp-core/bp-core-admin.php:406 bp-core/bp-core-admin.php:525
1547
  msgid "Welcome to BuddyPress %s"
1548
  msgstr ""
1549
 
1550
- #: bp-core/bp-core-admin.php:409
1551
- msgid "BuddyPress %s is our safest, fastest, most flexible version ever."
 
 
 
 
 
 
 
 
1552
  msgstr ""
1553
 
1554
- #: bp-core/bp-core-admin.php:411
1555
- msgid "Thank you for updating! BuddyPress %s is our safest, fastest, most flexible version ever."
1556
  msgstr ""
1557
 
1558
- #: bp-core/bp-core-admin.php:414 bp-core/bp-core-admin.php:527
 
 
 
 
 
 
 
 
1559
  msgid "Version %s"
1560
  msgstr ""
1561
 
1562
- #: bp-core/bp-core-admin.php:418 bp-core/bp-core-admin.php:531
1563
  msgid "What&#8217;s New"
1564
  msgstr ""
1565
 
1566
- #: bp-core/bp-core-admin.php:420 bp-core/bp-core-admin.php:533
1567
  msgid "Credits"
1568
  msgstr ""
1569
 
1570
- #: bp-core/bp-core-admin.php:425
1571
  msgid "Getting Started"
1572
  msgstr ""
1573
 
1574
- #: bp-core/bp-core-admin.php:428
1575
  msgid "Your Default Setup"
1576
  msgstr ""
1577
 
1578
- #: bp-core/bp-core-admin.php:432
1579
  msgid "BuddyPress&#8217;s powerful features help your users connect and collaborate. To help get your community started, we&#8217;ve activated two of the most commonly used tools in BP: <strong>Extended Profiles</strong> and <strong>Activity Streams</strong>. See these components in action at the %1$s and %2$s directories, and be sure to spend a few minutes <a href=\"%3$s\">configuring user profiles</a>. Want to explore more of BP&#8217;s features? Visit the <a href=\"%4$s\">Components panel</a>."
1580
  msgstr ""
1581
 
1582
- #: bp-core/bp-core-admin.php:433 bp-core/bp-core-template.php:361
1583
  #: bp-core/bp-core-widgets.php:266 bp-groups/bp-groups-admin.php:776
1584
  #: bp-groups/bp-groups-template.php:1476 bp-members/bp-members-loader.php:24
1585
  #: bp-members/bp-members-screens.php:368
@@ -1588,119 +1608,107 @@ msgstr ""
1588
  msgid "Members"
1589
  msgstr ""
1590
 
1591
- #: bp-core/bp-core-admin.php:441
1592
  msgid "BuddyPress&#8217;s powerful features help your users connect and collaborate. Want to explore BP&#8217;s features? Visit the <a href=\"%s\">Components panel</a>."
1593
  msgstr ""
1594
 
1595
- #: bp-core/bp-core-admin.php:447
1596
  msgid "Community and Support"
1597
  msgstr ""
1598
 
1599
- #: bp-core/bp-core-admin.php:448
1600
  msgid "Looking for help? The <a href=\"http://codex.buddypress.org/\">BuddyPress Codex</a> has you covered, with dozens of user-contributed guides on how to configure and use your BP site. Can&#8217;t find what you need? Stop by <a href=\"http://buddypress.org/support/\">our support forums</a>, where a vibrant community of BuddyPress users and developers is waiting to share tips, show off their sites, talk about the future of BuddyPress, and much more."
1601
  msgstr ""
1602
 
1603
- #: bp-core/bp-core-admin.php:454
1604
- msgid "Improved Theme Integration"
1605
- msgstr ""
1606
-
1607
- #: bp-core/bp-core-admin.php:457
1608
- msgid "Hey, Good Lookin&#8217;"
1609
- msgstr ""
1610
-
1611
- #: bp-core/bp-core-admin.php:458
1612
- msgid "We&#8217;ve streamlined our stylesheets, so that BuddyPress content looks more at home in your theme. And theme developers will love BP&#8217;s new hierarchies that make it easy to override specific top-level templates, stylesheets, and JavaScript files."
1613
- msgstr ""
1614
-
1615
- #: bp-core/bp-core-admin.php:463
1616
- msgid "Better Group Member Management"
1617
  msgstr ""
1618
 
1619
- #: bp-core/bp-core-admin.php:466
1620
- msgid "<em>Add</em>, <em>Remove</em>, and More, in a Snap"
1621
  msgstr ""
1622
 
1623
- #: bp-core/bp-core-admin.php:469
1624
- msgid "Groups administration panel"
1625
  msgstr ""
1626
 
1627
- #: bp-core/bp-core-admin.php:476
1628
- msgid "The Manage Members section of the %s has been rewritten, to make it easier to handle groups with many members. We&#8217;ve also made the interface nicer to use, to ensure that you don&#8217;t make changes and then forget to save them."
1629
  msgstr ""
1630
 
1631
- #: bp-core/bp-core-admin.php:483
1632
- msgid "Under the Hood"
1633
  msgstr ""
1634
 
1635
- #: bp-core/bp-core-admin.php:487
1636
- msgid "Superpowered Group Extensions"
1637
  msgstr ""
1638
 
1639
- #: bp-core/bp-core-admin.php:488
1640
- msgid "<code>BP_Group_Extension</code> has been overhauled, making it easier than ever before to add custom functionality to groups."
1641
  msgstr ""
1642
 
1643
- #: bp-core/bp-core-admin.php:490
1644
- msgid "Filter Groups or Activity by Metadata"
1645
  msgstr ""
1646
 
1647
- #: bp-core/bp-core-admin.php:491
1648
- msgid "<code>bp_has_groups()</code> and <code>bp_has_activities()</code> now accept a <code>meta_query</code> paramater, for more powerful directory queries."
1649
  msgstr ""
1650
 
1651
- #: bp-core/bp-core-admin.php:495
1652
- msgid "Feed Me, Seymour"
1653
  msgstr ""
1654
 
1655
- #: bp-core/bp-core-admin.php:496
1656
- msgid "The new <code>BP_Activity_Feed</code> class centralizes BP&#8217;s RSS logic, making our feeds more standards-compliant, and giving developers more tools for building custom feeds."
1657
  msgstr ""
1658
 
1659
- #: bp-core/bp-core-admin.php:498
1660
- msgid "Disable @-Mentions"
1661
  msgstr ""
1662
 
1663
- #: bp-core/bp-core-admin.php:499
1664
- msgid "Not using @-mentions? Disable them with <code>add_filter( 'bp_activity_do_mentions', '__return_false' );</code>"
1665
  msgstr ""
1666
 
1667
- #: bp-core/bp-core-admin.php:504 bp-core/bp-core-admin.php:632
1668
  msgid "Go to the BuddyPress Settings page"
1669
  msgstr ""
1670
 
1671
- #: bp-core/bp-core-admin.php:526
1672
- msgid "Thank you for updating to the latest version! BuddyPress %s is ready to make your community a safer, faster, and better looking place to hang out!"
1673
  msgstr ""
1674
 
1675
- #: bp-core/bp-core-admin.php:537
1676
  msgid "BuddyPress is created by a worldwide network of friendly folks."
1677
  msgstr ""
1678
 
1679
- #: bp-core/bp-core-admin.php:539
1680
  msgid "Project Leaders"
1681
  msgstr ""
1682
 
1683
- #: bp-core/bp-core-admin.php:544
1684
  msgid "Founding Developer"
1685
  msgstr ""
1686
 
1687
- #: bp-core/bp-core-admin.php:549
1688
  msgid "Project Lead"
1689
  msgstr ""
1690
 
1691
- #: bp-core/bp-core-admin.php:554 bp-core/bp-core-admin.php:559
1692
  msgid "Lead Developer"
1693
  msgstr ""
1694
 
1695
- #: bp-core/bp-core-admin.php:563
1696
  msgid "Core Developers"
1697
  msgstr ""
1698
 
1699
- #: bp-core/bp-core-admin.php:571
1700
  msgid "Recent Rockstars"
1701
  msgstr ""
1702
 
1703
- #: bp-core/bp-core-admin.php:591
1704
  msgid "Contributors to BuddyPress 1.9"
1705
  msgstr ""
1706
 
@@ -1752,8 +1760,8 @@ msgstr ""
1752
  msgid "Upload failed! Error was: %s"
1753
  msgstr ""
1754
 
1755
- #: bp-core/bp-core-avatars.php:831 bp-core/bp-core-classes.php:793
1756
- #: bp-core/bp-core-classes.php:794 bp-core/bp-core-classes.php:795
1757
  #: bp-core/bp-core-template.php:135 bp-core/bp-core-template.php:151
1758
  msgid "Avatar of %s"
1759
  msgstr ""
@@ -1762,7 +1770,7 @@ msgstr ""
1762
  msgid "You do not have access to this page."
1763
  msgstr ""
1764
 
1765
- #: bp-core/bp-core-buddybar.php:552 bp-core/bp-core-functions.php:1713
1766
  #: bp-core/bp-core-widgets.php:89 bp-themes/bp-default/sidebar.php:52
1767
  msgid "Log In"
1768
  msgstr ""
@@ -1771,7 +1779,7 @@ msgstr ""
1771
  msgid "Sign Up"
1772
  msgstr ""
1773
 
1774
- #: bp-core/bp-core-buddybar.php:613 bp-core/bp-core-functions.php:1646
1775
  #: bp-core/bp-core-widgets.php:71 bp-core/deprecated/1.5.php:307
1776
  #: bp-members/bp-members-template.php:774 bp-themes/bp-default/sidebar.php:18
1777
  msgid "Log Out"
@@ -1806,7 +1814,7 @@ msgstr ""
1806
  msgid "You must log in to access the page you requested."
1807
  msgstr ""
1808
 
1809
- #: bp-core/bp-core-classes.php:810
1810
  msgid "%d group"
1811
  msgid_plural "%d groups"
1812
  msgstr[0] ""
@@ -1837,7 +1845,7 @@ msgstr ""
1837
  msgid "Activate %s"
1838
  msgstr ""
1839
 
1840
- #: bp-core/bp-core-filters.php:310 bp-members/bp-members-functions.php:1464
1841
  msgid ""
1842
  "Thanks for registering! To complete the activation of your account please click the following link:\n"
1843
  "\n"
@@ -1845,7 +1853,7 @@ msgid ""
1845
  "\n"
1846
  msgstr ""
1847
 
1848
- #: bp-core/bp-core-filters.php:311 bp-members/bp-members-functions.php:1465
1849
  msgid "Activate Your Account"
1850
  msgstr ""
1851
 
@@ -1918,66 +1926,66 @@ msgctxt "Page title for the user registration screen."
1918
  msgid "Register"
1919
  msgstr ""
1920
 
1921
- #: bp-core/bp-core-functions.php:685
1922
  msgid "sometime"
1923
  msgstr ""
1924
 
1925
- #: bp-core/bp-core-functions.php:686
1926
  msgid "right now"
1927
  msgstr ""
1928
 
1929
- #: bp-core/bp-core-functions.php:687
1930
  msgid "%s ago"
1931
  msgstr ""
1932
 
1933
- #: bp-core/bp-core-functions.php:748
1934
  msgid "%s year"
1935
  msgid_plural "%s years"
1936
  msgstr[0] ""
1937
  msgstr[1] ""
1938
 
1939
- #: bp-core/bp-core-functions.php:751 bp-core/bp-core-functions.php:785
1940
  msgid "%s month"
1941
  msgid_plural "%s months"
1942
  msgstr[0] ""
1943
  msgstr[1] ""
1944
 
1945
- #: bp-core/bp-core-functions.php:754 bp-core/bp-core-functions.php:788
1946
  msgid "%s week"
1947
  msgid_plural "%s weeks"
1948
  msgstr[0] ""
1949
  msgstr[1] ""
1950
 
1951
- #: bp-core/bp-core-functions.php:757 bp-core/bp-core-functions.php:791
1952
  msgid "%s day"
1953
  msgid_plural "%s days"
1954
  msgstr[0] ""
1955
  msgstr[1] ""
1956
 
1957
- #: bp-core/bp-core-functions.php:760 bp-core/bp-core-functions.php:794
1958
  msgid "%s hour"
1959
  msgid_plural "%s hours"
1960
  msgstr[0] ""
1961
  msgstr[1] ""
1962
 
1963
- #: bp-core/bp-core-functions.php:763 bp-core/bp-core-functions.php:797
1964
  msgid "%s minute"
1965
  msgid_plural "%s minutes"
1966
  msgstr[0] ""
1967
  msgstr[1] ""
1968
 
1969
- #: bp-core/bp-core-functions.php:766 bp-core/bp-core-functions.php:800
1970
  msgid "%s second"
1971
  msgid_plural "%s seconds"
1972
  msgstr[0] ""
1973
  msgstr[1] ""
1974
 
1975
- #: bp-core/bp-core-functions.php:781
1976
  msgctxt "Separator in time since"
1977
  msgid ","
1978
  msgstr ""
1979
 
1980
- #: bp-core/bp-core-functions.php:966
1981
  msgid "Not recently active"
1982
  msgstr ""
1983
 
@@ -3070,14 +3078,14 @@ msgid "No members of this type"
3070
  msgstr ""
3071
 
3072
  #: bp-groups/bp-groups-admin.php:877 bp-groups/bp-groups-adminbar.php:101
3073
- #: bp-groups/bp-groups-buddybar.php:57
3074
  #: bp-templates/bp-legacy/buddypress/groups/single/admin.php:360
3075
  #: bp-themes/bp-default/groups/single/admin.php:360
3076
  #: bp-xprofile/bp-xprofile-admin.php:118
3077
  msgid "Delete Group"
3078
  msgstr ""
3079
 
3080
- #: bp-groups/bp-groups-admin.php:881 bp-groups/bp-groups-classes.php:2162
3081
  #: bp-templates/bp-legacy/buddypress/groups/single/admin.php:32
3082
  #: bp-templates/bp-legacy/buddypress/groups/single/admin.php:117
3083
  #: bp-templates/bp-legacy/buddypress/groups/single/forum/edit.php:58
@@ -3165,7 +3173,7 @@ msgstr ""
3165
  msgid "Select group %1$d"
3166
  msgstr ""
3167
 
3168
- #: bp-groups/bp-groups-adminbar.php:47 bp-groups/bp-groups-buddybar.php:33
3169
  msgid "Edit Details"
3170
  msgstr ""
3171
 
@@ -3177,36 +3185,36 @@ msgstr ""
3177
  msgid "Edit Avatar"
3178
  msgstr ""
3179
 
3180
- #: bp-groups/bp-groups-adminbar.php:74 bp-groups/bp-groups-buddybar.php:45
3181
  msgid "Manage Invitations"
3182
  msgstr ""
3183
 
3184
- #: bp-groups/bp-groups-adminbar.php:83 bp-groups/bp-groups-buddybar.php:49
3185
  msgid "Manage Members"
3186
  msgstr ""
3187
 
3188
- #: bp-groups/bp-groups-adminbar.php:92 bp-groups/bp-groups-buddybar.php:53
3189
  msgid "Membership Requests"
3190
  msgstr ""
3191
 
3192
- #: bp-groups/bp-groups-buddybar.php:30 bp-members/bp-members-buddybar.php:94
3193
  msgid "Admin Options"
3194
  msgstr ""
3195
 
3196
- #: bp-groups/bp-groups-buddybar.php:35
3197
  msgid "Group Settings"
3198
  msgstr ""
3199
 
3200
- #: bp-groups/bp-groups-buddybar.php:39 bp-groups/bp-groups-loader.php:590
3201
  #: bp-groups/bp-groups-template.php:2634
3202
  msgid "Group Avatar"
3203
  msgstr ""
3204
 
3205
- #: bp-groups/bp-groups-classes.php:1346
3206
  msgid "Group Mod"
3207
  msgstr ""
3208
 
3209
- #: bp-groups/bp-groups-classes.php:1352 bp-groups/bp-groups-functions.php:121
3210
  msgid "Group Admin"
3211
  msgstr ""
3212
 
@@ -3322,11 +3330,11 @@ msgid ""
3322
  "---------------------\n"
3323
  msgstr ""
3324
 
3325
- #: bp-groups/bp-groups-notifications.php:79
3326
  msgid "Membership request for group: %s"
3327
  msgstr ""
3328
 
3329
- #: bp-groups/bp-groups-notifications.php:81
3330
  msgid ""
3331
  "%1$s wants to join the group \"%2$s\".\n"
3332
  "\n"
@@ -3340,11 +3348,11 @@ msgid ""
3340
  "---------------------\n"
3341
  msgstr ""
3342
 
3343
- #: bp-groups/bp-groups-notifications.php:135
3344
  msgid "Membership request for group \"%s\" accepted"
3345
  msgstr ""
3346
 
3347
- #: bp-groups/bp-groups-notifications.php:136
3348
  msgid ""
3349
  "Your membership request for the group \"%1$s\" has been accepted.\n"
3350
  "\n"
@@ -3353,11 +3361,11 @@ msgid ""
3353
  "---------------------\n"
3354
  msgstr ""
3355
 
3356
- #: bp-groups/bp-groups-notifications.php:145
3357
  msgid "Membership request for group \"%s\" rejected"
3358
  msgstr ""
3359
 
3360
- #: bp-groups/bp-groups-notifications.php:146
3361
  msgid ""
3362
  "Your membership request for the group \"%1$s\" has been rejected.\n"
3363
  "\n"
@@ -3366,19 +3374,19 @@ msgid ""
3366
  "---------------------\n"
3367
  msgstr ""
3368
 
3369
- #: bp-groups/bp-groups-notifications.php:175
3370
  msgid "an administrator"
3371
  msgstr ""
3372
 
3373
- #: bp-groups/bp-groups-notifications.php:178
3374
  msgid "a moderator"
3375
  msgstr ""
3376
 
3377
- #: bp-groups/bp-groups-notifications.php:198
3378
  msgid "You have been promoted in the group: \"%s\""
3379
  msgstr ""
3380
 
3381
- #: bp-groups/bp-groups-notifications.php:199
3382
  msgid ""
3383
  "You have been promoted to %1$s for the group: \"%2$s\".\n"
3384
  "\n"
@@ -3387,11 +3395,11 @@ msgid ""
3387
  "---------------------\n"
3388
  msgstr ""
3389
 
3390
- #: bp-groups/bp-groups-notifications.php:251
3391
  msgid "You have an invitation to the group: \"%s\""
3392
  msgstr ""
3393
 
3394
- #: bp-groups/bp-groups-notifications.php:253
3395
  msgid ""
3396
  "One of your friends %1$s has invited you to the group: \"%2$s\".\n"
3397
  "\n"
@@ -3404,60 +3412,60 @@ msgid ""
3404
  "---------------------\n"
3405
  msgstr ""
3406
 
3407
- #: bp-groups/bp-groups-notifications.php:307
3408
  msgid "%1$d new membership requests for the group \"%2$s\""
3409
  msgstr ""
3410
 
3411
- #: bp-groups/bp-groups-notifications.php:312
3412
  msgid "Group Membership Requests"
3413
  msgstr ""
3414
 
3415
- #: bp-groups/bp-groups-notifications.php:321
3416
- #: bp-groups/bp-groups-notifications.php:326
3417
  msgid "%s requests group membership"
3418
  msgstr ""
3419
 
3420
- #: bp-groups/bp-groups-notifications.php:344
3421
  msgid "%d accepted group membership requests"
3422
  msgstr ""
3423
 
3424
- #: bp-groups/bp-groups-notifications.php:357
3425
  msgid "Membership for group \"%s\" accepted"
3426
  msgstr ""
3427
 
3428
- #: bp-groups/bp-groups-notifications.php:380
3429
  msgid "%d rejected group membership requests"
3430
  msgstr ""
3431
 
3432
- #: bp-groups/bp-groups-notifications.php:393
3433
  msgid "Membership for group \"%s\" rejected"
3434
  msgstr ""
3435
 
3436
- #: bp-groups/bp-groups-notifications.php:416
3437
  msgid "You were promoted to an admin in %d groups"
3438
  msgstr ""
3439
 
3440
- #: bp-groups/bp-groups-notifications.php:429
3441
  msgid "You were promoted to an admin in the group \"%s\""
3442
  msgstr ""
3443
 
3444
- #: bp-groups/bp-groups-notifications.php:452
3445
  msgid "You were promoted to a mod in %d groups"
3446
  msgstr ""
3447
 
3448
- #: bp-groups/bp-groups-notifications.php:465
3449
  msgid "You were promoted to a mod in the group \"%s\""
3450
  msgstr ""
3451
 
3452
- #: bp-groups/bp-groups-notifications.php:489
3453
  msgid "You have %d new group invitations"
3454
  msgstr ""
3455
 
3456
- #: bp-groups/bp-groups-notifications.php:493
3457
  msgid "Group Invites"
3458
  msgstr ""
3459
 
3460
- #: bp-groups/bp-groups-notifications.php:501
3461
  msgid "You have an invitation to the group: %s"
3462
  msgstr ""
3463
 
@@ -3964,65 +3972,65 @@ msgid "Delete %s's Account"
3964
  msgstr ""
3965
 
3966
  #: bp-members/bp-members-functions.php:977
3967
- #: bp-members/bp-members-functions.php:1592
3968
  msgid "<strong>ERROR</strong>: Your account has been marked as a spammer."
3969
  msgstr ""
3970
 
3971
- #: bp-members/bp-members-functions.php:1151
3972
  msgid "Please check your email address."
3973
  msgstr ""
3974
 
3975
- #: bp-members/bp-members-functions.php:1154
3976
- #: bp-members/bp-members-functions.php:1157
3977
  msgid "Sorry, that email address is not allowed!"
3978
  msgstr ""
3979
 
3980
- #: bp-members/bp-members-functions.php:1160
3981
  msgid "Sorry, that email address is already used!"
3982
  msgstr ""
3983
 
3984
- #: bp-members/bp-members-functions.php:1191
3985
  msgid "Please enter a username"
3986
  msgstr ""
3987
 
3988
- #: bp-members/bp-members-functions.php:1197
3989
  msgid "That username is not allowed"
3990
  msgstr ""
3991
 
3992
- #: bp-members/bp-members-functions.php:1202
3993
  msgid "Usernames can contain only letters, numbers, ., -, and @"
3994
  msgstr ""
3995
 
3996
- #: bp-members/bp-members-functions.php:1207
3997
  msgid "Username must be at least 4 characters"
3998
  msgstr ""
3999
 
4000
- #: bp-members/bp-members-functions.php:1212
4001
  msgid "Sorry, usernames may not contain the character \"_\"!"
4002
  msgstr ""
4003
 
4004
- #: bp-members/bp-members-functions.php:1219
4005
  msgid "Sorry, usernames must have letters too!"
4006
  msgstr ""
4007
 
4008
- #: bp-members/bp-members-functions.php:1224
4009
  msgid "Sorry, that username already exists!"
4010
  msgstr ""
4011
 
4012
- #: bp-members/bp-members-functions.php:1275
4013
  msgid "<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a href=\"mailto:%s\">webmaster</a> !"
4014
  msgstr ""
4015
 
4016
- #: bp-members/bp-members-functions.php:1373
4017
- #: bp-members/bp-members-functions.php:1377
4018
  msgid "Invalid activation key"
4019
  msgstr ""
4020
 
4021
- #: bp-members/bp-members-functions.php:1414
4022
  msgid "%s became a registered member"
4023
  msgstr ""
4024
 
4025
- #: bp-members/bp-members-functions.php:1498
4026
  msgid "<strong>ERROR</strong>: Your account has not been activated. Check your email for the activation link."
4027
  msgstr ""
4028
 
@@ -4163,7 +4171,7 @@ msgstr ""
4163
 
4164
  #: bp-messages/bp-messages-loader.php:132
4165
  #: bp-messages/bp-messages-loader.php:196
4166
- #: bp-messages/bp-messages-notifications.php:115
4167
  msgid "Inbox"
4168
  msgstr ""
4169
 
@@ -4202,11 +4210,11 @@ msgstr ""
4202
  msgid "My Messages"
4203
  msgstr ""
4204
 
4205
- #: bp-messages/bp-messages-notifications.php:67
4206
  msgid "New message from %s"
4207
  msgstr ""
4208
 
4209
- #: bp-messages/bp-messages-notifications.php:69
4210
  msgid ""
4211
  "%1$s sent you a new message:\n"
4212
  "\n"
@@ -4219,15 +4227,15 @@ msgid ""
4219
  "---------------------\n"
4220
  msgstr ""
4221
 
4222
- #: bp-messages/bp-messages-notifications.php:118
4223
  msgid "You have %d new messages"
4224
  msgstr ""
4225
 
4226
- #: bp-messages/bp-messages-notifications.php:122
4227
  msgid "You have %d new message from %s"
4228
  msgstr ""
4229
 
4230
- #: bp-messages/bp-messages-notifications.php:124
4231
  msgid "You have %d new message"
4232
  msgstr ""
4233
 
4
  msgstr ""
5
  "Project-Id-Version: BuddyPress \n"
6
  "Report-Msgid-Bugs-To: http://wppolyglots.wordpress.com\n"
7
+ "POT-Creation-Date: 2013-12-17 00:35:15+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
145
  #: bp-activity/bp-activity-loader.php:132
146
  #: bp-activity/bp-activity-loader.php:261
147
  #: bp-activity/bp-activity-screens.php:270
148
+ #: bp-activity/bp-activity-screens.php:437 bp-core/bp-core-admin.php:466
149
  msgid "Activity"
150
  msgstr ""
151
 
158
  msgstr ""
159
 
160
  #: bp-activity/bp-activity-admin.php:209 bp-activity/bp-activity-admin.php:256
161
+ #: bp-core/admin/bp-core-functions.php:444
162
+ #: bp-core/admin/bp-core-functions.php:462
163
+ #: bp-core/admin/bp-core-functions.php:481
164
+ #: bp-core/admin/bp-core-functions.php:500 bp-groups/bp-groups-admin.php:112
165
  #: bp-groups/bp-groups-admin.php:148
166
  msgid "Overview"
167
  msgstr ""
199
  msgstr ""
200
 
201
  #: bp-activity/bp-activity-admin.php:228 bp-activity/bp-activity-admin.php:273
202
+ #: bp-core/admin/bp-core-functions.php:450
203
+ #: bp-core/admin/bp-core-functions.php:468
204
+ #: bp-core/admin/bp-core-functions.php:487
205
+ #: bp-core/admin/bp-core-functions.php:506 bp-groups/bp-groups-admin.php:120
206
  #: bp-groups/bp-groups-admin.php:164
207
  msgid "For more information:"
208
  msgstr ""
212
  msgstr ""
213
 
214
  #: bp-activity/bp-activity-admin.php:230 bp-activity/bp-activity-admin.php:274
215
+ #: bp-core/admin/bp-core-functions.php:452
216
+ #: bp-core/admin/bp-core-functions.php:470
217
+ #: bp-core/admin/bp-core-functions.php:489
218
+ #: bp-core/admin/bp-core-functions.php:508 bp-groups/bp-groups-admin.php:165
219
  msgid "<a href=\"http://buddypress.org/support/\">Support Forums</a>"
220
  msgstr ""
221
 
531
  msgstr ""
532
 
533
  #: bp-activity/bp-activity-classes.php:257
534
+ #: bp-activity/bp-activity-template.php:143 bp-groups/bp-groups-classes.php:583
535
  #: bp-groups/bp-groups-template.php:114
536
  msgid "Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details."
537
  msgstr ""
538
 
539
+ #: bp-activity/bp-activity-classes.php:1156
540
  msgid "RSS feed 'id' must be defined"
541
  msgstr ""
542
 
543
+ #: bp-activity/bp-activity-classes.php:1269
544
  msgid "In reply to"
545
  msgstr ""
546
 
609
  #: bp-activity/bp-activity-loader.php:306 bp-core/bp-core-template.php:364
610
  #: bp-groups/bp-groups-admin.php:32 bp-groups/bp-groups-admin.php:33
611
  #: bp-groups/bp-groups-admin.php:638 bp-groups/bp-groups-loader.php:516
612
+ #: bp-groups/bp-groups-notifications.php:371
613
+ #: bp-groups/bp-groups-notifications.php:407
614
+ #: bp-groups/bp-groups-notifications.php:443
615
+ #: bp-groups/bp-groups-notifications.php:479
616
  #: bp-groups/bp-groups-screens.php:894 bp-groups/bp-groups-screens.php:1026
617
  #: bp-groups/bp-groups-screens.php:1028 bp-groups/bp-groups-screens.php:1087
618
  #: bp-groups/bp-groups-screens.php:1089 bp-groups/bp-groups-widgets.php:53
687
  #: bp-friends/bp-friends-notifications.php:56
688
  #: bp-friends/bp-friends-notifications.php:105
689
  #: bp-groups/bp-groups-notifications.php:44
690
+ #: bp-groups/bp-groups-notifications.php:102
691
+ #: bp-groups/bp-groups-notifications.php:167
692
+ #: bp-groups/bp-groups-notifications.php:226
693
+ #: bp-groups/bp-groups-notifications.php:289
694
+ #: bp-messages/bp-messages-notifications.php:85
695
  msgid "To disable these notifications please log in and go to: %s"
696
  msgstr ""
697
 
958
  msgid "Profile picture of site author %s"
959
  msgstr ""
960
 
961
+ #: bp-blogs/bp-blogs-template.php:633 bp-core/bp-core-classes.php:804
962
  #: bp-groups/bp-groups-widgets.php:85 bp-groups/bp-groups-widgets.php:188
963
  #: bp-members/bp-members-template.php:596
964
  #: bp-members/bp-members-template.php:871
1090
  msgstr ""
1091
 
1092
  #: bp-core/admin/bp-core-components.php:26
1093
+ #: bp-core/admin/bp-core-functions.php:382
1094
  msgid "Components"
1095
  msgstr ""
1096
 
1265
  msgid "Components, Pages, Settings, and Forums, have been moved to <a href=\"%s\">Settings &gt; BuddyPress</a>. Profile Fields has been moved into the <a href=\"%s\">Users</a> menu."
1266
  msgstr ""
1267
 
1268
+ #: bp-core/admin/bp-core-functions.php:243
1269
  msgid "<strong>BuddyPress is almost ready</strong>. You must <a href=\"%s\">update your permalink structure</a> to something other than the default for it to work."
1270
  msgstr ""
1271
 
1272
+ #: bp-core/admin/bp-core-functions.php:267 bp-core/admin/bp-core-slugs.php:135
1273
  #: bp-messages/bp-messages-template.php:601
1274
  #: bp-templates/bp-legacy/buddypress/members/activate.php:29
1275
  #: bp-themes/bp-default/registration/activate.php:38
1276
  msgid "Activate"
1277
  msgstr ""
1278
 
1279
+ #: bp-core/admin/bp-core-functions.php:272 bp-core/admin/bp-core-slugs.php:134
1280
  #: bp-members/bp-members-adminbar.php:60
1281
  msgid "Register"
1282
  msgstr ""
1283
 
1284
+ #: bp-core/admin/bp-core-functions.php:298
1285
+ msgid "The following active BuddyPress Components do not have associated WordPress Pages: %2$s. <a href=\"%1$s\">Repair</a>"
1286
  msgstr ""
1287
 
1288
+ #: bp-core/admin/bp-core-functions.php:320
1289
+ msgid "Each BuddyPress Component needs its own WordPress page. The following WordPress Pages have more than one component associated with them: %2$s. <a href=\"%1$s\">Repair</a>"
1290
  msgstr ""
1291
 
1292
+ #: bp-core/admin/bp-core-functions.php:386 bp-core/admin/bp-core-slugs.php:26
1293
  msgid "Pages"
1294
  msgstr ""
1295
 
1296
+ #: bp-core/admin/bp-core-functions.php:390
1297
+ #: bp-core/admin/bp-core-settings.php:258 bp-core/bp-core-admin.php:375
1298
  #: bp-groups/bp-groups-loader.php:304 bp-groups/bp-groups-template.php:1468
1299
  #: bp-settings/bp-settings-loader.php:23 bp-settings/bp-settings-loader.php:73
1300
  #: bp-settings/bp-settings-loader.php:163
1301
  msgid "Settings"
1302
  msgstr ""
1303
 
1304
+ #: bp-core/admin/bp-core-functions.php:403 bp-core/bp-core-template.php:370
1305
  #: bp-forums/bp-forums-loader.php:132 bp-forums/bp-forums-loader.php:199
1306
  #: bp-forums/bp-forums-loader.php:240 bp-forums/bp-forums-screens.php:208
1307
  #: bp-forums/bp-forums-screens.php:210 bp-forums/deprecated/1.6.php:42
1309
  msgid "Forums"
1310
  msgstr ""
1311
 
1312
+ #: bp-core/admin/bp-core-functions.php:451
1313
  msgid "<a href=\"http://codex.buddypress.org/getting-started/configure-buddypress-components/#settings-buddypress-components\">Managing Components</a>"
1314
  msgstr ""
1315
 
1316
+ #: bp-core/admin/bp-core-functions.php:469
1317
  msgid "<a href=\"http://codex.buddypress.org/getting-started/configure-buddypress-components/#settings-buddypress-pages\">Managing Pages</a>"
1318
  msgstr ""
1319
 
1320
+ #: bp-core/admin/bp-core-functions.php:488
1321
  msgid "<a href=\"http://codex.buddypress.org/getting-started/configure-buddypress-components/#settings-buddypress-settings\">Managing Settings</a>"
1322
  msgstr ""
1323
 
1324
+ #: bp-core/admin/bp-core-functions.php:507
1325
  msgid "<a href=\"http://codex.buddypress.org/getting-started/configure-buddypress-components/#users-profile-fields\">Managing Profile Fields</a>"
1326
  msgstr ""
1327
 
1328
+ #: bp-core/admin/bp-core-functions.php:525
1329
  msgid "By default, all BuddyPress components are enabled. You can selectively disable any of the components by using the form. Your BuddyPress installation will continue to function. However, the features of the disabled components will no longer be accessible to anyone using the site."
1330
  msgstr ""
1331
 
1332
+ #: bp-core/admin/bp-core-functions.php:529
1333
  msgid "BuddyPress Components use WordPress Pages for their root directory/archive pages. Here you can change the page associations for each active component."
1334
  msgstr ""
1335
 
1336
+ #: bp-core/admin/bp-core-functions.php:533
1337
  msgid "Extra configuration settings."
1338
  msgstr ""
1339
 
1340
+ #: bp-core/admin/bp-core-functions.php:537
1341
  msgid "Your users will distinguish themselves through their profile page. Create relevant profile fields that will show on each users profile.</br></br>Note: Any fields in the first group will appear on the signup page."
1342
  msgstr ""
1343
 
1344
+ #: bp-core/admin/bp-core-functions.php:697 bp-core/bp-core-admin.php:200
1345
+ #: bp-core/bp-core-admin.php:201 bp-core/bp-core-admin.php:221
1346
  msgid "BuddyPress"
1347
  msgstr ""
1348
 
1349
+ #: bp-core/admin/bp-core-functions.php:719
1350
+ #: bp-core/admin/bp-core-functions.php:728
1351
  msgid "Logged-In"
1352
  msgstr ""
1353
 
1354
+ #: bp-core/admin/bp-core-functions.php:722
1355
+ #: bp-core/admin/bp-core-functions.php:737
1356
  msgid "Logged-Out"
1357
  msgstr ""
1358
 
1359
+ #: bp-core/admin/bp-core-functions.php:729
1360
  msgid "<em>Logged-In</em> links are relative to the current user, and are not visible to visitors who are not logged in."
1361
  msgstr ""
1362
 
1363
+ #: bp-core/admin/bp-core-functions.php:738
1364
  msgid "<em>Logged-Out</em> links are not visible to users who are logged in."
1365
  msgstr ""
1366
 
1367
+ #: bp-core/admin/bp-core-functions.php:748
1368
  msgid "Add to Menu"
1369
  msgstr ""
1370
 
1462
  msgid "Associate WordPress Pages with the following BuddyPress Registration pages."
1463
  msgstr ""
1464
 
1465
+ #: bp-core/bp-core-admin.php:180 bp-core/bp-core-admin.php:181
1466
+ #: bp-core/bp-core-admin.php:189 bp-core/bp-core-admin.php:190
1467
  msgid "Welcome to BuddyPress"
1468
  msgstr ""
1469
 
1470
+ #: bp-core/bp-core-admin.php:210
1471
  msgid "BuddyPress Help"
1472
  msgstr ""
1473
 
1474
+ #: bp-core/bp-core-admin.php:211
1475
  msgid "Help"
1476
  msgstr ""
1477
 
1478
+ #: bp-core/bp-core-admin.php:220
1479
  msgid "BuddyPress Components"
1480
  msgstr ""
1481
 
1482
+ #: bp-core/bp-core-admin.php:229 bp-core/bp-core-admin.php:230
1483
  msgid "BuddyPress Pages"
1484
  msgstr ""
1485
 
1486
+ #: bp-core/bp-core-admin.php:238 bp-core/bp-core-admin.php:239
1487
  msgid "BuddyPress Settings"
1488
  msgstr ""
1489
 
1490
+ #: bp-core/bp-core-admin.php:265
1491
  msgid "Main Settings"
1492
  msgstr ""
1493
 
1494
+ #: bp-core/bp-core-admin.php:268 bp-core/bp-core-admin.php:273
1495
  msgid "Toolbar"
1496
  msgstr ""
1497
 
1498
+ #: bp-core/bp-core-admin.php:278
1499
  msgid "Account Deletion"
1500
  msgstr ""
1501
 
1502
+ #: bp-core/bp-core-admin.php:286
1503
  msgid "Profile Settings"
1504
  msgstr ""
1505
 
1506
+ #: bp-core/bp-core-admin.php:289
1507
  msgid "Avatar Uploads"
1508
  msgstr ""
1509
 
1510
+ #: bp-core/bp-core-admin.php:293
1511
  msgid "Profile Syncing"
1512
  msgstr ""
1513
 
1514
+ #: bp-core/bp-core-admin.php:302
1515
  msgid "Groups Settings"
1516
  msgstr ""
1517
 
1518
+ #: bp-core/bp-core-admin.php:305
1519
  msgid "Group Creation"
1520
  msgstr ""
1521
 
1522
+ #: bp-core/bp-core-admin.php:314
1523
  msgid "Legacy Group Forums"
1524
  msgstr ""
1525
 
1526
+ #: bp-core/bp-core-admin.php:317
1527
  msgid "bbPress Configuration"
1528
  msgstr ""
1529
 
1530
+ #: bp-core/bp-core-admin.php:326
1531
  msgid "Activity Settings"
1532
  msgstr ""
1533
 
1534
+ #: bp-core/bp-core-admin.php:329
1535
  msgid "Blog &amp; Forum Comments"
1536
  msgstr ""
1537
 
1538
+ #: bp-core/bp-core-admin.php:334
1539
  msgid "Akismet"
1540
  msgstr ""
1541
 
1542
+ #: bp-core/bp-core-admin.php:352
1543
+ msgid "About BuddyPress"
1544
+ msgstr ""
1545
+
1546
+ #: bp-core/bp-core-admin.php:376
1547
  msgid "About"
1548
  msgstr ""
1549
 
1550
+ #: bp-core/bp-core-admin.php:427 bp-core/bp-core-admin.php:552
1551
  msgid "Welcome to BuddyPress %s"
1552
  msgstr ""
1553
 
1554
+ #: bp-core/bp-core-admin.php:430
1555
+ msgid "It&#8217;s a great time to use BuddyPress! %s is our first version with a new component in over two years. Not only that, there are plenty of new features, enhancements, and bug fixes."
1556
+ msgstr ""
1557
+
1558
+ #: bp-core/bp-core-admin.php:432
1559
+ msgid "Thanks for updating! BuddyPress %s is our first version with a new component in over two years. Not only that, there are plenty of new features, enhancements, and bug fixes."
1560
+ msgstr ""
1561
+
1562
+ #: bp-core/bp-core-admin.php:437
1563
+ msgid "Check out the highlights:"
1564
  msgstr ""
1565
 
1566
+ #: bp-core/bp-core-admin.php:440
1567
+ msgid "You can now add dynamic BuddyPress links to custom navigation menus."
1568
  msgstr ""
1569
 
1570
+ #: bp-core/bp-core-admin.php:441
1571
+ msgid "Notifications have been moved into their own component."
1572
+ msgstr ""
1573
+
1574
+ #: bp-core/bp-core-admin.php:442
1575
+ msgid "Three new widgets, allowing easier site customization."
1576
+ msgstr ""
1577
+
1578
+ #: bp-core/bp-core-admin.php:446 bp-core/bp-core-admin.php:554
1579
  msgid "Version %s"
1580
  msgstr ""
1581
 
1582
+ #: bp-core/bp-core-admin.php:450 bp-core/bp-core-admin.php:558
1583
  msgid "What&#8217;s New"
1584
  msgstr ""
1585
 
1586
+ #: bp-core/bp-core-admin.php:452 bp-core/bp-core-admin.php:560
1587
  msgid "Credits"
1588
  msgstr ""
1589
 
1590
+ #: bp-core/bp-core-admin.php:457
1591
  msgid "Getting Started"
1592
  msgstr ""
1593
 
1594
+ #: bp-core/bp-core-admin.php:460
1595
  msgid "Your Default Setup"
1596
  msgstr ""
1597
 
1598
+ #: bp-core/bp-core-admin.php:464
1599
  msgid "BuddyPress&#8217;s powerful features help your users connect and collaborate. To help get your community started, we&#8217;ve activated two of the most commonly used tools in BP: <strong>Extended Profiles</strong> and <strong>Activity Streams</strong>. See these components in action at the %1$s and %2$s directories, and be sure to spend a few minutes <a href=\"%3$s\">configuring user profiles</a>. Want to explore more of BP&#8217;s features? Visit the <a href=\"%4$s\">Components panel</a>."
1600
  msgstr ""
1601
 
1602
+ #: bp-core/bp-core-admin.php:465 bp-core/bp-core-template.php:361
1603
  #: bp-core/bp-core-widgets.php:266 bp-groups/bp-groups-admin.php:776
1604
  #: bp-groups/bp-groups-template.php:1476 bp-members/bp-members-loader.php:24
1605
  #: bp-members/bp-members-screens.php:368
1608
  msgid "Members"
1609
  msgstr ""
1610
 
1611
+ #: bp-core/bp-core-admin.php:473
1612
  msgid "BuddyPress&#8217;s powerful features help your users connect and collaborate. Want to explore BP&#8217;s features? Visit the <a href=\"%s\">Components panel</a>."
1613
  msgstr ""
1614
 
1615
+ #: bp-core/bp-core-admin.php:479
1616
  msgid "Community and Support"
1617
  msgstr ""
1618
 
1619
+ #: bp-core/bp-core-admin.php:480
1620
  msgid "Looking for help? The <a href=\"http://codex.buddypress.org/\">BuddyPress Codex</a> has you covered, with dozens of user-contributed guides on how to configure and use your BP site. Can&#8217;t find what you need? Stop by <a href=\"http://buddypress.org/support/\">our support forums</a>, where a vibrant community of BuddyPress users and developers is waiting to share tips, show off their sites, talk about the future of BuddyPress, and much more."
1621
  msgstr ""
1622
 
1623
+ #: bp-core/bp-core-admin.php:487
1624
+ msgid "Dynamic links for custom navigation menus"
 
 
 
 
 
 
 
 
 
 
 
 
1625
  msgstr ""
1626
 
1627
+ #: bp-core/bp-core-admin.php:490
1628
+ msgid "It&#8217;s now easy to add BuddyPress-specific links to your menus through <a href=\"%s\">Appearance &gt; Menus</a>. For example, you can now add a link to a specific user profile screen, and each person will end up at that screen inside their own user profile."
1629
  msgstr ""
1630
 
1631
+ #: bp-core/bp-core-admin.php:496
1632
+ msgid "Notifications component"
1633
  msgstr ""
1634
 
1635
+ #: bp-core/bp-core-admin.php:499
1636
+ msgid "The notification features have been promoted into a new component. Use it to keep your site&#8217;s members abreast of the latest connections and @mentions within the site, via email notifications and Toolbar alerts."
1637
  msgstr ""
1638
 
1639
+ #: bp-core/bp-core-admin.php:506
1640
+ msgid "Widgets"
1641
  msgstr ""
1642
 
1643
+ #: bp-core/bp-core-admin.php:510
1644
+ msgid "<strong>Friends Widget</strong>: a list of recently active, popular, and newest friends of the displayed member."
1645
  msgstr ""
1646
 
1647
+ #: bp-core/bp-core-admin.php:511
1648
+ msgid "<strong>Log In Widget</strong>: adds a simple &ldquo;Log In&rdquo; form to your site."
1649
  msgstr ""
1650
 
1651
+ #: bp-core/bp-core-admin.php:512
1652
+ msgid "<strong>Sitewide Notices Widget</strong>: display Sitewide Notices from the Private Messaging component."
1653
  msgstr ""
1654
 
1655
+ #: bp-core/bp-core-admin.php:519
1656
+ msgid "Developer changes"
1657
  msgstr ""
1658
 
1659
+ #: bp-core/bp-core-admin.php:523
1660
+ msgid "<code>bp_redirect_canonical()</code> functionality has been reinstated"
1661
  msgstr ""
1662
 
1663
+ #: bp-core/bp-core-admin.php:524
1664
+ msgid "Improved phpDoc inline documentation"
1665
  msgstr ""
1666
 
1667
+ #: bp-core/bp-core-admin.php:525
1668
+ msgid "Improved compatibility with <a href=\"%s\">develop.svn.wordpress.org</a> unit-test suite"
1669
  msgstr ""
1670
 
1671
+ #: bp-core/bp-core-admin.php:526
1672
+ msgid "<a href=\"%s\">&hellip;and lots more!</a>"
1673
  msgstr ""
1674
 
1675
+ #: bp-core/bp-core-admin.php:531 bp-core/bp-core-admin.php:662
1676
  msgid "Go to the BuddyPress Settings page"
1677
  msgstr ""
1678
 
1679
+ #: bp-core/bp-core-admin.php:553
1680
+ msgid "BuddyPress %s is our first version with a new component in over two years. Not only that, there are plenty of new features, enhancements, and bug fixes."
1681
  msgstr ""
1682
 
1683
+ #: bp-core/bp-core-admin.php:564
1684
  msgid "BuddyPress is created by a worldwide network of friendly folks."
1685
  msgstr ""
1686
 
1687
+ #: bp-core/bp-core-admin.php:566
1688
  msgid "Project Leaders"
1689
  msgstr ""
1690
 
1691
+ #: bp-core/bp-core-admin.php:571
1692
  msgid "Founding Developer"
1693
  msgstr ""
1694
 
1695
+ #: bp-core/bp-core-admin.php:576
1696
  msgid "Project Lead"
1697
  msgstr ""
1698
 
1699
+ #: bp-core/bp-core-admin.php:581 bp-core/bp-core-admin.php:586
1700
  msgid "Lead Developer"
1701
  msgstr ""
1702
 
1703
+ #: bp-core/bp-core-admin.php:590
1704
  msgid "Core Developers"
1705
  msgstr ""
1706
 
1707
+ #: bp-core/bp-core-admin.php:598
1708
  msgid "Recent Rockstars"
1709
  msgstr ""
1710
 
1711
+ #: bp-core/bp-core-admin.php:618
1712
  msgid "Contributors to BuddyPress 1.9"
1713
  msgstr ""
1714
 
1760
  msgid "Upload failed! Error was: %s"
1761
  msgstr ""
1762
 
1763
+ #: bp-core/bp-core-avatars.php:831 bp-core/bp-core-classes.php:801
1764
+ #: bp-core/bp-core-classes.php:802 bp-core/bp-core-classes.php:803
1765
  #: bp-core/bp-core-template.php:135 bp-core/bp-core-template.php:151
1766
  msgid "Avatar of %s"
1767
  msgstr ""
1770
  msgid "You do not have access to this page."
1771
  msgstr ""
1772
 
1773
+ #: bp-core/bp-core-buddybar.php:552 bp-core/bp-core-functions.php:1718
1774
  #: bp-core/bp-core-widgets.php:89 bp-themes/bp-default/sidebar.php:52
1775
  msgid "Log In"
1776
  msgstr ""
1779
  msgid "Sign Up"
1780
  msgstr ""
1781
 
1782
+ #: bp-core/bp-core-buddybar.php:613 bp-core/bp-core-functions.php:1651
1783
  #: bp-core/bp-core-widgets.php:71 bp-core/deprecated/1.5.php:307
1784
  #: bp-members/bp-members-template.php:774 bp-themes/bp-default/sidebar.php:18
1785
  msgid "Log Out"
1814
  msgid "You must log in to access the page you requested."
1815
  msgstr ""
1816
 
1817
+ #: bp-core/bp-core-classes.php:818
1818
  msgid "%d group"
1819
  msgid_plural "%d groups"
1820
  msgstr[0] ""
1845
  msgid "Activate %s"
1846
  msgstr ""
1847
 
1848
+ #: bp-core/bp-core-filters.php:310 bp-members/bp-members-functions.php:1471
1849
  msgid ""
1850
  "Thanks for registering! To complete the activation of your account please click the following link:\n"
1851
  "\n"
1853
  "\n"
1854
  msgstr ""
1855
 
1856
+ #: bp-core/bp-core-filters.php:311 bp-members/bp-members-functions.php:1472
1857
  msgid "Activate Your Account"
1858
  msgstr ""
1859
 
1926
  msgid "Register"
1927
  msgstr ""
1928
 
1929
+ #: bp-core/bp-core-functions.php:690
1930
  msgid "sometime"
1931
  msgstr ""
1932
 
1933
+ #: bp-core/bp-core-functions.php:691
1934
  msgid "right now"
1935
  msgstr ""
1936
 
1937
+ #: bp-core/bp-core-functions.php:692
1938
  msgid "%s ago"
1939
  msgstr ""
1940
 
1941
+ #: bp-core/bp-core-functions.php:753
1942
  msgid "%s year"
1943
  msgid_plural "%s years"
1944
  msgstr[0] ""
1945
  msgstr[1] ""
1946
 
1947
+ #: bp-core/bp-core-functions.php:756 bp-core/bp-core-functions.php:790
1948
  msgid "%s month"
1949
  msgid_plural "%s months"
1950
  msgstr[0] ""
1951
  msgstr[1] ""
1952
 
1953
+ #: bp-core/bp-core-functions.php:759 bp-core/bp-core-functions.php:793
1954
  msgid "%s week"
1955
  msgid_plural "%s weeks"
1956
  msgstr[0] ""
1957
  msgstr[1] ""
1958
 
1959
+ #: bp-core/bp-core-functions.php:762 bp-core/bp-core-functions.php:796
1960
  msgid "%s day"
1961
  msgid_plural "%s days"
1962
  msgstr[0] ""
1963
  msgstr[1] ""
1964
 
1965
+ #: bp-core/bp-core-functions.php:765 bp-core/bp-core-functions.php:799
1966
  msgid "%s hour"
1967
  msgid_plural "%s hours"
1968
  msgstr[0] ""
1969
  msgstr[1] ""
1970
 
1971
+ #: bp-core/bp-core-functions.php:768 bp-core/bp-core-functions.php:802
1972
  msgid "%s minute"
1973
  msgid_plural "%s minutes"
1974
  msgstr[0] ""
1975
  msgstr[1] ""
1976
 
1977
+ #: bp-core/bp-core-functions.php:771 bp-core/bp-core-functions.php:805
1978
  msgid "%s second"
1979
  msgid_plural "%s seconds"
1980
  msgstr[0] ""
1981
  msgstr[1] ""
1982
 
1983
+ #: bp-core/bp-core-functions.php:786
1984
  msgctxt "Separator in time since"
1985
  msgid ","
1986
  msgstr ""
1987
 
1988
+ #: bp-core/bp-core-functions.php:971
1989
  msgid "Not recently active"
1990
  msgstr ""
1991
 
3078
  msgstr ""
3079
 
3080
  #: bp-groups/bp-groups-admin.php:877 bp-groups/bp-groups-adminbar.php:101
3081
+ #: bp-groups/bp-groups-buddybar.php:58
3082
  #: bp-templates/bp-legacy/buddypress/groups/single/admin.php:360
3083
  #: bp-themes/bp-default/groups/single/admin.php:360
3084
  #: bp-xprofile/bp-xprofile-admin.php:118
3085
  msgid "Delete Group"
3086
  msgstr ""
3087
 
3088
+ #: bp-groups/bp-groups-admin.php:881 bp-groups/bp-groups-classes.php:2965
3089
  #: bp-templates/bp-legacy/buddypress/groups/single/admin.php:32
3090
  #: bp-templates/bp-legacy/buddypress/groups/single/admin.php:117
3091
  #: bp-templates/bp-legacy/buddypress/groups/single/forum/edit.php:58
3173
  msgid "Select group %1$d"
3174
  msgstr ""
3175
 
3176
+ #: bp-groups/bp-groups-adminbar.php:47 bp-groups/bp-groups-buddybar.php:34
3177
  msgid "Edit Details"
3178
  msgstr ""
3179
 
3185
  msgid "Edit Avatar"
3186
  msgstr ""
3187
 
3188
+ #: bp-groups/bp-groups-adminbar.php:74 bp-groups/bp-groups-buddybar.php:46
3189
  msgid "Manage Invitations"
3190
  msgstr ""
3191
 
3192
+ #: bp-groups/bp-groups-adminbar.php:83 bp-groups/bp-groups-buddybar.php:50
3193
  msgid "Manage Members"
3194
  msgstr ""
3195
 
3196
+ #: bp-groups/bp-groups-adminbar.php:92 bp-groups/bp-groups-buddybar.php:54
3197
  msgid "Membership Requests"
3198
  msgstr ""
3199
 
3200
+ #: bp-groups/bp-groups-buddybar.php:31 bp-members/bp-members-buddybar.php:94
3201
  msgid "Admin Options"
3202
  msgstr ""
3203
 
3204
+ #: bp-groups/bp-groups-buddybar.php:36
3205
  msgid "Group Settings"
3206
  msgstr ""
3207
 
3208
+ #: bp-groups/bp-groups-buddybar.php:40 bp-groups/bp-groups-loader.php:590
3209
  #: bp-groups/bp-groups-template.php:2634
3210
  msgid "Group Avatar"
3211
  msgstr ""
3212
 
3213
+ #: bp-groups/bp-groups-classes.php:1868
3214
  msgid "Group Mod"
3215
  msgstr ""
3216
 
3217
+ #: bp-groups/bp-groups-classes.php:1874 bp-groups/bp-groups-functions.php:121
3218
  msgid "Group Admin"
3219
  msgstr ""
3220
 
3330
  "---------------------\n"
3331
  msgstr ""
3332
 
3333
+ #: bp-groups/bp-groups-notifications.php:85
3334
  msgid "Membership request for group: %s"
3335
  msgstr ""
3336
 
3337
+ #: bp-groups/bp-groups-notifications.php:87
3338
  msgid ""
3339
  "%1$s wants to join the group \"%2$s\".\n"
3340
  "\n"
3348
  "---------------------\n"
3349
  msgstr ""
3350
 
3351
+ #: bp-groups/bp-groups-notifications.php:145
3352
  msgid "Membership request for group \"%s\" accepted"
3353
  msgstr ""
3354
 
3355
+ #: bp-groups/bp-groups-notifications.php:146
3356
  msgid ""
3357
  "Your membership request for the group \"%1$s\" has been accepted.\n"
3358
  "\n"
3361
  "---------------------\n"
3362
  msgstr ""
3363
 
3364
+ #: bp-groups/bp-groups-notifications.php:155
3365
  msgid "Membership request for group \"%s\" rejected"
3366
  msgstr ""
3367
 
3368
+ #: bp-groups/bp-groups-notifications.php:156
3369
  msgid ""
3370
  "Your membership request for the group \"%1$s\" has been rejected.\n"
3371
  "\n"
3374
  "---------------------\n"
3375
  msgstr ""
3376
 
3377
+ #: bp-groups/bp-groups-notifications.php:185
3378
  msgid "an administrator"
3379
  msgstr ""
3380
 
3381
+ #: bp-groups/bp-groups-notifications.php:188
3382
  msgid "a moderator"
3383
  msgstr ""
3384
 
3385
+ #: bp-groups/bp-groups-notifications.php:215
3386
  msgid "You have been promoted in the group: \"%s\""
3387
  msgstr ""
3388
 
3389
+ #: bp-groups/bp-groups-notifications.php:216
3390
  msgid ""
3391
  "You have been promoted to %1$s for the group: \"%2$s\".\n"
3392
  "\n"
3395
  "---------------------\n"
3396
  msgstr ""
3397
 
3398
+ #: bp-groups/bp-groups-notifications.php:273
3399
  msgid "You have an invitation to the group: \"%s\""
3400
  msgstr ""
3401
 
3402
+ #: bp-groups/bp-groups-notifications.php:275
3403
  msgid ""
3404
  "One of your friends %1$s has invited you to the group: \"%2$s\".\n"
3405
  "\n"
3412
  "---------------------\n"
3413
  msgstr ""
3414
 
3415
+ #: bp-groups/bp-groups-notifications.php:329
3416
  msgid "%1$d new membership requests for the group \"%2$s\""
3417
  msgstr ""
3418
 
3419
+ #: bp-groups/bp-groups-notifications.php:334
3420
  msgid "Group Membership Requests"
3421
  msgstr ""
3422
 
3423
+ #: bp-groups/bp-groups-notifications.php:343
3424
+ #: bp-groups/bp-groups-notifications.php:348
3425
  msgid "%s requests group membership"
3426
  msgstr ""
3427
 
3428
+ #: bp-groups/bp-groups-notifications.php:366
3429
  msgid "%d accepted group membership requests"
3430
  msgstr ""
3431
 
3432
+ #: bp-groups/bp-groups-notifications.php:379
3433
  msgid "Membership for group \"%s\" accepted"
3434
  msgstr ""
3435
 
3436
+ #: bp-groups/bp-groups-notifications.php:402
3437
  msgid "%d rejected group membership requests"
3438
  msgstr ""
3439
 
3440
+ #: bp-groups/bp-groups-notifications.php:415
3441
  msgid "Membership for group \"%s\" rejected"
3442
  msgstr ""
3443
 
3444
+ #: bp-groups/bp-groups-notifications.php:438
3445
  msgid "You were promoted to an admin in %d groups"
3446
  msgstr ""
3447
 
3448
+ #: bp-groups/bp-groups-notifications.php:451
3449
  msgid "You were promoted to an admin in the group \"%s\""
3450
  msgstr ""
3451
 
3452
+ #: bp-groups/bp-groups-notifications.php:474
3453
  msgid "You were promoted to a mod in %d groups"
3454
  msgstr ""
3455
 
3456
+ #: bp-groups/bp-groups-notifications.php:487
3457
  msgid "You were promoted to a mod in the group \"%s\""
3458
  msgstr ""
3459
 
3460
+ #: bp-groups/bp-groups-notifications.php:511
3461
  msgid "You have %d new group invitations"
3462
  msgstr ""
3463
 
3464
+ #: bp-groups/bp-groups-notifications.php:515
3465
  msgid "Group Invites"
3466
  msgstr ""
3467
 
3468
+ #: bp-groups/bp-groups-notifications.php:523
3469
  msgid "You have an invitation to the group: %s"
3470
  msgstr ""
3471
 
3972
  msgstr ""
3973
 
3974
  #: bp-members/bp-members-functions.php:977
3975
+ #: bp-members/bp-members-functions.php:1599
3976
  msgid "<strong>ERROR</strong>: Your account has been marked as a spammer."
3977
  msgstr ""
3978
 
3979
+ #: bp-members/bp-members-functions.php:1158
3980
  msgid "Please check your email address."
3981
  msgstr ""
3982
 
3983
+ #: bp-members/bp-members-functions.php:1161
3984
+ #: bp-members/bp-members-functions.php:1164
3985
  msgid "Sorry, that email address is not allowed!"
3986
  msgstr ""
3987
 
3988
+ #: bp-members/bp-members-functions.php:1167
3989
  msgid "Sorry, that email address is already used!"
3990
  msgstr ""
3991
 
3992
+ #: bp-members/bp-members-functions.php:1198
3993
  msgid "Please enter a username"
3994
  msgstr ""
3995
 
3996
+ #: bp-members/bp-members-functions.php:1204
3997
  msgid "That username is not allowed"
3998
  msgstr ""
3999
 
4000
+ #: bp-members/bp-members-functions.php:1209
4001
  msgid "Usernames can contain only letters, numbers, ., -, and @"
4002
  msgstr ""
4003
 
4004
+ #: bp-members/bp-members-functions.php:1214
4005
  msgid "Username must be at least 4 characters"
4006
  msgstr ""
4007
 
4008
+ #: bp-members/bp-members-functions.php:1219
4009
  msgid "Sorry, usernames may not contain the character \"_\"!"
4010
  msgstr ""
4011
 
4012
+ #: bp-members/bp-members-functions.php:1226
4013
  msgid "Sorry, usernames must have letters too!"
4014
  msgstr ""
4015
 
4016
+ #: bp-members/bp-members-functions.php:1231
4017
  msgid "Sorry, that username already exists!"
4018
  msgstr ""
4019
 
4020
+ #: bp-members/bp-members-functions.php:1282
4021
  msgid "<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a href=\"mailto:%s\">webmaster</a> !"
4022
  msgstr ""
4023
 
4024
+ #: bp-members/bp-members-functions.php:1380
4025
+ #: bp-members/bp-members-functions.php:1384
4026
  msgid "Invalid activation key"
4027
  msgstr ""
4028
 
4029
+ #: bp-members/bp-members-functions.php:1421
4030
  msgid "%s became a registered member"
4031
  msgstr ""
4032
 
4033
+ #: bp-members/bp-members-functions.php:1505
4034
  msgid "<strong>ERROR</strong>: Your account has not been activated. Check your email for the activation link."
4035
  msgstr ""
4036
 
4171
 
4172
  #: bp-messages/bp-messages-loader.php:132
4173
  #: bp-messages/bp-messages-loader.php:196
4174
+ #: bp-messages/bp-messages-notifications.php:117
4175
  msgid "Inbox"
4176
  msgstr ""
4177
 
4210
  msgid "My Messages"
4211
  msgstr ""
4212
 
4213
+ #: bp-messages/bp-messages-notifications.php:69
4214
  msgid "New message from %s"
4215
  msgstr ""
4216
 
4217
+ #: bp-messages/bp-messages-notifications.php:71
4218
  msgid ""
4219
  "%1$s sent you a new message:\n"
4220
  "\n"
4227
  "---------------------\n"
4228
  msgstr ""
4229
 
4230
+ #: bp-messages/bp-messages-notifications.php:120
4231
  msgid "You have %d new messages"
4232
  msgstr ""
4233
 
4234
+ #: bp-messages/bp-messages-notifications.php:124
4235
  msgid "You have %d new message from %s"
4236
  msgstr ""
4237
 
4238
+ #: bp-messages/bp-messages-notifications.php:126
4239
  msgid "You have %d new message"
4240
  msgstr ""
4241
 
bp-loader.php CHANGED
@@ -16,7 +16,7 @@
16
  * Description: Social networking in a box. Build a social network for your company, school, sports team or niche community all based on the power and flexibility of WordPress.
17
  * Author: The BuddyPress Community
18
  * Author URI: http://buddypress.org/community/members/
19
- * Version: 1.9-beta2
20
  * Text Domain: buddypress
21
  * Domain Path: /bp-languages/
22
  * License: GPLv2 or later (license.txt)
@@ -297,7 +297,7 @@ class BuddyPress {
297
 
298
  /** Versions **********************************************************/
299
 
300
- $this->version = '1.9-beta2';
301
  $this->db_version = 7553;
302
 
303
  /** Loading ***********************************************************/
16
  * Description: Social networking in a box. Build a social network for your company, school, sports team or niche community all based on the power and flexibility of WordPress.
17
  * Author: The BuddyPress Community
18
  * Author URI: http://buddypress.org/community/members/
19
+ * Version: 1.9
20
  * Text Domain: buddypress
21
  * Domain Path: /bp-languages/
22
  * License: GPLv2 or later (license.txt)
297
 
298
  /** Versions **********************************************************/
299
 
300
+ $this->version = '1.9-7682';
301
  $this->db_version = 7553;
302
 
303
  /** Loading ***********************************************************/
bp-members/bp-members-functions.php CHANGED
@@ -1031,12 +1031,15 @@ function bp_core_flush_illegal_names() {
1031
  function bp_core_get_illegal_names( $value = '', $oldvalue = '' ) {
1032
 
1033
  // Make sure $value is array
1034
- if ( empty( $value ) )
1035
  $db_illegal_names = array();
1036
- if ( is_array( $value ) )
 
 
1037
  $db_illegal_names = $value;
1038
- elseif ( is_string( $value ) )
1039
  $db_illegal_names = explode( ' ', $value );
 
1040
 
1041
  // Add the core components' slugs to the banned list even if their components aren't active.
1042
  $bp_component_slugs = array(
@@ -1049,6 +1052,7 @@ function bp_core_get_illegal_names( $value = '', $oldvalue = '' ) {
1049
  'friends',
1050
  'search',
1051
  'settings',
 
1052
  'register',
1053
  'activate'
1054
  );
@@ -1064,12 +1068,15 @@ function bp_core_get_illegal_names( $value = '', $oldvalue = '' ) {
1064
  'BP_FRIENDS_SLUG',
1065
  'BP_SEARCH_SLUG',
1066
  'BP_SETTINGS_SLUG',
 
1067
  'BP_REGISTER_SLUG',
1068
  'BP_ACTIVATION_SLUG',
1069
  );
1070
- foreach( $slug_constants as $constant )
1071
- if ( defined( $constant ) )
1072
  $bp_component_slugs[] = constant( $constant );
 
 
1073
 
1074
  // Add our slugs to the array and allow them to be filtered
1075
  $filtered_illegal_names = apply_filters( 'bp_core_illegal_usernames', array_merge( array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' ), $bp_component_slugs ) );
1031
  function bp_core_get_illegal_names( $value = '', $oldvalue = '' ) {
1032
 
1033
  // Make sure $value is array
1034
+ if ( empty( $value ) ) {
1035
  $db_illegal_names = array();
1036
+ }
1037
+
1038
+ if ( is_array( $value ) ) {
1039
  $db_illegal_names = $value;
1040
+ } elseif ( is_string( $value ) ) {
1041
  $db_illegal_names = explode( ' ', $value );
1042
+ }
1043
 
1044
  // Add the core components' slugs to the banned list even if their components aren't active.
1045
  $bp_component_slugs = array(
1052
  'friends',
1053
  'search',
1054
  'settings',
1055
+ 'notifications',
1056
  'register',
1057
  'activate'
1058
  );
1068
  'BP_FRIENDS_SLUG',
1069
  'BP_SEARCH_SLUG',
1070
  'BP_SETTINGS_SLUG',
1071
+ 'BP_NOTIFICATIONS_SLUG',
1072
  'BP_REGISTER_SLUG',
1073
  'BP_ACTIVATION_SLUG',
1074
  );
1075
+ foreach( $slug_constants as $constant ) {
1076
+ if ( defined( $constant ) ) {
1077
  $bp_component_slugs[] = constant( $constant );
1078
+ }
1079
+ }
1080
 
1081
  // Add our slugs to the array and allow them to be filtered
1082
  $filtered_illegal_names = apply_filters( 'bp_core_illegal_usernames', array_merge( array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' ), $bp_component_slugs ) );
bp-messages/bp-messages-notifications.php CHANGED
@@ -16,13 +16,15 @@ if ( !defined( 'ABSPATH' ) ) exit;
16
  * Email message recipients to alert them of a new unread private message
17
  *
18
  * @since BuddyPress (1.0)
19
- * @param array $args
20
  */
21
- function messages_notification_new_message( $args = array() ) {
22
 
23
  // Cast possible $message object as an array
24
- if ( is_object( $args ) ) {
25
- $args = (array) $args;
 
 
26
  }
27
 
28
  // These should be extracted below
@@ -60,7 +62,7 @@ function messages_notification_new_message( $args = array() ) {
60
  // Sender info
61
  $sender_name = stripslashes( $sender_name );
62
  $subject = stripslashes( wp_filter_kses( $subject ) );
63
- $content = stripslashes( wp_filter_kses( $content ) );
64
 
65
  // Set up and send the message
66
  $email_to = $ud->user_email;
16
  * Email message recipients to alert them of a new unread private message
17
  *
18
  * @since BuddyPress (1.0)
19
+ * @param array $raw_args
20
  */
21
+ function messages_notification_new_message( $raw_args = array() ) {
22
 
23
  // Cast possible $message object as an array
24
+ if ( is_object( $raw_args ) ) {
25
+ $args = (array) $raw_args;
26
+ } else {
27
+ $args = $raw_args;
28
  }
29
 
30
  // These should be extracted below
62
  // Sender info
63
  $sender_name = stripslashes( $sender_name );
64
  $subject = stripslashes( wp_filter_kses( $subject ) );
65
+ $content = stripslashes( wp_filter_kses( $message ) );
66
 
67
  // Set up and send the message
68
  $email_to = $ud->user_email;
bp-notifications/bp-notifications-functions.php CHANGED
@@ -123,7 +123,8 @@ function bp_notifications_get_notifications_for_user( $user_id, $format = 'simpl
123
  // Setup local variables
124
  $bp = buddypress();
125
  $notifications = BP_Notifications_Notification::get( array(
126
- 'user_id' => $user_id,
 
127
  ) );
128
  $grouped_notifications = array(); // Notification groups
129
  $renderable = array(); // Renderable notifications
123
  // Setup local variables
124
  $bp = buddypress();
125
  $notifications = BP_Notifications_Notification::get( array(
126
+ 'user_id' => $user_id,
127
+ 'component_name' => array_keys( $bp->active_components ),
128
  ) );
129
  $grouped_notifications = array(); // Notification groups
130
  $renderable = array(); // Renderable notifications
bp-templates/bp-legacy/buddypress/members/single/groups/invites.php CHANGED
@@ -11,7 +11,7 @@
11
  <a href="<?php bp_group_permalink(); ?>"><?php bp_group_avatar( 'type=thumb&width=50&height=50' ); ?></a>
12
  </div>
13
 
14
- <h4><a href="<?php bp_group_permalink(); ?>"><?php bp_group_name(); ?></a><span class="small"> - <?php printf( _n( '1 member', '%d members', bp_get_group_total_members( false ), 'buddypress' ) ); ?></span></h4>
15
 
16
  <p class="desc">
17
  <?php bp_group_description_excerpt(); ?>
11
  <a href="<?php bp_group_permalink(); ?>"><?php bp_group_avatar( 'type=thumb&width=50&height=50' ); ?></a>
12
  </div>
13
 
14
+ <h4><a href="<?php bp_group_permalink(); ?>"><?php bp_group_name(); ?></a><span class="small"> - <?php printf( _n( '1 member', '%d members', bp_get_group_total_members( false ), 'buddypress' ), bp_get_group_total_members( false ) ); ?></span></h4>
15
 
16
  <p class="desc">
17
  <?php bp_group_description_excerpt(); ?>
bp-templates/bp-legacy/css/buddypress.css CHANGED
@@ -971,6 +971,8 @@ a.bp-title-button {
971
  #buddypress #groups-notification-settings {
972
  margin-bottom: 0;
973
  }
 
 
974
  #buddypress table.notification-settings th.icon,
975
  #buddypress table.notification-settings td:first-child {
976
  display: none;
971
  #buddypress #groups-notification-settings {
972
  margin-bottom: 0;
973
  }
974
+ #buddypress table.notifications th.icon,
975
+ #buddypress table.notifications td:first-child,
976
  #buddypress table.notification-settings th.icon,
977
  #buddypress table.notification-settings td:first-child {
978
  display: none;
bp-themes/bp-default/rtl.css CHANGED
@@ -2,7 +2,7 @@
2
  * Theme Name: BuddyPress Default
3
  * Theme URI: http://buddypress.org/extend/themes/
4
  * Description: Clean and stylish, BuddyPress Default lets you build a social network straight out of the box. Make it yours with a custom menu, header image, and background. Along with five widgetized areas (one in the sidebar, four in the footer), BP-Default supports featured images (as custom header images on posts and pages) and is furnished with an optional one-column page template that removes the sidebar, and a stylesheet for the admin Visual Editor.
5
- * Version: 1.9-beta2
6
  * Author: the BuddyPress team
7
  * Author URI: http://buddypress.org
8
  * License: GNU General Public License
2
  * Theme Name: BuddyPress Default
3
  * Theme URI: http://buddypress.org/extend/themes/
4
  * Description: Clean and stylish, BuddyPress Default lets you build a social network straight out of the box. Make it yours with a custom menu, header image, and background. Along with five widgetized areas (one in the sidebar, four in the footer), BP-Default supports featured images (as custom header images on posts and pages) and is furnished with an optional one-column page template that removes the sidebar, and a stylesheet for the admin Visual Editor.
5
+ * Version: 1.9
6
  * Author: the BuddyPress team
7
  * Author URI: http://buddypress.org
8
  * License: GNU General Public License
bp-themes/bp-default/style.css CHANGED
@@ -2,7 +2,7 @@
2
  * Theme Name: BuddyPress Default
3
  * Theme URI: http://buddypress.org/extend/themes/
4
  * Description: [NOTE: except for security issues, BuddyPress Default is no longer being actively maintained by the BuddyPress team.] Clean and stylish, BuddyPress Default lets you build a social network straight out of the box. Make it yours with a custom menu, header image, and background. Along with five widgetized areas (one in the sidebar, four in the footer), BP-Default supports featured images (as custom header images on posts and pages) and is furnished with an optional one-column page template that removes the sidebar, and a stylesheet for the admin Visual Editor.
5
- * Version: 1.9-beta2
6
  * Author: the BuddyPress team
7
  * Author URI: http://buddypress.org
8
  * License: GNU General Public License
2
  * Theme Name: BuddyPress Default
3
  * Theme URI: http://buddypress.org/extend/themes/
4
  * Description: [NOTE: except for security issues, BuddyPress Default is no longer being actively maintained by the BuddyPress team.] Clean and stylish, BuddyPress Default lets you build a social network straight out of the box. Make it yours with a custom menu, header image, and background. Along with five widgetized areas (one in the sidebar, four in the footer), BP-Default supports featured images (as custom header images on posts and pages) and is furnished with an optional one-column page template that removes the sidebar, and a stylesheet for the admin Visual Editor.
5
+ * Version: 1.9
6
  * Author: the BuddyPress team
7
  * Author URI: http://buddypress.org
8
  * License: GNU General Public License
bp-xprofile/bp-xprofile-template.php CHANGED
@@ -940,7 +940,7 @@ function bp_profile_visibility_radio_buttons() {
940
 
941
  // Only sanitize once
942
  $field_id = bp_get_the_profile_field_id();
943
- $level_id = esc_attr( $level_id );
944
 
945
  $html .= '<li><label for="see-field_' . $field_id . '_' . $level_id . '"><input type="radio" id="see-field_' . $field_id . '_' . $level_id . '" name="field_' . $field_id . '_visibility" value="' . $level_id . '"' . $checked . ' /> ' . esc_html( $level['label'] ) . '</label></li>';
946
  }
940
 
941
  // Only sanitize once
942
  $field_id = bp_get_the_profile_field_id();
943
+ $level_id = esc_attr( $level['id'] );
944
 
945
  $html .= '<li><label for="see-field_' . $field_id . '_' . $level_id . '"><input type="radio" id="see-field_' . $field_id . '_' . $level_id . '" name="field_' . $field_id . '_visibility" value="' . $level_id . '"' . $checked . ' /> ' . esc_html( $level['label'] ) . '</label></li>';
946
  }
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === BuddyPress ===
2
  Contributors: johnjamesjacoby, DJPaul, boonebgorges, r-a-y
3
  Tags: social networking, activity, profiles, messaging, friends, groups, forums, notifications, settings, twitter, facebook, social, community, networks, networking, cms
4
- Requires at least: 3.5
5
- Tested up to: 3.6
6
- Stable tag: 1.8.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -33,7 +33,7 @@ Activate BuddyPress in the "Plugins" admin panel using the "Activate" link. If y
33
 
34
  = Discussion Forums =
35
 
36
- Try <a href="http://wordpress.org/plugins/bbpress/">bbPress</a>. It's designed to work cohesively with BuddyPress Groups and Profiles. Each group on your site can choose to have its own forum, and each user's topics, replies, favorites, and subscriptions appear in their profiles.
37
 
38
  == Frequently Asked Questions ==
39
 
@@ -77,6 +77,9 @@ BuddyPress is available in more than 20 languages. For more information, check o
77
 
78
  == Upgrade Notice ==
79
 
 
 
 
80
  = 1.8.1 =
81
  See: http://codex.buddypress.org/releases/version-1-8-1/
82
 
@@ -127,6 +130,9 @@ Fixes over 10 bugs.
127
 
128
  == Changelog ==
129
 
 
 
 
130
  = 1.8.1 =
131
  See: http://codex.buddypress.org/releases/version-1-8-1/
132
 
1
  === BuddyPress ===
2
  Contributors: johnjamesjacoby, DJPaul, boonebgorges, r-a-y
3
  Tags: social networking, activity, profiles, messaging, friends, groups, forums, notifications, settings, twitter, facebook, social, community, networks, networking, cms
4
+ Requires at least: 3.6
5
+ Tested up to: 3.8
6
+ Stable tag: 1.9
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
33
 
34
  = Discussion Forums =
35
 
36
+ Try <a href="http://wordpress.org/plugins/bbpress/">bbPress</a>. It's designed to work cohesively with BuddyPress Groups, Profiles, and Notifications. Each group on your site can choose to have its own forum, and each user's topics, replies, favorites, and subscriptions appear in their profiles.
37
 
38
  == Frequently Asked Questions ==
39
 
77
 
78
  == Upgrade Notice ==
79
 
80
+ = 1.9 =
81
+ See: http://codex.buddypress.org/releases/version-1-9/
82
+
83
  = 1.8.1 =
84
  See: http://codex.buddypress.org/releases/version-1-8-1/
85
 
130
 
131
  == Changelog ==
132
 
133
+ = 1.9 =
134
+ See: http://codex.buddypress.org/releases/version-1-9/
135
+
136
  = 1.8.1 =
137
  See: http://codex.buddypress.org/releases/version-1-8-1/
138
 
tests/assets/group-extensions.php DELETED
@@ -1,148 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * The following implementations of BP_Group_Extension act as dummy plugins
5
- * for our unit tests
6
- */
7
-
8
- class BPTest_Group_Extension_Parse_Legacy_Properties extends BP_Group_Extension {
9
- function __construct() {
10
- $class_name = get_class( $this );
11
- $this->name = $class_name;
12
- $this->slug = sanitize_title( $class_name );
13
- $this->admin_name = $this->name . ' Edit';
14
- $this->admin_slug = $this->slug . '-edit';
15
- $this->create_name = $this->name . ' Create';
16
- $this->create_slug = $this->slug . '-create';
17
- $this->visibility = 'private';
18
- $this->create_step_position = 58;
19
- $this->nav_item_position = 63;
20
- $this->admin_metabox_context = 'high';
21
- $this->admin_metabox_priority = 'side';
22
- $this->enable_create_step = false;
23
- $this->enable_nav_item = true;
24
- $this->enable_edit_item = false;
25
- $this->enable_admin_item = true;
26
- $this->nav_item_name = $this->name . ' Nav';
27
- $this->display_hook = 'foo_hook';
28
- $this->template_file = 'foo_template';
29
- }
30
-
31
- /**
32
- * Provides access to protected method unneeded in BP
33
- */
34
- function _parse_legacy_properties() {
35
- return $this->parse_legacy_properties();
36
- }
37
-
38
- /**
39
- * Provides access to protected property unneeded in BP
40
- */
41
- function _get_legacy_properties_converted() {
42
- return $this->legacy_properties_converted;
43
- }
44
- }
45
-
46
- class BPTest_Group_Extension_Setup_Screens_Use_Global_Fallbacks extends BP_Group_Extension {
47
- function __construct() {
48
- $class_name = get_class( $this );
49
- $this->slug = sanitize_title( $class_name );
50
- $this->name = $class_name;
51
- }
52
-
53
- /**
54
- * Provides access to protected method unneeded in BP
55
- */
56
- function _get_default_screens() {
57
- return $this->get_default_screens();
58
- }
59
-
60
- /**
61
- * Provides access to protected method unneeded in BP
62
- */
63
- function _setup_class_info() {
64
- return $this->setup_class_info();
65
- }
66
-
67
- function settings_screen( $group_id = null ) {}
68
- function settings_screen_save( $group_id = null ) {}
69
- }
70
-
71
- class BPTest_Group_Extension_Setup_Screens_Define_Edit_Screens_Locally extends BP_Group_Extension {
72
- function __construct() {
73
- $class_name = get_class( $this );
74
- $this->slug = sanitize_title( $class_name );
75
- $this->name = $class_name;
76
- }
77
-
78
- function edit_screen( $group_id = null ) {}
79
- function edit_screen_save( $group_id = null ) {}
80
- function settings_screen( $group_id = null ) {}
81
- function settings_screen_save( $group_id = null ) {}
82
-
83
- /**
84
- * Provides access to protected method unneeded in BP
85
- */
86
- function _get_default_screens() {
87
- return $this->get_default_screens();
88
- }
89
-
90
- /**
91
- * Provides access to protected method unneeded in BP
92
- */
93
- function _setup_class_info() {
94
- return $this->setup_class_info();
95
- }
96
-
97
- }
98
-
99
- class BPTest_Group_Extension_Access_Root_Property extends BP_Group_Extension {
100
- function __construct() {
101
- $class_name = get_class( $this );
102
-
103
- $args = array(
104
- 'slug' => sanitize_title( $class_name ),
105
- 'name' => $class_name,
106
- 'nav_item_position' => 39,
107
- );
108
-
109
- parent::init( $args );
110
- }
111
- }
112
-
113
- class BPTest_Group_Extension_Access_Init_Property_Using_Legacy_Location extends BP_Group_Extension {
114
- function __construct() {
115
- $class_name = get_class( $this );
116
-
117
- $args = array(
118
- 'slug' => sanitize_title( $class_name ),
119
- 'name' => $class_name,
120
- 'screens' => array(
121
- 'create' => array(
122
- 'position' => 18,
123
- ),
124
- ),
125
- );
126
-
127
- parent::init( $args );
128
- }
129
- }
130
-
131
- class BPTest_Group_Extension_Get_Screen_Callback_Fallbacks extends BP_Group_Extension {
132
- function __construct() {
133
- $class_name = get_class( $this );
134
-
135
- $args = array(
136
- 'slug' => sanitize_title( $class_name ),
137
- 'name' => $class_name,
138
- );
139
-
140
- parent::init( $args );
141
- }
142
-
143
- function settings_screen( $group_id = null ) {}
144
- function settings_screen_save( $group_id = null ) {}
145
-
146
- function edit_screen( $group_id = null ) {}
147
- function edit_screen_save( $group_id = null ) {}
148
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/bootstrap.php DELETED
@@ -1,55 +0,0 @@
1
- <?php
2
-
3
- define( 'BP_PLUGIN_DIR', dirname( dirname( __FILE__ ) ) . '/' );
4
-
5
- if ( ! defined( 'BP_TESTS_DIR' ) ) {
6
- define( 'BP_TESTS_DIR', dirname( __FILE__ ) . '/' );
7
- }
8
-
9
- /**
10
- * In the pre-develop.svn WP development environment, an environmental bash
11
- * variable would be set to run PHP Unit tests. However, this has been done
12
- * away with in a post-develop.svn world. We'll still check if this variable
13
- * is set for backwards compat.
14
- */
15
- if ( getenv( 'WP_TESTS_DIR' ) ) {
16
- define( 'WP_TESTS_DIR', getenv( 'WP_TESTS_DIR' ) );
17
- define( 'WP_ROOT_DIR', WP_TESTS_DIR );
18
- } else {
19
- define( 'WP_ROOT_DIR', dirname( dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) ) );
20
- define( 'WP_TESTS_DIR', WP_ROOT_DIR . '/tests/phpunit' );
21
- }
22
-
23
- // Based on the tests directory, look for a config file
24
- if ( file_exists( WP_ROOT_DIR . '/wp-tests-config.php' ) ) {
25
- // Standard develop.svn.wordpress.org setup
26
- define( 'WP_TESTS_CONFIG_PATH', WP_ROOT_DIR . '/wp-tests-config.php' );
27
-
28
- } else if ( file_exists( WP_TESTS_DIR . '/wp-tests-config.php' ) ) {
29
- // Legacy unit-test.svn.wordpress.org setup
30
- define( 'WP_TESTS_CONFIG_PATH', WP_TESTS_DIR . '/wp-tests-config.php' );
31
-
32
- } else if ( file_exists( dirname( dirname( WP_TESTS_DIR ) ) . '/wp-tests-config.php' ) ) {
33
- // Environment variable exists and points to tests/phpunit of
34
- // develop.svn.wordpress.org setup
35
- define( 'WP_TESTS_CONFIG_PATH', dirname( dirname( WP_TESTS_DIR ) ) . '/wp-tests-config.php' );
36
-
37
- } else {
38
- die( "wp-tests-config.php could not be found.\n" );
39
- }
40
-
41
- if ( ! file_exists( WP_TESTS_DIR . '/includes/functions.php' ) ) {
42
- die( "The WordPress PHPUnit test suite could not be found.\n" );
43
- }
44
-
45
- require_once WP_TESTS_DIR . '/includes/functions.php';
46
-
47
- function _install_and_load_buddypress() {
48
- require BP_TESTS_DIR . '/includes/loader.php';
49
- }
50
- tests_add_filter( 'muplugins_loaded', '_install_and_load_buddypress' );
51
-
52
- require WP_TESTS_DIR . '/includes/bootstrap.php';
53
-
54
- // Load the BP-specific testing tools
55
- require BP_TESTS_DIR . '/includes/testcase.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/includes/factory.php DELETED
@@ -1,165 +0,0 @@
1
- <?php
2
- class BP_UnitTest_Factory extends WP_UnitTest_Factory {
3
- public $activity = null;
4
-
5
- function __construct() {
6
- parent::__construct();
7
-
8
- $this->activity = new BP_UnitTest_Factory_For_Activity( $this );
9
- $this->group = new BP_UnitTest_Factory_For_Group( $this );
10
- $this->xprofile_group = new BP_UnitTest_Factory_For_XProfileGroup( $this );
11
- $this->xprofile_field = new BP_UnitTest_Factory_For_XProfileField( $this );
12
- $this->notification = new BP_UnitTest_Factory_For_Notification( $this );
13
- }
14
- }
15
-
16
- class BP_UnitTest_Factory_For_Activity extends WP_UnitTest_Factory_For_Thing {
17
-
18
- function __construct( $factory = null ) {
19
- parent::__construct( $factory );
20
-
21
- $this->default_generation_definitions = array(
22
- 'action' => new WP_UnitTest_Generator_Sequence( 'Activity action %s' ),
23
- 'component' => buddypress()->activity->id,
24
- 'content' => new WP_UnitTest_Generator_Sequence( 'Activity content %s' ),
25
- 'primary_link' => 'http://example.com',
26
- 'type' => 'activity_update',
27
- 'recorded_time' => bp_core_current_time(),
28
- );
29
- }
30
-
31
- function create_object( $args ) {
32
- if ( ! isset( $args['user_id'] ) )
33
- $args['user_id'] = get_current_user_id();
34
-
35
- return bp_activity_add( $args );
36
- }
37
-
38
- function update_object( $activity_id, $fields ) {
39
- $activity = new BP_Activity_Activity( $activity_id );
40
-
41
- foreach ( $fields as $field_name => $value ) {
42
- if ( isset( $activity->$field_name ) )
43
- $activity->$field_name = $value;
44
- }
45
-
46
- $activity->save();
47
- return $activity;
48
- }
49
-
50
- function get_object_by_id( $user_id ) {
51
- return new BP_Activity_Activity( $user_id );
52
- }
53
- }
54
-
55
- class BP_UnitTest_Factory_For_Group extends WP_UnitTest_Factory_For_Thing {
56
-
57
- function __construct( $factory = null ) {
58
- parent::__construct( $factory );
59
-
60
- $this->default_generation_definitions = array(
61
- 'name' => new WP_UnitTest_Generator_Sequence( 'Group %s' ),
62
- 'description' => new WP_UnitTest_Generator_Sequence( 'Group description %s' ),
63
- 'slug' => new WP_UnitTest_Generator_Sequence( 'group-slug-%s' ),
64
- 'status' => 'public',
65
- 'enable_forum' => true,
66
- 'date_created' => bp_core_current_time(),
67
- );
68
- }
69
-
70
- function create_object( $args ) {
71
- if ( ! isset( $args['creator_id'] ) ) {
72
- $args['creator_id'] = get_current_user_id();
73
- }
74
-
75
- $group_id = groups_create_group( $args );
76
-
77
- groups_update_groupmeta( $group_id, 'total_member_count', 1 );
78
-
79
- $last_activity = isset( $args['last_activity'] ) ? $args['last_activity'] : bp_core_current_time();
80
- groups_update_groupmeta( $group_id, 'last_activity', $last_activity );
81
-
82
- return $group_id;
83
- }
84
-
85
- function update_object( $group_id, $fields ) {
86
- $group = new BP_Groups_Group( $group_id );
87
-
88
- foreach ( $fields as $field_name => $value ) {
89
- if ( isset( $group->field_name ) )
90
- $group->field_name = $value;
91
- }
92
-
93
- $group->save();
94
- return $group;
95
- }
96
-
97
- function get_object_by_id( $group_id ) {
98
- return new BP_Groups_Group( $group_id );
99
- }
100
- }
101
-
102
- class BP_UnitTest_Factory_For_XProfileGroup extends WP_UnitTest_Factory_For_Thing {
103
-
104
- function __construct( $factory = null ) {
105
- parent::__construct( $factory );
106
-
107
- $this->default_generation_definitions = array(
108
- 'name' => new WP_UnitTest_Generator_Sequence( 'XProfile group %s' ),
109
- 'description' => new WP_UnitTest_Generator_Sequence( 'XProfile group description %s' ),
110
- 'slug' => new WP_UnitTest_Generator_Sequence( 'xprofile-group-slug-%s' ),
111
- );
112
- }
113
-
114
- function create_object( $args ) {
115
- $group_id = xprofile_insert_field_group( $args );
116
- return $this->get_object_by_id( $group_id );
117
- }
118
-
119
- function update_object( $group_id, $fields ) {
120
- }
121
-
122
- function get_object_by_id( $group_id ) {
123
- return new BP_XProfile_Group( $group_id );
124
- }
125
- }
126
-
127
- class BP_UnitTest_Factory_For_XProfileField extends WP_UnitTest_Factory_For_Thing {
128
-
129
- function __construct( $factory = null ) {
130
- parent::__construct( $factory );
131
-
132
- $this->default_generation_definitions = array(
133
- 'name' => new WP_UnitTest_Generator_Sequence( 'XProfile field %s' ),
134
- 'description' => new WP_UnitTest_Generator_Sequence( 'XProfile field description %s' ),
135
- );
136
- }
137
-
138
- function create_object( $args ) {
139
- $field_id = xprofile_insert_field( $args );
140
- return $this->get_object_by_id( $field_id );
141
- }
142
-
143
- function update_object( $field_id, $fields ) {
144
- }
145
-
146
- function get_object_by_id( $field_id ) {
147
- return new BP_XProfile_Field( $field_id );
148
- }
149
- }
150
-
151
- class BP_UnitTest_Factory_For_Notification extends WP_UnitTest_Factory_For_Thing {
152
- public function __construct( $factory = null ) {
153
- parent::__construct( $factory );
154
- }
155
-
156
- public function create_object( $args ) {
157
- return bp_notifications_add_notification( $args );
158
- }
159
-
160
- public function update_object( $id, $fields ) {}
161
-
162
- public function get_object_by_id( $id ) {
163
- return new BP_Notifications_Notification( $id );
164
- }
165
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/includes/install.php DELETED
@@ -1,74 +0,0 @@
1
- <?php
2
- /**
3
- * Installs BuddyPress for the purpose of the unit-tests
4
- *
5
- * @todo Reuse the init/load code in init.php
6
- * @todo Support MULTIBLOG
7
- */
8
- error_reporting( E_ALL & ~E_DEPRECATED & ~E_STRICT );
9
-
10
- $config_file_path = $argv[1];
11
- $tests_dir_path = $argv[2];
12
- $multisite = ! empty( $argv[3] );
13
-
14
- require_once $config_file_path;
15
- require_once $tests_dir_path . '/includes/functions.php';
16
-
17
- function _load_buddypress() {
18
- require dirname( dirname( dirname( __FILE__ ) ) ) . '/bp-loader.php';
19
- }
20
- tests_add_filter( 'muplugins_loaded', '_load_buddypress' );
21
-
22
- define( 'BP_PLUGIN_DIR', dirname( dirname( dirname( __FILE__ ) ) ) . '/' );
23
- define( 'BP_ROOT_BLOG', 1 );
24
-
25
- // Always load admin bar
26
- tests_add_filter( 'show_admin_bar', '__return_true' );
27
-
28
- function wp_test_bp_install( $value ) {
29
- return array( 'activity' => 1, 'blogs' => 1, 'friends' => 1, 'groups' => 1, 'members' => 1, 'messages' => 1, 'notifications' => 1, 'settings' => 1, 'xprofile' => 1, );
30
- }
31
- tests_add_filter( 'bp_new_install_default_components', 'wp_test_bp_install' );
32
-
33
- $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
34
- $_SERVER['HTTP_HOST'] = WP_TESTS_DOMAIN;
35
- $PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php';
36
-
37
- require_once ABSPATH . '/wp-settings.php';
38
- define( 'BP_TESTS_DB_VERSION_FILE', ABSPATH . '.bp-tests-version' );
39
-
40
- // Check if BuddyPress has already been installed
41
- $db_version = buddypress()->db_version;
42
- $hash = $db_version . ' ' . (int) $multisite . ' ' . sha1_file( $config_file_path );
43
-
44
- if ( $db_version && file_exists( BP_TESTS_DB_VERSION_FILE ) ) {
45
- $version_file = file_get_contents( BP_TESTS_DB_VERSION_FILE );
46
-
47
- if ( $hash === $version_file ) {
48
- return;
49
- }
50
- }
51
-
52
- echo "Installing BuddyPress...\n";
53
-
54
- // Make sure that BP has been cleaned from all blogs before reinstalling
55
- $blogs = is_multisite() ? $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" ) : array( 1 );
56
- foreach ( $blogs as $blog ) {
57
- if ( is_multisite() ) {
58
- switch_to_blog( $blog );
59
- }
60
-
61
- $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE '%bp%'" );
62
-
63
- if ( is_multisite() ) {
64
- restore_current_blog();
65
- }
66
- }
67
-
68
- $wpdb->query( 'SET storage_engine = INNODB' );
69
- $wpdb->select( DB_NAME, $wpdb->dbh );
70
-
71
- // Install BuddyPress
72
- bp_version_updater();
73
-
74
- file_put_contents( BP_TESTS_DB_VERSION_FILE, $hash );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/includes/loader.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
- $multisite = (int) ( defined( 'WP_TESTS_MULTISITE') && WP_TESTS_MULTISITE );
3
- system( WP_PHP_BINARY . ' ' . escapeshellarg( dirname( __FILE__ ) . '/install.php' ) . ' ' . escapeshellarg( WP_TESTS_CONFIG_PATH ) . ' ' . escapeshellarg( WP_TESTS_DIR ) . ' ' . $multisite );
4
-
5
- // Bootstrap BP
6
- require dirname( __FILE__ ) . '/../../bp-loader.php';
 
 
 
 
 
 
tests/includes/testcase.php DELETED
@@ -1,317 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * WP's test suite wipes out BP's directory page mappings with _delete_all_posts()
5
- * We must reestablish them before our tests can be successfully run
6
- */
7
- bp_core_add_page_mappings( bp_get_option( 'bp-active-components' ), 'delete' );
8
-
9
- require_once dirname( __FILE__ ) . '/factory.php';
10
-
11
- class BP_UnitTestCase extends WP_UnitTestCase {
12
-
13
- protected $temp_has_bp_moderate = array();
14
-
15
- public function setUp() {
16
- parent::setUp();
17
-
18
- // Make sure all users are deleted
19
- // There's a bug in the multisite tests that causes the
20
- // transaction rollback to fail for the first user created,
21
- // which busts every other attempt to create users. This is a
22
- // hack workaround
23
- global $wpdb;
24
- $wpdb->query( "TRUNCATE TABLE {$wpdb->users}" );
25
-
26
- $this->factory = new BP_UnitTest_Factory;
27
- }
28
-
29
- function clean_up_global_scope() {
30
- buddypress()->bp_nav = buddypress()->bp_options_nav = buddypress()->action_variables = buddypress()->canonical_stack = buddypress()->unfiltered_uri = $GLOBALS['bp_unfiltered_uri'] = array();
31
- buddypress()->current_component = buddypress()->current_item = buddypress()->current_action = '';
32
- buddypress()->unfiltered_uri_offset = 0;
33
- buddypress()->is_single_item = false;
34
- buddypress()->current_user = new stdClass();
35
- buddypress()->displayed_user = new stdClass();
36
- buddypress()->loggedin_user = new stdClass();
37
- buddypress()->avatar = new stdClass();
38
-
39
- parent::clean_up_global_scope();
40
- }
41
-
42
- function assertPreConditions() {
43
- parent::assertPreConditions();
44
-
45
- // Reinit some of the globals that might have been cleared by BP_UnitTestCase::clean_up_global_scope().
46
- // This is here because it didn't work in clean_up_global_scope(); I don't know why.
47
- do_action( 'bp_setup_globals' );
48
- }
49
-
50
- function go_to( $url ) {
51
- // note: the WP and WP_Query classes like to silently fetch parameters
52
- // from all over the place (globals, GET, etc), which makes it tricky
53
- // to run them more than once without very carefully clearing everything
54
- $_GET = $_POST = array();
55
- foreach (array('query_string', 'id', 'postdata', 'authordata', 'day', 'currentmonth', 'page', 'pages', 'multipage', 'more', 'numpages', 'pagenow') as $v) {
56
- if ( isset( $GLOBALS[$v] ) ) unset( $GLOBALS[$v] );
57
- }
58
- $parts = parse_url($url);
59
- if (isset($parts['scheme'])) {
60
- // set the HTTP_HOST
61
- $GLOBALS['_SERVER']['HTTP_HOST'] = $parts['host'];
62
-
63
- $req = $parts['path'];
64
- if (isset($parts['query'])) {
65
- $req .= '?' . $parts['query'];
66
- // parse the url query vars into $_GET
67
- parse_str($parts['query'], $_GET);
68
- }
69
- } else {
70
- $req = $url;
71
- }
72
- if ( ! isset( $parts['query'] ) ) {
73
- $parts['query'] = '';
74
- }
75
-
76
- // Scheme
77
- if ( 0 === strpos( $req, '/wp-admin' ) && force_ssl_admin() ) {
78
- $_SERVER['HTTPS'] = 'on';
79
- } else {
80
- unset( $_SERVER['HTTPS'] );
81
- }
82
-
83
- // Set this for bp_core_set_uri_globals()
84
- $GLOBALS['_SERVER']['REQUEST_URI'] = $req;
85
- unset($_SERVER['PATH_INFO']);
86
-
87
- // setup $current_site and $current_blog globals for multisite based on
88
- // REQUEST_URI; mostly copied from /wp-includes/ms-settings.php
89
- if ( is_multisite() ) {
90
- $domain = addslashes( $_SERVER['HTTP_HOST'] );
91
- if ( false !== strpos( $domain, ':' ) ) {
92
- if ( substr( $domain, -3 ) == ':80' ) {
93
- $domain = substr( $domain, 0, -3 );
94
- $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 );
95
- } elseif ( substr( $domain, -4 ) == ':443' ) {
96
- $domain = substr( $domain, 0, -4 );
97
- $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 );
98
- }
99
- }
100
-
101
- $domain = rtrim( $domain, '.' );
102
- $cookie_domain = $domain;
103
- if ( substr( $cookie_domain, 0, 4 ) == 'www.' )
104
- $cookie_domain = substr( $cookie_domain, 4 );
105
-
106
- $path = preg_replace( '|([a-z0-9-]+.php.*)|', '', $GLOBALS['_SERVER']['REQUEST_URI'] );
107
- $path = str_replace ( '/wp-admin/', '/', $path );
108
- $path = preg_replace( '|(/[a-z0-9-]+?/).*|', '$1', $path );
109
-
110
- $GLOBALS['current_site'] = wpmu_current_site();
111
- if ( ! isset( $GLOBALS['current_site']->blog_id ) )
112
- $GLOBALS['current_site']->blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s", $GLOBALS['current_site']->domain, $GLOBALS['current_site']->path ) );
113
-
114
- // unit tests only support subdirectory install at the moment
115
- // removed object cache references
116
- if ( ! is_subdomain_install() ) {
117
- $blogname = htmlspecialchars( substr( $GLOBALS['_SERVER']['REQUEST_URI'], strlen( $path ) ) );
118
- if ( false !== strpos( $blogname, '/' ) )
119
- $blogname = substr( $blogname, 0, strpos( $blogname, '/' ) );
120
- if ( false !== strpos( $blogname, '?' ) )
121
- $blogname = substr( $blogname, 0, strpos( $blogname, '?' ) );
122
- $reserved_blognames = array( 'page', 'comments', 'blog', 'wp-admin', 'wp-includes', 'wp-content', 'files', 'feed' );
123
- if ( $blogname != '' && ! in_array( $blogname, $reserved_blognames ) && ! is_file( $blogname ) )
124
- $path .= $blogname . '/';
125
-
126
- $GLOBALS['current_blog'] = get_blog_details( array( 'domain' => $domain, 'path' => $path ), false );
127
-
128
- unset($reserved_blognames);
129
- }
130
-
131
- $GLOBALS['blog_id'] = $GLOBALS['current_blog']->blog_id;
132
- }
133
-
134
- unset($GLOBALS['wp_query'], $GLOBALS['wp_the_query']);
135
- $GLOBALS['wp_the_query'] = new WP_Query();
136
- $GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
137
- $GLOBALS['wp'] = new WP();
138
-
139
- // clean out globals to stop them polluting wp and wp_query
140
- foreach ($GLOBALS['wp']->public_query_vars as $v) {
141
- unset($GLOBALS[$v]);
142
- }
143
- foreach ($GLOBALS['wp']->private_query_vars as $v) {
144
- unset($GLOBALS[$v]);
145
- }
146
-
147
- $GLOBALS['wp']->main($parts['query']);
148
-
149
- // For BuddyPress, James.
150
- $GLOBALS['bp']->loggedin_user = NULL;
151
- do_action( 'bp_init' );
152
- }
153
-
154
- protected function checkRequirements() {
155
- if ( WP_TESTS_FORCE_KNOWN_BUGS )
156
- return;
157
-
158
- parent::checkRequirements();
159
-
160
- $tickets = PHPUnit_Util_Test::getTickets( get_class( $this ), $this->getName( false ) );
161
- foreach ( $tickets as $ticket ) {
162
- if ( 'BP' == substr( $ticket, 0, 2 ) ) {
163
- $ticket = substr( $ticket, 2 );
164
- if ( $ticket && is_numeric( $ticket ) )
165
- $this->knownBPBug( $ticket );
166
- }
167
- }
168
- }
169
-
170
- /**
171
- * Skips the current test if there is an open BuddyPress ticket with id $ticket_id
172
- */
173
- function knownBPBug( $ticket_id ) {
174
- if ( WP_TESTS_FORCE_KNOWN_BUGS || in_array( $ticket_id, self::$forced_tickets ) )
175
- return;
176
-
177
- if ( ! TracTickets::isTracTicketClosed( 'http://buddypress.trac.wordpress.org', $ticket_id ) )
178
- $this->markTestSkipped( sprintf( 'BuddyPress Ticket #%d is not fixed', $ticket_id ) );
179
- }
180
-
181
- /**
182
- * WP's core tests use wp_set_current_user() to change the current
183
- * user during tests. BP caches the current user differently, so we
184
- * have to do a bit more work to change it
185
- *
186
- * @global BuddyPres $bp
187
- */
188
- function set_current_user( $user_id ) {
189
- global $bp;
190
- $bp->loggedin_user->id = $user_id;
191
- $bp->loggedin_user->fullname = bp_core_get_user_displayname( $user_id );
192
- $bp->loggedin_user->is_super_admin = $bp->loggedin_user->is_site_admin = is_super_admin( $user_id );
193
- $bp->loggedin_user->domain = bp_core_get_user_domain( $user_id );
194
- $bp->loggedin_user->userdata = bp_core_get_core_userdata( $user_id );
195
-
196
- wp_set_current_user( $user_id );
197
- }
198
-
199
- /**
200
- * When creating a new user, it's almost always necessary to have the
201
- * last_activity usermeta set right away, so that the user shows up in
202
- * directory queries. This is a shorthand wrapper for the user factory
203
- * create() method.
204
- *
205
- * Also set a display name
206
- */
207
- function create_user( $args = array() ) {
208
- $r = wp_parse_args( $args, array(
209
- 'role' => 'subscriber',
210
- 'last_activity' => bp_core_current_time() - 60*60*24*365,
211
- ) );
212
-
213
- $last_activity = $r['last_activity'];
214
- unset( $r['last_activity'] );
215
-
216
- $user_id = $this->factory->user->create( $args );
217
-
218
- bp_update_user_last_activity( $user_id, $last_activity );
219
-
220
- if ( bp_is_active( 'xprofile' ) ) {
221
- $user = new WP_User( $user_id );
222
- xprofile_set_field_data( 1, $user_id, $user->display_name );
223
- }
224
-
225
- return $user_id;
226
- }
227
-
228
- public static function add_user_to_group( $user_id, $group_id, $args = array() ) {
229
- $r = wp_parse_args( $args, array(
230
- 'date_modified' => bp_core_current_time(),
231
- 'is_confirmed' => 1,
232
- ) );
233
-
234
- $new_member = new BP_Groups_Member;
235
- $new_member->group_id = $group_id;
236
- $new_member->user_id = $user_id;
237
- $new_member->inviter_id = 0;
238
- $new_member->is_admin = 0;
239
- $new_member->user_title = '';
240
- $new_member->date_modified = $r['date_modified'];
241
- $new_member->is_confirmed = $r['is_confirmed'];
242
-
243
- $new_member->save();
244
- return $new_member->id;
245
- }
246
-
247
- /**
248
- * We can't use grant_super_admin() because we will need to modify
249
- * the list more than once, and grant_super_admin() can only be run
250
- * once because of its global check
251
- */
252
- public function grant_super_admin( $user_id ) {
253
- global $super_admins;
254
- if ( ! is_multisite() ) {
255
- return;
256
- }
257
-
258
- $user = get_userdata( $user_id );
259
- $super_admins[] = $user->user_login;
260
- }
261
-
262
- public function restore_admins() {
263
- // We assume that the global can be wiped out
264
- // @see grant_super_admin()
265
- unset( $GLOBALS['super_admins'] );
266
- }
267
-
268
- public function grant_bp_moderate( $user_id ) {
269
- if ( ! isset( $this->temp_has_bp_moderate[ $user_id ] ) ) {
270
- $this->temp_has_bp_moderate[ $user_id ] = 1;
271
- }
272
- add_filter( 'bp_current_user_can', array( $this, 'grant_bp_moderate_cb' ), 10, 2 );
273
- }
274
-
275
- public function revoke_bp_moderate( $user_id ) {
276
- if ( isset( $this->temp_has_bp_moderate[ $user_id ] ) ) {
277
- unset( $this->temp_has_bp_moderate[ $user_id ] );
278
- }
279
- remove_filter( 'bp_current_user_can', array( $this, 'grant_bp_moderate_cb' ), 10, 2 );
280
- }
281
-
282
- public function grant_bp_moderate_cb( $retval, $capability ) {
283
- $current_user = bp_loggedin_user_id();
284
- if ( ! isset( $this->temp_has_bp_moderate[ $current_user ] ) ) {
285
- return $retval;
286
- }
287
-
288
- if ( 'bp_moderate' == $capability ) {
289
- $retval = true;
290
- }
291
-
292
- return $retval;
293
- }
294
-
295
- /**
296
- * Go to the root blog. This helps reset globals after moving between
297
- * blogs.
298
- */
299
- public function go_to_root() {
300
- $blog_1_url = get_blog_option( 1, 'home' );
301
- $this->go_to( str_replace( $blog_1_url, '', trailingslashit( bp_get_root_domain() ) ) );
302
- }
303
-
304
- /**
305
- * Set up globals necessary to avoid errors when using wp_mail()
306
- */
307
- public function setUp_wp_mail() {
308
- $_SERVER['SERVER_NAME'] = 'example.com';
309
- }
310
-
311
- /**
312
- * Tear down globals set up in setUp_wp_mail()
313
- */
314
- public function tearDown_wp_mail() {
315
- unset( $_SERVER['SERVER_NAME'] );
316
- }
317
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/multisite.xml DELETED
@@ -1,17 +0,0 @@
1
- <phpunit
2
- bootstrap="bootstrap.php"
3
- backupGlobals="false"
4
- colors="true"
5
- convertErrorsToExceptions="true"
6
- convertNoticesToExceptions="true"
7
- convertWarningsToExceptions="true"
8
- >
9
- <php>
10
- <const name="WP_TESTS_MULTISITE" value="1" />
11
- </php>
12
- <testsuites>
13
- <testsuite>
14
- <directory suffix=".php">./testcases/</directory>
15
- </testsuite>
16
- </testsuites>
17
- </phpunit>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/phpunit.xml DELETED
@@ -1,14 +0,0 @@
1
- <phpunit
2
- bootstrap="bootstrap.php"
3
- backupGlobals="false"
4
- colors="true"
5
- convertErrorsToExceptions="true"
6
- convertNoticesToExceptions="true"
7
- convertWarningsToExceptions="true"
8
- >
9
- <testsuites>
10
- <testsuite>
11
- <directory suffix=".php">./testcases/</directory>
12
- </testsuite>
13
- </testsuites>
14
- </phpunit>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/activity/class.BP_Activity_Activity.php DELETED
@@ -1,308 +0,0 @@
1
- <?php
2
- /**
3
- * @group activity
4
- */
5
- class BP_Tests_Activity_Class extends BP_UnitTestCase {
6
- protected $old_current_user = 0;
7
-
8
- public function setUp() {
9
- parent::setUp();
10
-
11
- $this->old_current_user = get_current_user_id();
12
- $this->set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
13
- }
14
-
15
- public function tearDown() {
16
- parent::tearDown();
17
- $this->set_current_user( $this->old_current_user );
18
- }
19
-
20
- public function test_check_exists_by_content() {
21
- $content = 'A classy girl who know how to enjoy the freedom of a cup of coffee';
22
- $activity = $this->factory->activity->create( array(
23
- 'content' => $content,
24
- 'type' => 'activity_update',
25
- ) );
26
-
27
- $result = BP_Activity_Activity::check_exists_by_content( $content );
28
- $this->assertEquals( $activity, $result );
29
- }
30
-
31
- public function test_delete_activity_item_comments() {
32
- $parent_activity = $this->factory->activity->create( array(
33
- 'type' => 'activity_update',
34
- ) );
35
-
36
- $comments = $this->factory->activity->create_many( 3, array(
37
- 'item_id' => $parent_activity,
38
- 'type' => 'activity_comment',
39
- ) );
40
-
41
- BP_Activity_Activity::delete_activity_item_comments( $parent_activity );
42
-
43
- $result = BP_Activity_Activity::get( array( 'in' => wp_list_pluck( $comments, 'id' ), ) );
44
- $this->assertEmpty( $result['activities'] );
45
- }
46
-
47
- /**
48
- * @ticket BP4804
49
- */
50
- public function test_delete_activity_meta_entries() {
51
- $activity = $this->factory->activity->create( array(
52
- 'type' => 'activity_update',
53
- ) );
54
-
55
- bp_activity_update_meta( $activity, 'Paul', 'is cool' );
56
- BP_Activity_Activity::delete_activity_meta_entries( $activity );
57
-
58
- $meta = bp_activity_get_meta( $activity, 'Paul' );
59
- $this->assertFalse( $meta );
60
- }
61
-
62
- public function test_hide_all_for_user() {
63
- $activity = $this->factory->activity->create( array(
64
- 'type' => 'activity_update',
65
- ) );
66
-
67
- BP_Activity_Activity::hide_all_for_user( get_current_user_id() );
68
-
69
- $activity = BP_Activity_Activity::get( array(
70
- 'in' => $activity,
71
- 'show_hidden' => true,
72
- ) );
73
- $this->assertEquals( $activity['activities'][0]->hide_sitewide, 1 );
74
- }
75
-
76
- /**
77
- * @group get
78
- * @group meta_query
79
- */
80
- public function test_get_with_meta_query() {
81
- $a1 = $this->factory->activity->create();
82
- $a2 = $this->factory->activity->create();
83
- bp_activity_update_meta( $a1, 'foo', 'bar' );
84
-
85
- $activity = BP_Activity_Activity::get( array(
86
- 'meta_query' => array(
87
- array(
88
- 'key' => 'foo',
89
- 'value' => 'bar',
90
- ),
91
- ),
92
- ) );
93
- $ids = wp_list_pluck( $activity['activities'], 'id' );
94
- $this->assertEquals( $ids, array( $a1 ) );
95
- }
96
-
97
- public function test_get_with_meta_query_two_clauses_with_or_relation() {
98
- $now = time();
99
- $a1 = $this->factory->activity->create( array(
100
- 'recorded_time' => date( 'Y-m-d H:i:s', $now ),
101
- ) );
102
- $a2 = $this->factory->activity->create( array(
103
- 'recorded_time' => date( 'Y-m-d H:i:s', $now - 60 ),
104
- ) );
105
- $a3 = $this->factory->activity->create( array(
106
- 'recorded_time' => date( 'Y-m-d H:i:s', $now - 120 ),
107
- ) );
108
- bp_activity_update_meta( $a1, 'foo', 'bar' );
109
- bp_activity_update_meta( $a2, 'foo', 'bar' );
110
- bp_activity_update_meta( $a1, 'baz', 'barry' );
111
-
112
- $activity = BP_Activity_Activity::get( array(
113
- 'meta_query' => array(
114
- 'relation' => 'OR',
115
- array(
116
- 'key' => 'foo',
117
- 'value' => 'bar',
118
- ),
119
- array(
120
- 'key' => 'baz',
121
- 'value' => 'barry',
122
- ),
123
- ),
124
- ) );
125
-
126
- $ids = wp_list_pluck( $activity['activities'], 'id' );
127
- $this->assertEquals( array( $a1, $a2 ), $ids );
128
- $this->assertEquals( 2, $activity['total'] );
129
- }
130
-
131
- /**
132
- * @group get
133
- */
134
- public function test_get_with_search_terms() {
135
- $a1 = $this->factory->activity->create( array(
136
- 'content' => 'Boone is a cool guy',
137
- ) );
138
- $a2 = $this->factory->activity->create( array(
139
- 'content' => 'No he isn\'t',
140
- ) );
141
-
142
- $activity = BP_Activity_Activity::get( array(
143
- 'search_terms' => 'cool',
144
- ) );
145
- $ids = wp_list_pluck( $activity['activities'], 'id' );
146
- $this->assertEquals( $ids, array( $a1 ) );
147
- }
148
-
149
- /**
150
- * @group get
151
- */
152
- public function test_get_with_display_comments_threaded() {
153
- $now = time();
154
- $a1 = $this->factory->activity->create( array(
155
- 'content' => 'Life Rules',
156
- 'recorded_time' => date( 'Y-m-d H:i:s', $now ),
157
- ) );
158
- $a2 = $this->factory->activity->create( array(
159
- 'content' => 'Life Drools',
160
- 'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
161
- ) );
162
- $a3 = bp_activity_new_comment( array(
163
- 'activity_id' => $a1,
164
- 'content' => 'Candy is good',
165
- 'recorded_time' => date( 'Y-m-d H:i:s', $now - 50 ),
166
- ) );
167
-
168
- $activity = BP_Activity_Activity::get( array(
169
- 'display_comments' => 'threaded',
170
- ) );
171
-
172
- // Kinda crummy, but let's construct a skeleton
173
- $expected = array(
174
- $a1 => array( $a3 ),
175
- $a2 => array(),
176
- );
177
-
178
- $found = array();
179
- foreach ( $activity['activities'] as $a ) {
180
- $found[ $a->id ] = ! empty( $a->children ) ? array_keys( $a->children ) : array();
181
- }
182
-
183
- $this->assertEquals( $expected, $found );
184
- }
185
-
186
- /**
187
- * @group get
188
- */
189
- public function test_get_with_display_comments_stream() {
190
- $now = time();
191
- $a1 = $this->factory->activity->create( array(
192
- 'content' => 'Life Rules',
193
- 'recorded_time' => date( 'Y-m-d H:i:s', $now ),
194
- ) );
195
- $a2 = $this->factory->activity->create( array(
196
- 'content' => 'Life Drools',
197
- 'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
198
- ) );
199
-
200
- // bp_activity_new_comment() doesn't allow date_recorded
201
- $a3 = bp_activity_add( array(
202
- 'action' => sprintf( __( '%s posted a new activity comment', 'buddypress' ), bp_get_loggedin_user_link() ) ,
203
- 'content' => 'Candy is good',
204
- 'component' => buddypress()->activity->id,
205
- 'type' => 'activity_comment',
206
- 'user_id' => bp_loggedin_user_id(),
207
- 'item_id' => $a1,
208
- 'secondary_item_id' => $a1,
209
- 'recorded_time' => date( 'Y-m-d H:i:s', $now - 50 ),
210
- ) );
211
-
212
- $activity = BP_Activity_Activity::get( array(
213
- 'display_comments' => 'stream',
214
- ) );
215
- $ids = wp_list_pluck( $activity['activities'], 'id' );
216
- $this->assertEquals( array( $a1, $a3, $a2 ), $ids );
217
- }
218
-
219
- /**
220
- * @group get
221
- */
222
- public function test_get_with_display_comments_false() {
223
- $now = time();
224
- $a1 = $this->factory->activity->create( array(
225
- 'content' => 'Life Rules',
226
- 'recorded_time' => date( 'Y-m-d H:i:s', $now ),
227
- ) );
228
- $a2 = $this->factory->activity->create( array(
229
- 'content' => 'Life Drools',
230
- 'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
231
- ) );
232
- $a3 = bp_activity_new_comment( array(
233
- 'activity_id' => $a1,
234
- 'content' => 'Candy is good',
235
- 'recorded_time' => date( 'Y-m-d H:i:s', $now - 50 ),
236
- ) );
237
-
238
- $activity = BP_Activity_Activity::get( array(
239
- 'display_comments' => false,
240
- ) );
241
- $ids = wp_list_pluck( $activity['activities'], 'id' );
242
- $this->assertEquals( array( $a1, $a2 ), $ids );
243
- }
244
-
245
- /**
246
- * @group get_id
247
- */
248
- public function test_get_id_with_item_id() {
249
- $a1 = $this->factory->activity->create( array(
250
- 'item_id' => 523,
251
- ) );
252
- $a2 = $this->factory->activity->create( array(
253
- 'item_id' => 1888,
254
- ) );
255
-
256
- $activity = BP_Activity_Activity::get_id( false, false, false, 523, false, false, false, false );
257
- $this->assertEquals( $a1, $activity );
258
- }
259
-
260
- /**
261
- * @group get_id
262
- */
263
- public function test_get_id_with_secondary_item_id() {
264
- $a1 = $this->factory->activity->create( array(
265
- 'secondary_item_id' => 523,
266
- ) );
267
- $a2 = $this->factory->activity->create( array(
268
- 'secondary_content' => 1888,
269
- ) );
270
-
271
- $activity = BP_Activity_Activity::get_id( false, false, false, false, 523, false, false, false );
272
- $this->assertEquals( $a1, $activity );
273
- }
274
-
275
- /**
276
- * @group delete
277
- */
278
- public function test_delete_with_item_id() {
279
- $a1 = $this->factory->activity->create( array(
280
- 'item_id' => 523,
281
- ) );
282
- $a2 = $this->factory->activity->create( array(
283
- 'item_id' => 1888,
284
- ) );
285
-
286
- $activity = BP_Activity_Activity::delete( array(
287
- 'item_id' => 523,
288
- ) );
289
- $this->assertEquals( array( $a1 ), $activity );
290
- }
291
-
292
- /**
293
- * @group delete
294
- */
295
- public function test_delete_with_secondary_item_id() {
296
- $a1 = $this->factory->activity->create( array(
297
- 'secondary_item_id' => 523,
298
- ) );
299
- $a2 = $this->factory->activity->create( array(
300
- 'secondary_item_id' => 1888,
301
- ) );
302
-
303
- $activity = BP_Activity_Activity::delete( array(
304
- 'secondary_item_id' => 523,
305
- ) );
306
- $this->assertEquals( array( $a1 ), $activity );
307
- }
308
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/activity/functions.php DELETED
@@ -1,208 +0,0 @@
1
- <?php
2
- /**
3
- * @group activity
4
- */
5
- class BP_Tests_Activity_Functions extends BP_UnitTestCase {
6
- protected $old_current_user = 0;
7
-
8
- public function setUp() {
9
- parent::setUp();
10
-
11
- $this->old_current_user = get_current_user_id();
12
- $this->set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
13
- }
14
-
15
- public function tearDown() {
16
- parent::tearDown();
17
- $this->set_current_user( $this->old_current_user );
18
- }
19
-
20
- /**
21
- * @ticket BP4488
22
- */
23
- public function test_thumbnail_content_images() {
24
- // No images
25
- $post_content = 'foo bar';
26
- $this->assertEquals( bp_activity_thumbnail_content_images( $post_content ), 'foo bar' );
27
-
28
- // Image first, no caption. See #BP4488
29
- $post_content = '<img src="http://example.com/foo.jpg" alt="foo" width="40" height="40" class="alignnone size-full wp-image-236" /> foo bar';
30
- $this->assertEquals( bp_activity_thumbnail_content_images( $post_content ), '<img src="http://example.com/foo.jpg" width="40" height="40" alt="Thumbnail" class="align-left thumbnail" /> foo bar' );
31
-
32
- // Image first, caption. See #BP4488
33
- $post_content = '[caption id="attachment_236" align="alignnone" width="40"]<img src="http://example.com/foo.jpg" alt="FOO!" width="40" height="40" class="size-full wp-image-236" /> FOO![/caption] Awesome.';
34
- $this->assertEquals( bp_activity_thumbnail_content_images( $post_content ), '<img src="http://example.com/foo.jpg" width="40" height="40" alt="Thumbnail" class="align-left thumbnail" /> Awesome.' );
35
- }
36
-
37
- /**
38
- * @group delete
39
- */
40
- public function test_delete_activity_and_meta() {
41
- // create an activity update
42
- $parent_activity = $this->factory->activity->create( array(
43
- 'type' => 'activity_update',
44
- ) );
45
-
46
- // create some activity comments
47
- $comment_one = $this->factory->activity->create( array(
48
- 'type' => 'activity_comment',
49
- 'item_id' => $parent_activity,
50
- 'secondary_item_id' => $parent_activity,
51
- ) );
52
-
53
- $comment_two = $this->factory->activity->create( array(
54
- 'type' => 'activity_comment',
55
- 'item_id' => $parent_activity,
56
- 'secondary_item_id' => $parent_activity,
57
- ) );
58
-
59
- // add some meta to the activity items
60
- bp_activity_update_meta( $parent_activity, 'foo', 'bar' );
61
- bp_activity_update_meta( $comment_one, 'foo', 'bar' );
62
- bp_activity_update_meta( $comment_two, 'foo', 'bar' );
63
-
64
- // now delete the parent activity item
65
- // this should hopefully delete the associated comments and meta entries
66
- bp_activity_delete( array(
67
- 'id' => $parent_activity
68
- ) );
69
-
70
- // now fetch the deleted activity entries
71
- $get = bp_activity_get( array(
72
- 'in' => array( $parent_activity, $comment_one, $comment_two ),
73
- 'display_comments' => 'stream'
74
- ) );
75
-
76
- // activities should equal zero
77
- $this->assertEquals( 0, $get['total'] );
78
-
79
- // now fetch activity meta for the deleted activity entries
80
- $m1 = bp_activity_get_meta( $parent_activity );
81
- $m2 = bp_activity_get_meta( $comment_one );
82
- $m3 = bp_activity_get_meta( $comment_two );
83
-
84
- // test if activity meta entries still exist
85
- $this->assertEquals( false, $m1 );
86
- $this->assertEquals( false, $m2 );
87
- $this->assertEquals( false, $m3 );
88
- }
89
-
90
- /**
91
- * @group bp_activity_update_meta
92
- * @ticket BP5180
93
- */
94
- public function test_bp_activity_update_meta_with_line_breaks() {
95
- $a = $this->factory->activity->create();
96
- $meta_value = 'Foo!
97
-
98
-
99
- Bar!';
100
- bp_activity_update_meta( $a, 'linebreak_test', $meta_value );
101
- $this->assertEquals( $meta_value, bp_activity_get_meta( $a, 'linebreak_test' ) );
102
- }
103
-
104
- /**
105
- * @group bp_activity_update_meta
106
- * @ticket BP5083
107
- */
108
- public function test_bp_activity_update_meta_with_0() {
109
- $a = $this->factory->activity->create();
110
- $meta_value = 0;
111
-
112
- bp_activity_update_meta( $a, '0_test', $meta_value );
113
-
114
- $this->assertNotSame( false, bp_activity_get_meta( $a, '0_test' ) );
115
- }
116
-
117
- /**
118
- * @group bp_activity_get_user_mentionname
119
- */
120
- public function test_bp_activity_get_user_mentionname_compatibilitymode_off() {
121
- add_filter( 'bp_is_username_compatibility_mode', '__return_false' );
122
-
123
- $u = $this->create_user( array(
124
- 'user_login' => 'foo bar baz',
125
- 'user_nicename' => 'foo-bar-baz',
126
- ) );
127
-
128
- $this->assertEquals( 'foo-bar-baz', bp_activity_get_user_mentionname( $u ) );
129
-
130
- remove_filter( 'bp_is_username_compatibility_mode', '__return_false' );
131
- }
132
-
133
- /**
134
- * @group bp_activity_get_user_mentionname
135
- */
136
- public function test_bp_activity_get_user_mentionname_compatibilitymode_on() {
137
- add_filter( 'bp_is_username_compatibility_mode', '__return_true' );
138
-
139
- $u1 = $this->create_user( array(
140
- 'user_login' => 'foo bar baz',
141
- 'user_nicename' => 'foo-bar-baz',
142
- ) );
143
-
144
- $u2 = $this->create_user( array(
145
- 'user_login' => 'foo.bar.baz',
146
- 'user_nicename' => 'foo-bar-baz',
147
- ) );
148
-
149
- $this->assertEquals( 'foo-bar-baz', bp_activity_get_user_mentionname( $u1 ) );
150
- $this->assertEquals( 'foo.bar.baz', bp_activity_get_user_mentionname( $u2 ) );
151
-
152
- remove_filter( 'bp_is_username_compatibility_mode', '__return_true' );
153
- }
154
-
155
- /**
156
- * @group bp_activity_get_userid_from_mentionname
157
- */
158
- public function test_bp_activity_get_userid_from_mentionname_compatibilitymode_off() {
159
- add_filter( 'bp_is_username_compatibility_mode', '__return_false' );
160
-
161
- $u = $this->create_user( array(
162
- 'user_login' => 'foo bar baz',
163
- 'user_nicename' => 'foo-bar-baz',
164
- ) );
165
-
166
- $this->assertEquals( $u, bp_activity_get_userid_from_mentionname( 'foo-bar-baz' ) );
167
-
168
- remove_filter( 'bp_is_username_compatibility_mode', '__return_false' );
169
- }
170
-
171
- /**
172
- * @group bp_activity_get_userid_from_mentionname
173
- */
174
- public function test_bp_activity_get_userid_from_mentionname_compatibilitymode_on() {
175
- add_filter( 'bp_is_username_compatibility_mode', '__return_true' );
176
-
177
- // all spaces are hyphens
178
- $u1 = $this->create_user( array(
179
- 'user_login' => 'foo bar baz',
180
- 'user_nicename' => 'foobarbaz',
181
- ) );
182
-
183
- // no spaces are hyphens
184
- $u2 = $this->create_user( array(
185
- 'user_login' => 'foo-bar-baz-1',
186
- 'user_nicename' => 'foobarbaz-1',
187
- ) );
188
-
189
- // some spaces are hyphens
190
- $u3 = $this->create_user( array(
191
- 'user_login' => 'foo bar-baz 2',
192
- 'user_nicename' => 'foobarbaz-2',
193
- ) );
194
-
195
- $u4 = $this->create_user( array(
196
- 'user_login' => 'foo.bar.baz',
197
- 'user_nicename' => 'foo-bar-baz',
198
- ) );
199
-
200
- $this->assertEquals( $u1, bp_activity_get_userid_from_mentionname( 'foo-bar-baz' ) );
201
- $this->assertEquals( $u2, bp_activity_get_userid_from_mentionname( 'foo-bar-baz-1' ) );
202
- $this->assertEquals( $u3, bp_activity_get_userid_from_mentionname( 'foo-bar-baz-2' ) );
203
- $this->assertEquals( $u4, bp_activity_get_userid_from_mentionname( 'foo.bar.baz' ) );
204
-
205
- remove_filter( 'bp_is_username_compatibility_mode', '__return_true' );
206
- }
207
-
208
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/activity/template.php DELETED
@@ -1,256 +0,0 @@
1
- <?php
2
- /**
3
- * @group activity
4
- */
5
- class BP_Tests_Activity_Template extends BP_UnitTestCase {
6
- protected $old_current_user = 0;
7
-
8
- public function setUp() {
9
- parent::setUp();
10
-
11
- $this->old_current_user = get_current_user_id();
12
- $this->set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
13
- }
14
-
15
- public function tearDown() {
16
- parent::tearDown();
17
- $this->set_current_user( $this->old_current_user );
18
- }
19
-
20
- /**
21
- * @ticket BP4735
22
- */
23
- public function test_user_can_delete() {
24
- global $bp;
25
-
26
- $a = $this->factory->activity->create( array(
27
- 'type' => 'activity_update',
28
- ) );
29
-
30
- // User can delete his own items
31
- $activity = $this->factory->activity->get_object_by_id( $a );
32
- $this->assertTrue( bp_activity_user_can_delete( $activity ) );
33
-
34
- // Stash original user
35
- $original_user = get_current_user_id();
36
-
37
- // Logged-out user can't delete
38
- $this->set_current_user( 0 );
39
- $this->assertFalse( bp_activity_user_can_delete( $activity ) );
40
-
41
- // Miscellaneous user can't delete
42
- $misc_user = $this->factory->user->create( array( 'role' => 'subscriber' ) );
43
- $this->set_current_user( $misc_user );
44
- $this->assertFalse( bp_activity_user_can_delete( $activity ) );
45
-
46
- // Item admin can delete
47
- $is_single_item = $bp->is_single_item;
48
- $bp->is_single_item = true;
49
-
50
- $is_item_admin = $bp->is_item_admin;
51
- $bp->is_item_admin = true;
52
-
53
- $this->assertTrue( bp_activity_user_can_delete( $activity ) );
54
-
55
- $bp->is_single_item = $is_single_item;
56
- $bp->is_item_admin = $is_item_admin;
57
- $this->set_current_user( $original_user );
58
- }
59
-
60
-
61
- /**
62
- * Make sure that action filters ('activity_update', etc) work when
63
- * limiting query to user favorites
64
- *
65
- * @ticket BP4872
66
- */
67
- public function test_bp_has_activities_favorites_action_filter() {
68
- $user_id = $this->factory->user->create( array( 'role' => 'subscriber' ) );
69
-
70
- $now = time();
71
-
72
- $a1 = $this->factory->activity->create( array(
73
- 'type' => 'activity_update',
74
- 'recorded_time' => date( 'Y-m-d H:i:s', $now ),
75
- ) );
76
-
77
- $a2 = $this->factory->activity->create( array(
78
- 'type' => 'joined_group',
79
- 'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
80
- ) );
81
-
82
- bp_activity_add_user_favorite( $a1, $user_id );
83
- bp_activity_add_user_favorite( $a2, $user_id );
84
-
85
- // groan. It sucks that you have to invoke the global
86
- global $activities_template;
87
-
88
- // Case 1: no action filter
89
- bp_has_activities( array(
90
- 'user_id' => $user_id,
91
- 'scope' => 'favorites',
92
- ) );
93
-
94
- // The formatting of $activities_template->activities is messed
95
- // up, so we're just going to look at the IDs. This should be
96
- // fixed in BP at some point
97
- $ids = wp_list_pluck( $activities_template->activities, 'id' );
98
-
99
- $this->assertEquals( array( $a1, $a2 ), $ids );
100
-
101
- $activities_template = null;
102
-
103
- // Case 2: action filter
104
- bp_has_activities( array(
105
- 'user_id' => $user_id,
106
- 'scope' => 'favorites',
107
- 'action' => 'activity_update',
108
- ) );
109
-
110
- global $wpdb, $bp;
111
-
112
- $ids = wp_list_pluck( $activities_template->activities, 'id' );
113
-
114
- $this->assertEquals( array( $a1 ), $ids );
115
-
116
- $activities_template = null;
117
- }
118
-
119
- /**
120
- * Integration test for 'meta_query' param
121
- */
122
- function test_bp_has_activities_with_meta_query() {
123
- $a1 = $this->factory->activity->create();
124
- $a2 = $this->factory->activity->create();
125
- bp_activity_update_meta( $a1, 'foo', 'bar' );
126
-
127
- global $activities_template;
128
- bp_has_activities( array(
129
- 'meta_query' => array(
130
- array(
131
- 'key' => 'foo',
132
- 'value' => 'bar',
133
- ),
134
- ),
135
- ) );
136
-
137
- $ids = wp_list_pluck( $activities_template->activities, 'id' );
138
- $this->assertEquals( $ids, array( $a1 ) );
139
- }
140
-
141
- /**
142
- * @ticket BP5029
143
- * @group bp_has_activities
144
- */
145
- public function test_bp_has_activities_with_display_comments_false() {
146
- $now = time();
147
- $a1 = $this->factory->activity->create( array(
148
- 'content' => 'Life Rules',
149
- 'recorded_time' => date( 'Y-m-d H:i:s', $now ),
150
- ) );
151
- $a2 = $this->factory->activity->create( array(
152
- 'content' => 'Life Drools',
153
- 'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
154
- ) );
155
- $a3 = bp_activity_new_comment( array(
156
- 'activity_id' => $a1,
157
- 'content' => 'Candy is good',
158
- 'recorded_time' => date( 'Y-m-d H:i:s', $now - 50 ),
159
- ) );
160
-
161
- global $activities_template;
162
- bp_has_activities( array(
163
- 'display_comments' => false,
164
- ) );
165
- $ids = wp_list_pluck( $activities_template->activities, 'id' );
166
-
167
- $this->assertEquals( array( $a1, $a2 ), wp_parse_id_list( $ids ) );
168
-
169
- }
170
-
171
- /**
172
- * @ticket BP5029
173
- * @group bp_has_activities
174
- */
175
- public function test_bp_has_activities_with_display_comments_0() {
176
- $now = time();
177
- $a1 = $this->factory->activity->create( array(
178
- 'content' => 'Life Rules',
179
- 'recorded_time' => date( 'Y-m-d H:i:s', $now ),
180
- ) );
181
- $a2 = $this->factory->activity->create( array(
182
- 'content' => 'Life Drools',
183
- 'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
184
- ) );
185
- $a3 = bp_activity_new_comment( array(
186
- 'activity_id' => $a1,
187
- 'content' => 'Candy is good',
188
- 'recorded_time' => date( 'Y-m-d H:i:s', $now - 50 ),
189
- ) );
190
-
191
- global $activities_template;
192
- bp_has_activities( array(
193
- 'display_comments' => 0,
194
- ) );
195
- $ids = wp_list_pluck( $activities_template->activities, 'id' );
196
-
197
- $this->assertEquals( array( $a1, $a2 ), wp_parse_id_list( $ids ) );
198
-
199
- }
200
-
201
- /**
202
- * @ticket BP5029
203
- * @group bp_has_activities
204
- */
205
- public function test_bp_has_activities_with_display_comments_0_querystring() {
206
- $now = time();
207
- $a1 = $this->factory->activity->create( array(
208
- 'content' => 'Life Rules',
209
- 'recorded_time' => date( 'Y-m-d H:i:s', $now ),
210
- ) );
211
- $a2 = $this->factory->activity->create( array(
212
- 'content' => 'Life Drools',
213
- 'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
214
- ) );
215
- $a3 = bp_activity_new_comment( array(
216
- 'activity_id' => $a1,
217
- 'content' => 'Candy is good',
218
- 'recorded_time' => date( 'Y-m-d H:i:s', $now - 50 ),
219
- ) );
220
-
221
- global $activities_template;
222
- bp_has_activities( 'display_comments=0' );
223
- $ids = wp_list_pluck( $activities_template->activities, 'id' );
224
-
225
- $this->assertEquals( array( $a1, $a2 ), $ids );
226
-
227
- }
228
-
229
- /**
230
- * @ticket BP5029
231
- * @group bp_has_activities
232
- */
233
- public function test_bp_has_activities_with_display_comments_none_querystring() {
234
- $now = time();
235
- $a1 = $this->factory->activity->create( array(
236
- 'content' => 'Life Rules',
237
- 'recorded_time' => date( 'Y-m-d H:i:s', $now ),
238
- ) );
239
- $a2 = $this->factory->activity->create( array(
240
- 'content' => 'Life Drools',
241
- 'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
242
- ) );
243
- $a3 = bp_activity_new_comment( array(
244
- 'activity_id' => $a1,
245
- 'content' => 'Candy is good',
246
- 'recorded_time' => date( 'Y-m-d H:i:s', $now - 50 ),
247
- ) );
248
-
249
- global $activities_template;
250
- bp_has_activities( 'display_comments=none' );
251
- $ids = wp_list_pluck( $activities_template->activities, 'id' );
252
-
253
- $this->assertEquals( array( $a1, $a2 ), $ids );
254
-
255
- }
256
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/admin/functions.php DELETED
@@ -1,123 +0,0 @@
1
- <?php
2
- /**
3
- * @group admin
4
- */
5
- class BP_Tests_Admin_Functions extends BP_UnitTestCase {
6
- protected $old_current_user = 0;
7
-
8
- public function setUp() {
9
- parent::setUp();
10
- $this->old_current_user = get_current_user_id();
11
- $this->set_current_user( $this->create_user( array( 'role' => 'administrator' ) ) );
12
-
13
- if ( ! function_exists( 'bp_admin' ) ) {
14
- require_once( BP_PLUGIN_DIR . 'bp-core/bp-core-admin.php' );
15
- }
16
-
17
- if ( ! function_exists( 'bp_new_site' ) ) {
18
- bp_admin();
19
- }
20
- }
21
-
22
- public function tearDown() {
23
- parent::tearDown();
24
- $this->set_current_user( $this->old_current_user );
25
- }
26
-
27
- public function test_bp_admin_list_table_current_bulk_action() {
28
- $_REQUEST['action'] = 'foo';
29
- $_REQUEST['action2'] = '-1';
30
- $this->assertEquals( bp_admin_list_table_current_bulk_action(), 'foo' );
31
-
32
- $_REQUEST['action'] = '-1';
33
- $_REQUEST['action2'] = 'foo';
34
- $this->assertEquals( bp_admin_list_table_current_bulk_action(), 'foo' );
35
-
36
- $_REQUEST['action'] = 'bar';
37
- $_REQUEST['action2'] = 'foo';
38
- $this->assertEquals( bp_admin_list_table_current_bulk_action(), 'foo' );
39
- }
40
-
41
- public function test_bp_core_admin_get_active_components_from_submitted_settings() {
42
- $get_action = isset( $_GET['action'] ) ? $_GET['action'] : null;
43
- $ac = buddypress()->active_components;
44
-
45
- // Standard deactivation from All screen
46
- unset( $_GET['action'] );
47
- buddypress()->active_components = array(
48
- 'activity' => 1,
49
- 'friends' => 1,
50
- 'groups' => 1,
51
- 'members' => 1,
52
- 'messages' => 1,
53
- 'settings' => 1,
54
- 'xprofile' => 1,
55
- );
56
-
57
- $submitted = array(
58
- 'groups' => 1,
59
- 'members' => 1,
60
- 'messages' => 1,
61
- 'settings' => 1,
62
- 'xprofile' => 1,
63
- );
64
-
65
- $this->assertEquals( bp_core_admin_get_active_components_from_submitted_settings( $submitted ), array( 'groups' => 1, 'members' => 1, 'messages' => 1, 'settings' => 1, 'xprofile' => 1 ) );
66
-
67
- // Activating deactivated components from the Inactive screen
68
- $_GET['action'] = 'inactive';
69
- buddypress()->active_components = array(
70
- 'activity' => 1,
71
- 'members' => 1,
72
- 'messages' => 1,
73
- 'settings' => 1,
74
- 'xprofile' => 1,
75
- );
76
-
77
- $submitted2 = array(
78
- 'groups' => 1,
79
- );
80
-
81
- $this->assertEquals( bp_core_admin_get_active_components_from_submitted_settings( $submitted2 ), array( 'activity' => 1, 'groups' => 1, 'members' => 1, 'messages' => 1, 'settings' => 1, 'xprofile' => 1 ) );
82
-
83
- // Activating from the Retired screen
84
- $_GET['action'] = 'retired';
85
- buddypress()->active_components = array(
86
- 'activity' => 1,
87
- 'members' => 1,
88
- 'messages' => 1,
89
- 'settings' => 1,
90
- 'xprofile' => 1,
91
- );
92
-
93
- $submitted3 = array(
94
- 'forums' => 1,
95
- );
96
-
97
- $this->assertEquals( bp_core_admin_get_active_components_from_submitted_settings( $submitted3 ), array( 'activity' => 1, 'forums' => 1, 'members' => 1, 'messages' => 1, 'settings' => 1, 'xprofile' => 1 ) );
98
-
99
- // Deactivating from the Retired screen
100
- $_GET['action'] = 'retired';
101
- buddypress()->active_components = array(
102
- 'activity' => 1,
103
- 'forums' => 1,
104
- 'members' => 1,
105
- 'messages' => 1,
106
- 'settings' => 1,
107
- 'xprofile' => 1,
108
- );
109
-
110
- $submitted4 = array();
111
-
112
- $this->assertEquals( bp_core_admin_get_active_components_from_submitted_settings( $submitted4 ), array( 'activity' => 1, 'members' => 1, 'messages' => 1, 'settings' => 1, 'xprofile' => 1 ) );
113
-
114
- // reset
115
- if ( $get_action ) {
116
- $_GET['action'] = $get_action;
117
- } else {
118
- unset( $_GET['action'] );
119
- }
120
-
121
- buddypress()->active_components = $ac;
122
- }
123
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/blogs/class-bp-blogs-blog.php DELETED
@@ -1,67 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * @group blogs
5
- */
6
- class BP_Tests_BP_Blogs_Blog_TestCases extends BP_UnitTestCase {
7
- public function setUp() {
8
- parent::setUp();
9
- }
10
-
11
- public function tearDown() {
12
- parent::tearDown();
13
- }
14
-
15
- public function test_get_with_search_terms() {
16
- if ( ! is_multisite() ) {
17
- return;
18
- }
19
-
20
- $old_user = get_current_user_id();
21
-
22
- $u = $this->create_user();
23
- $this->set_current_user( $u );
24
- $b = $this->factory->blog->create( array(
25
- 'title' => 'The Foo Bar Blog',
26
- 'user_id' => $u,
27
- ) );
28
- bp_blogs_record_existing_blogs();
29
-
30
- // make the blog public or it won't turn up in generic results
31
- update_blog_option( $b, 'blog_public', '1' );
32
-
33
- $blogs = BP_Blogs_Blog::get( 'active', false, false, 0, 'Foo' );
34
- $blog_ids = wp_list_pluck( $blogs['blogs'], 'blog_id' );
35
-
36
- $this->assertEquals( array( $b ), $blog_ids );
37
-
38
- $this->set_current_user( $old_user );
39
- }
40
-
41
- public function test_search_blogs() {
42
- if ( ! is_multisite() ) {
43
- return;
44
- }
45
-
46
- $old_user = get_current_user_id();
47
-
48
- $u = $this->create_user();
49
- $this->set_current_user( $u );
50
- $b = $this->factory->blog->create( array(
51
- 'title' => 'The Foo Bar Blog',
52
- 'user_id' => $u,
53
- ) );
54
- bp_blogs_record_existing_blogs();
55
-
56
- // make the blog public or it won't turn up in generic results
57
- update_blog_option( $b, 'blog_public', '1' );
58
-
59
- $blogs = BP_Blogs_Blog::search_blogs( 'Foo' );
60
- $blog_ids = wp_list_pluck( $blogs['blogs'], 'blog_id' );
61
-
62
- $this->assertEquals( array( $b ), $blog_ids );
63
-
64
- $this->set_current_user( $old_user );
65
- }
66
-
67
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/core/avatars.php DELETED
@@ -1,56 +0,0 @@
1
- <?php
2
- /**
3
- * @group core
4
- * @group avatars
5
- */
6
- class BP_Tests_Avatars extends BP_UnitTestCase {
7
- protected $old_current_user = 0;
8
-
9
- public function setUp() {
10
- parent::setUp();
11
-
12
- $this->old_current_user = get_current_user_id();
13
- $this->administrator = $this->factory->user->create( array( 'role' => 'administrator' ) );
14
- wp_set_current_user( $this->administrator );
15
- }
16
-
17
- public function tearDown() {
18
- parent::tearDown();
19
- wp_set_current_user( $this->old_current_user );
20
- }
21
-
22
- /**
23
- * @ticket 4948
24
- */
25
- function test_avatars_on_non_root_blog() {
26
- // Do not pass 'Go', do not collect $200
27
- if ( ! is_multisite() ) {
28
- return;
29
- }
30
-
31
- // switch to BP root blog if necessary
32
- if ( bp_get_root_blog_id() != get_current_blog_id() ) {
33
- $this->go_to_root();
34
- }
35
-
36
- // get BP root blog's upload directory data
37
- $upload_dir = wp_upload_dir();
38
-
39
- restore_current_blog();
40
-
41
- // create new subsite
42
- $blog_id = $this->factory->blog->create( array(
43
- 'user_id' => $this->administrator,
44
- 'title' => 'Test Title'
45
- ) );
46
-
47
- // emulate a page load on the new sub-site
48
- $this->go_to( get_blog_option( $blog_id, 'siteurl' ) );
49
-
50
- // test to see if the upload dir is correct
51
- $this->assertEquals( $upload_dir['baseurl'], bp_core_avatar_url() );
52
-
53
- // reset globals
54
- $this->go_to_root();
55
- }
56
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/core/class-bp-core-user.php DELETED
@@ -1,124 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * @group core
5
- */
6
- class BP_Tests_BP_Core_User_TestCases extends BP_UnitTestCase {
7
- protected $old_current_user = 0;
8
-
9
- public function setUp() {
10
- parent::setUp();
11
- }
12
-
13
- public function tearDown() {
14
- parent::tearDown();
15
- }
16
-
17
- /**
18
- * @expectedDeprecated BP_Core_User::get_users
19
- */
20
- public function test_get_users_with_exclude_querystring() {
21
- $u1 = $this->create_user();
22
- $u2 = $this->create_user();
23
- $u3 = $this->create_user();
24
-
25
- $exclude_qs = $u1 . ',junkstring,' . $u3;
26
-
27
- $users = BP_Core_User::get_users( 'active', 0, 1, 0, false, false, true, $exclude_qs );
28
- $user_ids = wp_parse_id_list( wp_list_pluck( $users['users'], 'id' ) );
29
-
30
- $this->assertEquals( array( $u2 ), $user_ids );
31
- }
32
-
33
- /**
34
- * @expectedDeprecated BP_Core_User::get_users
35
- */
36
- public function test_get_users_with_exclude_array() {
37
- $u1 = $this->create_user();
38
- $u2 = $this->create_user();
39
- $u3 = $this->create_user();
40
-
41
- $exclude_array = array(
42
- $u1,
43
- 'junkstring',
44
- $u3,
45
- );
46
-
47
- $users = BP_Core_User::get_users( 'active', 0, 1, 0, false, false, true, $exclude_array );
48
- $user_ids = wp_parse_id_list( wp_list_pluck( $users['users'], 'id' ) );
49
-
50
- $this->assertEquals( array( $u2 ), $user_ids );
51
- }
52
-
53
- /**
54
- * @expectedDeprecated BP_Core_User::get_users
55
- */
56
- public function test_get_users_with_include_querystring() {
57
- $u1 = $this->create_user( array(
58
- 'last_activity' => gmdate( 'Y-m-d H:i:s' ),
59
- ) );
60
- $u2 = $this->create_user( array(
61
- 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 1000 ),
62
- ) );
63
- $u3 = $this->create_user( array(
64
- 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 50 ),
65
- ) );
66
-
67
- $include_qs = $u1 . ',junkstring,' . $u3;
68
-
69
- $users = BP_Core_User::get_users( 'active', 0, 1, 0, $include_qs );
70
- $user_ids = wp_parse_id_list( wp_list_pluck( $users['users'], 'id' ) );
71
-
72
- $this->assertEquals( array( $u1, $u3 ), $user_ids );
73
- }
74
-
75
- /**
76
- * @expectedDeprecated BP_Core_User::get_users
77
- */
78
- public function test_get_users_with_include_array() {
79
- $u1 = $this->create_user( array(
80
- 'last_activity' => gmdate( 'Y-m-d H:i:s' ),
81
- ) );
82
- $u2 = $this->create_user( array(
83
- 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 1000 ),
84
- ) );
85
- $u3 = $this->create_user( array(
86
- 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 50 ),
87
- ) );
88
-
89
-
90
- $include_array = array(
91
- $u1,
92
- 'junkstring',
93
- $u3,
94
- );
95
-
96
- $users = BP_Core_User::get_users( 'active', 0, 1, 0, $include_array );
97
- $user_ids = wp_list_pluck( $users['users'], 'id' );
98
-
99
- // typecast...ugh
100
- $user_ids = array_map( 'intval', $user_ids );
101
-
102
- $this->assertEquals( array( $u1, $u3 ), $user_ids );
103
- }
104
-
105
- public function test_get_specific_users() {
106
- $u1 = $this->create_user();
107
- $u2 = $this->create_user();
108
- $u3 = $this->create_user();
109
-
110
- $include_array = array(
111
- $u1,
112
- 'junkstring',
113
- $u3,
114
- );
115
-
116
- $users = BP_Core_User::get_specific_users( $include_array );
117
- $user_ids = wp_parse_id_list( wp_list_pluck( $users['users'], 'id' ) );
118
-
119
- $this->assertEquals( array( $u1, $u3 ), $user_ids );
120
- }
121
-
122
-
123
-
124
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/core/class-bp-user-query.php DELETED
@@ -1,301 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * @group core
5
- * @group BP_User_Query
6
- */
7
- class BP_Tests_BP_User_Query_TestCases extends BP_UnitTestCase {
8
- protected $old_current_user = 0;
9
-
10
- public function setUp() {
11
- parent::setUp();
12
-
13
- $this->old_current_user = get_current_user_id();
14
- $this->set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
15
- }
16
-
17
- public function tearDown() {
18
- parent::tearDown();
19
- $this->set_current_user( $this->old_current_user );
20
- }
21
-
22
- /**
23
- * Checks that user_id returns friends
24
- */
25
- public function test_bp_user_query_friends() {
26
- $u1 = $this->create_user();
27
- $u2 = $this->create_user();
28
- $u3 = $this->create_user();
29
- friends_add_friend( $u1, $u2, true );
30
-
31
- $q = new BP_User_Query( array(
32
- 'user_id' => $u2,
33
- ) );
34
-
35
- $friends = is_array( $q->results ) ? array_values( $q->results ) : array();
36
- $friend_ids = wp_list_pluck( $friends, 'ID' );
37
- $this->assertEquals( $friend_ids, array( $u1 ) );
38
- }
39
-
40
- /**
41
- * @ticket 4938
42
- */
43
- public function test_bp_user_query_friends_with_include() {
44
- $u1 = $this->create_user();
45
- $u2 = $this->create_user();
46
- $u3 = $this->create_user();
47
- $u4 = $this->create_user();
48
- friends_add_friend( $u1, $u2, true );
49
- friends_add_friend( $u1, $u3, true );
50
-
51
- $q = new BP_User_Query( array(
52
- 'user_id' => $u1,
53
-
54
- // Represents an independent filter passed by a plugin
55
- // u4 is not a friend of u1 and should not be returned
56
- 'include' => array( $u2, $u4 ),
57
- ) );
58
-
59
- $friends = is_array( $q->results ) ? array_values( $q->results ) : array();
60
- $friend_ids = wp_list_pluck( $friends, 'ID' );
61
- $this->assertEquals( $friend_ids, array( $u2 ) );
62
- }
63
-
64
- public function test_bp_user_query_friends_with_include_but_zero_friends() {
65
- $u1 = $this->create_user();
66
- $u2 = $this->create_user();
67
- $u3 = $this->create_user();
68
- $u4 = $this->create_user();
69
-
70
- $q = new BP_User_Query( array(
71
- 'user_id' => $u1,
72
-
73
- // Represents an independent filter passed by a plugin
74
- // u4 is not a friend of u1 and should not be returned
75
- 'include' => array( $u2, $u4 ),
76
- ) );
77
-
78
- $friends = is_array( $q->results ) ? array_values( $q->results ) : array();
79
- $friend_ids = wp_list_pluck( $friends, 'ID' );
80
- $this->assertEquals( $friend_ids, array() );
81
- }
82
-
83
- public function test_bp_user_query_sort_by_popular() {
84
- $u1 = $this->create_user();
85
- $u2 = $this->create_user();
86
- $u3 = $this->create_user();
87
- $u4 = $this->create_user();
88
-
89
- bp_update_user_meta( $u1, bp_get_user_meta_key( 'total_friend_count' ), '5' );
90
- bp_update_user_meta( $u2, bp_get_user_meta_key( 'total_friend_count' ), '90' );
91
- bp_update_user_meta( $u3, bp_get_user_meta_key( 'total_friend_count' ), '101' );
92
- bp_update_user_meta( $u4, bp_get_user_meta_key( 'total_friend_count' ), '3002' );
93
-
94
- $q = new BP_User_Query( array(
95
- 'type' => 'popular',
96
- ) );
97
-
98
- $users = is_array( $q->results ) ? array_values( $q->results ) : array();
99
- $user_ids = wp_parse_id_list( wp_list_pluck( $users, 'ID' ) );
100
-
101
- $expected = array( $u4, $u3, $u2, $u1 );
102
- $this->assertEquals( $expected, $user_ids );
103
- }
104
-
105
- /**
106
- * @group online
107
- */
108
- public function test_bp_user_query_type_online() {
109
- $now = time();
110
- $u1 = $this->create_user( array(
111
- 'last_activity' => date( 'Y-m-d H:i:s', $now ),
112
- ) );
113
- $u2 = $this->create_user( array(
114
- 'last_activity' => date( 'Y-m-d H:i:s', $now - 60*13 ),
115
- ) );
116
- $u3 = $this->create_user( array(
117
- 'last_activity' => date( 'Y-m-d H:i:s', $now - 60*16 ),
118
- ) );
119
-
120
- $q = new BP_User_Query( array(
121
- 'type' => 'online',
122
- ) );
123
-
124
- $users = is_array( $q->results ) ? array_values( $q->results ) : array();
125
- $user_ids = wp_parse_id_list( wp_list_pluck( $users, 'ID' ) );
126
- $this->assertEquals( array( $u1, $u2 ), $user_ids );
127
- }
128
-
129
- /**
130
- * @group online
131
- */
132
- public function test_bp_user_query_type_online_five_minute_interval() {
133
- $now = time();
134
- $u1 = $this->create_user( array(
135
- 'last_activity' => date( 'Y-m-d H:i:s', $now ),
136
- ) );
137
- $u2 = $this->create_user( array(
138
- 'last_activity' => date( 'Y-m-d H:i:s', $now - 60*4 ),
139
- ) );
140
- $u3 = $this->create_user( array(
141
- 'last_activity' => date( 'Y-m-d H:i:s', $now - 60*6 ),
142
- ) );
143
-
144
- add_filter( 'bp_user_query_online_interval', create_function( '', 'return 5;' ) );
145
-
146
- $q = new BP_User_Query( array(
147
- 'type' => 'online',
148
- ) );
149
-
150
- $users = is_array( $q->results ) ? array_values( $q->results ) : array();
151
- $user_ids = wp_parse_id_list( wp_list_pluck( $users, 'ID' ) );
152
- $this->assertEquals( array( $u1, $u2 ), $user_ids );
153
- }
154
-
155
-
156
- public function test_bp_user_query_search_with_apostrophe() {
157
- // Apostrophe. Search_terms must escaped to mimic POST payload
158
- $user_id = $this->create_user();
159
- xprofile_set_field_data( 1, $user_id, "Foo'Bar" );
160
- $q = new BP_User_Query( array( 'search_terms' => "oo\'Ba", ) );
161
-
162
- $found_user_id = null;
163
- if ( ! empty( $q->results ) ) {
164
- $found_user = array_pop( $q->results );
165
- $found_user_id = $found_user->ID;
166
- }
167
-
168
- $this->assertEquals( $user_id, $found_user_id );
169
- }
170
-
171
- public function test_bp_user_query_search_with_percent_sign() {
172
-
173
- // LIKE special character: %
174
- $user_id = $this->create_user();
175
- xprofile_set_field_data( 1, $user_id, "Foo%Bar" );
176
- $q = new BP_User_Query( array( 'search_terms' => "oo%Bar", ) );
177
-
178
- $found_user_id = null;
179
- if ( ! empty( $q->results ) ) {
180
- $found_user = array_pop( $q->results );
181
- $found_user_id = $found_user->ID;
182
- }
183
-
184
- $this->assertEquals( $user_id, $found_user_id );
185
-
186
- }
187
-
188
- public function test_bp_user_query_search_with_underscore() {
189
-
190
- // LIKE special character: _
191
- $user_id = $this->create_user();
192
- xprofile_set_field_data( 1, $user_id, "Foo_Bar" );
193
- $q = new BP_User_Query( array( 'search_terms' => "oo_Bar", ) );
194
-
195
- $found_user_id = null;
196
- if ( ! empty( $q->results ) ) {
197
- $found_user = array_pop( $q->results );
198
- $found_user_id = $found_user->ID;
199
- }
200
-
201
- $this->assertEquals( $user_id, $found_user_id );
202
- }
203
-
204
- /**
205
- * @group exclude
206
- */
207
- public function test_bp_user_query_with_exclude() {
208
- // Grab list of existing users who should also be excluded
209
- global $wpdb;
210
- $existing_users = $wpdb->get_col( "SELECT ID FROM {$wpdb->users}" );
211
-
212
- $u1 = $this->create_user();
213
- $u2 = $this->create_user();
214
-
215
- $exclude = array_merge( array( $u1 ), $existing_users );
216
- $q = new BP_User_Query( array( 'exclude' => $exclude, ) );
217
-
218
- $found_user_ids = null;
219
- if ( ! empty( $q->results ) ) {
220
- $found_user_ids = array_values( wp_parse_id_list( wp_list_pluck( $q->results, 'ID' ) ) );
221
- }
222
-
223
- $this->assertEquals( array( $u2 ), $found_user_ids );
224
- }
225
-
226
- /**
227
- * @group type
228
- * @group spam
229
- */
230
- public function test_bp_user_query_type_alphabetical_spam_xprofileon() {
231
- if ( is_multisite() ) {
232
- return;
233
- }
234
-
235
- // Make sure xprofile is on
236
- $xprofile_toggle = isset( buddypress()->active_components['xprofile'] );
237
- buddypress()->active_components['xprofile'] = 1;
238
- add_filter( 'bp_disable_profile_sync', '__return_false' );
239
-
240
- $u1 = $this->create_user();
241
- $u2 = $this->create_user();
242
-
243
- global $wpdb;
244
- bp_core_process_spammer_status( $u1, 'spam' );
245
-
246
- $q = new BP_User_Query( array( 'type' => 'alphabetical', ) );
247
-
248
- // Restore xprofile setting
249
- if ( $xprofile_toggle ) {
250
- buddypress()->active_components['xprofile'] = 1;
251
- } else {
252
- unset( buddypress()->active_components['xprofile'] );
253
- }
254
- remove_filter( 'bp_disable_profile_sync', '__return_false' );
255
-
256
- $found_user_ids = null;
257
-
258
- if ( ! empty( $q->results ) ) {
259
- $found_user_ids = array_values( wp_parse_id_list( wp_list_pluck( $q->results, 'ID' ) ) );
260
- }
261
-
262
- // Do a assertNotContains because there are weird issues with user #1 as created by WP
263
- $this->assertNotContains( $u1, $found_user_ids );
264
- }
265
-
266
- /**
267
- * @group type
268
- * @group spam
269
- */
270
- public function test_bp_user_query_type_alphabetical_spam_xprofileoff() {
271
- $u1 = $this->create_user();
272
- $u2 = $this->create_user();
273
-
274
- // Make sure xprofile and profile sync are off
275
- $xprofile_toggle = isset( buddypress()->active_components['xprofile'] );
276
- buddypress()->active_components['xprofile'] = 0;
277
- add_filter( 'bp_disable_profile_sync', '__return_false' );
278
-
279
- bp_core_process_spammer_status( $u1, 'spam' );
280
-
281
- $q = new BP_User_Query( array( 'type' => 'alphabetical', ) );
282
-
283
- // Restore xprofile setting
284
- if ( $xprofile_toggle ) {
285
- buddypress()->active_components['xprofile'] = 1;
286
- } else {
287
- unset( buddypress()->active_components['xprofile'] );
288
- }
289
- remove_filter( 'bp_disable_profile_sync', '__return_false' );
290
-
291
- $found_user_ids = null;
292
-
293
- if ( ! empty( $q->results ) ) {
294
- $found_user_ids = array_values( wp_parse_id_list( wp_list_pluck( $q->results, 'ID' ) ) );
295
- }
296
-
297
- // Do a assertNotContains because there are weird issues with user #1 as created by WP
298
- $this->assertNotContains( $u1, $found_user_ids );
299
- }
300
-
301
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/core/functions.php DELETED
@@ -1,258 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * @group core
5
- */
6
-
7
- class BP_Tests_Core_Functions extends BP_UnitTestCase {
8
- /**
9
- * @group bp_esc_sql_order
10
- */
11
- public function test_bp_esc_sql_order_ASC() {
12
- $this->assertEquals( 'ASC', bp_esc_sql_order( 'ASC' ) );
13
- }
14
-
15
- /**
16
- * @group bp_esc_sql_order
17
- */
18
- public function test_bp_esc_sql_order_DESC() {
19
- $this->assertEquals( 'DESC', bp_esc_sql_order( 'DESC' ) );
20
- }
21
-
22
- /**
23
- * @group bp_esc_sql_order
24
- */
25
- public function test_bp_esc_sql_order_desc_lowercase() {
26
- $this->assertEquals( 'DESC', bp_esc_sql_order( 'desc' ) );
27
- }
28
-
29
- /**
30
- * @group bp_esc_sql_order
31
- */
32
- public function test_bp_esc_sql_order_desc_whitespace() {
33
- $this->assertEquals( 'DESC', bp_esc_sql_order( ' desc ' ) );
34
- }
35
-
36
- /**
37
- * @group bp_esc_sql_order
38
- */
39
- public function test_bp_esc_sql_order_invalid() {
40
- $this->assertEquals( 'ASC', bp_esc_sql_order( 'In ur base killin ur d00dz' ) );
41
- }
42
-
43
- /**
44
- * @group bp_core_time_since
45
- */
46
- public function test_bp_core_time_since_years_months() {
47
- $now = time();
48
- $then = $now - ( 3 * YEAR_IN_SECONDS ) - ( 3 * 30 * DAY_IN_SECONDS );
49
- $this->assertEquals( '3 years, 3 months ago', bp_core_time_since( $then, $now ) );
50
- }
51
-
52
- /**
53
- * @group bp_core_time_since
54
- */
55
- public function test_bp_core_time_since_years_nomonths() {
56
- $now = time();
57
- $then = $now - ( 3 * YEAR_IN_SECONDS );
58
- $this->assertEquals( '3 years ago', bp_core_time_since( $then, $now ) );
59
- }
60
-
61
- /**
62
- * @group bp_core_time_since
63
- */
64
- public function test_bp_core_time_since_months_weeks() {
65
- $now = time();
66
- $then = $now - ( 3 * 30 * DAY_IN_SECONDS ) - ( 3 * WEEK_IN_SECONDS );
67
- $this->assertEquals( '3 months, 3 weeks ago', bp_core_time_since( $then, $now ) );
68
- }
69
-
70
- /**
71
- * @group bp_core_time_since
72
- */
73
- public function test_bp_core_time_since_months_noweeks() {
74
- $now = time();
75
- $then = $now - ( 3 * 30 * DAY_IN_SECONDS );
76
- $this->assertEquals( '3 months ago', bp_core_time_since( $then, $now ) );
77
- }
78
-
79
- /**
80
- * @group bp_core_time_since
81
- */
82
- public function test_bp_core_time_since_weeks_days() {
83
- $now = time();
84
- $then = $now - ( 3 * WEEK_IN_SECONDS ) - ( 3 * DAY_IN_SECONDS );
85
- $this->assertEquals( '3 weeks, 3 days ago', bp_core_time_since( $then, $now ) );
86
- }
87
-
88
- /**
89
- * @group bp_core_time_since
90
- */
91
- public function test_bp_core_time_since_weeks_nodays() {
92
- $now = time();
93
- $then = $now - ( 3 * WEEK_IN_SECONDS );
94
- $this->assertEquals( '3 weeks ago', bp_core_time_since( $then, $now ) );
95
- }
96
-
97
- /**
98
- * @group bp_core_time_since
99
- */
100
- public function test_bp_core_time_since_days_hours() {
101
- $now = time();
102
- $then = $now - ( 3 * DAY_IN_SECONDS ) - ( 3 * HOUR_IN_SECONDS );
103
- $this->assertEquals( '3 days, 3 hours ago', bp_core_time_since( $then, $now ) );
104
- }
105
-
106
- /**
107
- * @group bp_core_time_since
108
- */
109
- public function test_bp_core_time_since_days_nohours() {
110
- $now = time();
111
- $then = $now - ( 3 * DAY_IN_SECONDS );
112
- $this->assertEquals( '3 days ago', bp_core_time_since( $then, $now ) );
113
- }
114
-
115
- /**
116
- * @group bp_core_time_since
117
- */
118
- public function test_bp_core_time_since_hours_minutes() {
119
- $now = time();
120
- $then = $now - ( 3 * HOUR_IN_SECONDS ) - ( 3 * MINUTE_IN_SECONDS );
121
- $this->assertEquals( '3 hours, 3 minutes ago', bp_core_time_since( $then, $now ) );
122
- }
123
-
124
- /**
125
- * @group bp_core_time_since
126
- */
127
- public function test_bp_core_time_since_hours_nominutes() {
128
- $now = time();
129
- $then = $now - ( 3 * HOUR_IN_SECONDS );
130
- $this->assertEquals( '3 hours ago', bp_core_time_since( $then, $now ) );
131
- }
132
-
133
- /**
134
- * @group bp_core_time_since
135
- * @ticket BP5017
136
- */
137
- public function test_bp_core_time_since_minutes_seconds() {
138
- $now = time();
139
- $then = $now - ( 3 * MINUTE_IN_SECONDS ) - 3;
140
- $this->assertEquals( '3 minutes ago', bp_core_time_since( $then, $now ) );
141
- }
142
-
143
- /**
144
- * @group bp_core_time_since
145
- */
146
- public function test_bp_core_time_since_minutes_noseconds() {
147
- $now = time();
148
- $then = $now - ( 3 * MINUTE_IN_SECONDS );
149
- $this->assertEquals( '3 minutes ago', bp_core_time_since( $then, $now ) );
150
- }
151
-
152
- /**
153
- * @group bp_core_time_since
154
- */
155
- public function test_bp_core_time_since_seconds() {
156
- $now = time();
157
- $then = $now - 3;
158
- $this->assertEquals( '3 seconds ago', bp_core_time_since( $then, $now ) );
159
- }
160
-
161
- /**
162
- * Sanity check for the singular version of 'year'
163
- *
164
- * @group bp_core_time_since
165
- */
166
- public function test_bp_core_time_since_year() {
167
- $now = time();
168
- $then = $now - YEAR_IN_SECONDS;
169
- $this->assertEquals( '1 year ago', bp_core_time_since( $then, $now ) );
170
- }
171
-
172
- /**
173
- * @group bp_core_time_since
174
- */
175
- public function test_bp_core_time_since_rightnow() {
176
- $now = time();
177
- $then = $now;
178
- $this->assertEquals( 'right now', bp_core_time_since( $then, $now ) );
179
- }
180
-
181
- /**
182
- * @group bp_core_time_since
183
- */
184
- public function test_bp_core_time_since_future() {
185
- $now = time();
186
- $then = $now + 100;
187
- $this->assertEquals( 'sometime ago', bp_core_time_since( $then, $now ) );
188
- }
189
-
190
- /**
191
- * @group bp_alpha_sort_by_key
192
- */
193
- public function test_bp_alpha_sort_by_key_arrays() {
194
- $items = array(
195
- array(
196
- 'foo' => 'bar',
197
- 'name' => 'alpha',
198
- ),
199
- array(
200
- 'foo' => 'bar',
201
- 'name' => 'charlie',
202
- ),
203
- array(
204
- 'foo' => 'bar',
205
- 'name' => 'beta',
206
- ),
207
- );
208
-
209
- $expected = array(
210
- array(
211
- 'foo' => 'bar',
212
- 'name' => 'alpha',
213
- ),
214
- array(
215
- 'foo' => 'bar',
216
- 'name' => 'beta',
217
- ),
218
- array(
219
- 'foo' => 'bar',
220
- 'name' => 'charlie',
221
- ),
222
- );
223
-
224
- $this->assertEquals( $expected, bp_alpha_sort_by_key( $items, 'name' ) );
225
- }
226
-
227
- /**
228
- * @group bp_alpha_sort_by_key
229
- */
230
- public function test_bp_alpha_sort_by_key_objects() {
231
- $items = array(
232
- new stdClass,
233
- new stdClass,
234
- new stdClass,
235
- );
236
- $items[0]->foo = 'bar';
237
- $items[0]->name = 'alpha';
238
- $items[1]->foo = 'bar';
239
- $items[1]->name = 'charlie';
240
- $items[2]->foo = 'bar';
241
- $items[2]->name = 'beta';
242
-
243
- $expected = array(
244
- new stdClass,
245
- new stdClass,
246
- new stdClass,
247
- );
248
- $expected[0]->foo = 'bar';
249
- $expected[0]->name = 'alpha';
250
- $expected[1]->foo = 'bar';
251
- $expected[1]->name = 'beta';
252
- $expected[2]->foo = 'bar';
253
- $expected[2]->name = 'charlie';
254
-
255
- $this->assertEquals( $expected, bp_alpha_sort_by_key( $items, 'name' ) );
256
- }
257
-
258
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/friends/class-bp-friends-friendship.php DELETED
@@ -1,126 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * @group friends
5
- */
6
- class BP_Tests_BP_Friends_Friendship_TestCases extends BP_UnitTestCase {
7
- protected $old_current_user = 0;
8
-
9
- public function setUp() {
10
- parent::setUp();
11
-
12
- $this->old_current_user = get_current_user_id();
13
- $this->set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
14
- }
15
-
16
- public function tearDown() {
17
- parent::tearDown();
18
- $this->set_current_user( $this->old_current_user );
19
- }
20
-
21
- public function test_search_friends() {
22
- $u1 = $this->create_user();
23
- $u2 = $this->create_user();
24
- $u3 = $this->create_user();
25
-
26
- xprofile_set_field_data( 1, $u2, 'Cool Dude' );
27
- xprofile_set_field_data( 1, $u3, 'Rock And Roll America Yeah' );
28
-
29
- friends_add_friend( $u1, $u2, true );
30
- friends_add_friend( $u1, $u3, true );
31
-
32
- $friends = BP_Friends_Friendship::search_friends( 'Coo', $u1 );
33
- $this->assertEquals( array( $u2 ), $friends['friends'] );
34
- }
35
-
36
- public function test_get_bulk_last_active() {
37
- $u1 = $this->create_user( array(
38
- 'last_activity' => gmdate( 'Y-m-d H:i:s' ),
39
- ) );
40
- $u2 = $this->create_user( array(
41
- 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 1000 ),
42
- ) );
43
- $u3 = $this->create_user( array(
44
- 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 50 ),
45
- ) );
46
-
47
- $friends = BP_Friends_Friendship::get_bulk_last_active( array( $u1, $u2, $u3, 'junk' ) );
48
- $friend_ids = wp_list_pluck( $friends, 'user_id' );
49
- $this->assertEquals( array( $u1, $u3, $u2 ), $friend_ids );
50
- }
51
-
52
- public function test_search_users() {
53
- $u1 = $this->create_user();
54
- $u2 = $this->create_user();
55
- $u3 = $this->create_user();
56
-
57
- xprofile_set_field_data( 1, $u1, 'Freedom Isn\'t Free' );
58
- xprofile_set_field_data( 1, $u2, 'Cool Dude' );
59
- xprofile_set_field_data( 1, $u3, 'Rock And Roll America Yeah' );
60
-
61
- // Needs a user_id param though it does nothing
62
- $friends = BP_Friends_Friendship::search_users( 'Coo', 1 );
63
- $this->assertEquals( array( $u2 ), $friends );
64
- }
65
-
66
- public function test_search_users_count() {
67
- $u1 = $this->create_user();
68
- $u2 = $this->create_user();
69
- $u3 = $this->create_user();
70
-
71
- xprofile_set_field_data( 1, $u1, 'Freedom Isn\'t Free' );
72
- xprofile_set_field_data( 1, $u2, 'Cool Dude' );
73
- xprofile_set_field_data( 1, $u3, 'Rock And Roll America Yeah' );
74
-
75
- // Needs a user_id param though it does nothing
76
- $friends = BP_Friends_Friendship::search_users_count( 'Coo' );
77
- $this->assertEquals( 1, $friends );
78
- }
79
-
80
- /**
81
- * @group check_is_friend
82
- */
83
- public function test_check_is_friend_not_friends() {
84
- $u1 = $this->create_user();
85
- $u2 = $this->create_user();
86
- $this->assertEquals( 'not_friends', BP_Friends_Friendship::check_is_friend( $u1, $u2 ) );
87
- }
88
-
89
- /**
90
- * @group check_is_friend
91
- */
92
- public function test_check_is_friend_pending() {
93
- $u1 = $this->create_user();
94
- $u2 = $this->create_user();
95
-
96
- $this->setUp_wp_mail();
97
- friends_add_friend( $u1, $u2, false );
98
- $this->tearDown_wp_mail();
99
-
100
- $this->assertEquals( 'pending', BP_Friends_Friendship::check_is_friend( $u1, $u2 ) );
101
- }
102
-
103
- /**
104
- * @group check_is_friend
105
- */
106
- public function test_check_is_friend_awaiting_response() {
107
- $u1 = $this->create_user();
108
- $u2 = $this->create_user();
109
-
110
- $this->setUp_wp_mail();
111
- friends_add_friend( $u1, $u2, false );
112
- $this->tearDown_wp_mail();
113
-
114
- $this->assertEquals( 'awaiting_response', BP_Friends_Friendship::check_is_friend( $u2, $u1 ) );
115
- }
116
-
117
- /**
118
- * @group check_is_friend
119
- */
120
- public function test_check_is_friend_is_friend() {
121
- $u1 = $this->create_user();
122
- $u2 = $this->create_user();
123
- friends_add_friend( $u1, $u2, true );
124
- $this->assertEquals( 'is_friend', BP_Friends_Friendship::check_is_friend( $u1, $u2 ) );
125
- }
126
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/groups/class-bp-group-extension.php DELETED
@@ -1,225 +0,0 @@
1
- <?php
2
-
3
- include_once BP_TESTS_DIR . '/assets/group-extensions.php';
4
-
5
- /**
6
- * @group groups
7
- * @group BP_Group_Extension
8
- */
9
- class BP_Tests_Group_Extension_TestCases extends BP_UnitTestCase {
10
- public function setUp() {
11
- parent::setUp();
12
- }
13
-
14
- public function tearDown() {
15
- parent::tearDown();
16
- }
17
-
18
- public function test_parse_legacy_properties() {
19
- $class_name = 'BPTest_Group_Extension_Parse_Legacy_Properties';
20
- $class_slug = sanitize_title( $class_name );
21
- $e = new $class_name();
22
- $e->_register();
23
-
24
- // Test most items separately so we can ignore irrelevant props
25
- $l = $e->_get_legacy_properties_converted();
26
- $this->assertEquals( $l['name'], $class_name );
27
- $this->assertEquals( $l['slug'], $class_slug );
28
- $this->assertEquals( $l['visibility'], 'private' );
29
- $this->assertEquals( $l['nav_item_position'], 63 );
30
- $this->assertEquals( $l['enable_nav_item'], true );
31
- $this->assertEquals( $l['nav_item_name'], $class_name . ' Nav' );
32
- $this->assertEquals( $l['display_hook'], 'foo_hook' );
33
- $this->assertEquals( $l['template_file'], 'foo_template' );
34
-
35
- // Build the screens array manually
36
- $expected = array(
37
- 'create' => array(
38
- 'name' => $class_name . ' Create',
39
- 'slug' => $class_slug . '-create',
40
- 'position' => 58,
41
- 'enabled' => false,
42
- ),
43
- 'edit' => array(
44
- 'name' => $class_name . ' Edit',
45
- 'slug' => $class_slug . '-edit',
46
- 'enabled' => false,
47
- ),
48
- 'admin' => array(
49
- 'enabled' => true,
50
- 'metabox_context' => 'high',
51
- 'metabox_priority' => 'side',
52
- ),
53
- );
54
-
55
- $this->assertEquals( $expected, $l['screens'] );
56
- }
57
-
58
- public function test_setup_screens_use_global_fallbacks() {
59
- $class_name = 'BPTest_Group_Extension_Setup_Screens_Use_Global_Fallbacks';
60
- $e = new $class_name();
61
- $e->_setup_class_info();
62
- $screens = $e->_get_default_screens();
63
-
64
- $fallback = array(
65
- 'screen_callback' => array( $e, 'settings_screen' ),
66
- 'screen_save_callback' => array( $e, 'settings_screen_save' ),
67
- );
68
- $fallbacks = array(
69
- 'create' => $fallback,
70
- 'edit' => $fallback,
71
- 'admin' => $fallback,
72
- );
73
-
74
- // strip everything from the screens array but what we we're
75
- // testing
76
- foreach ( $screens as &$screen ) {
77
- foreach ( $screen as $k => $v ) {
78
- if ( ! in_array( $k, array( 'screen_callback', 'screen_save_callback' ) ) ) {
79
- unset( $screen[ $k ] );
80
- }
81
- }
82
- }
83
-
84
- $this->assertEquals( $fallbacks, $screens );
85
- }
86
-
87
- public function test_setup_screens_define_edit_screens_locally() {
88
- $class_name = 'BPTest_Group_Extension_Setup_Screens_Define_Edit_Screens_Locally';
89
- $e = new $class_name();
90
- $e->_setup_class_info();
91
- $screens = $e->_get_default_screens();
92
-
93
- $fallback = array(
94
- 'screen_callback' => array( $e, 'settings_screen' ),
95
- 'screen_save_callback' => array( $e, 'settings_screen_save' ),
96
- );
97
- $expected = array(
98
- 'create' => $fallback,
99
- 'edit' => array(
100
- 'screen_callback' => array( $e, 'edit_screen' ),
101
- 'screen_save_callback' => array( $e, 'edit_screen_save' ),
102
- ),
103
- 'admin' => $fallback,
104
- );
105
-
106
- // strip everything from the screens array but what we we're
107
- // testing
108
- foreach ( $screens as &$screen ) {
109
- foreach ( $screen as $k => $v ) {
110
- if ( ! in_array( $k, array( 'screen_callback', 'screen_save_callback' ) ) ) {
111
- unset( $screen[ $k ] );
112
- }
113
- }
114
- }
115
-
116
- $this->assertEquals( $screens, $expected );
117
- }
118
-
119
- public function test_parse_args_r() {
120
- $a = array(
121
- 'veggies' => 'yes',
122
- 'ice_cream' => 'dope',
123
- 'fruit' => array(
124
- 'apple' => 'gross',
125
- 'berries' => array(
126
- 'blueberries' => array(
127
- 'in_season' => 'never',
128
- 'oh' => 'boy',
129
- ),
130
- 'cherries' => 'sometimes',
131
- ),
132
- ),
133
- );
134
-
135
- $b = array(
136
- 'veggies' => 'no',
137
- 'cheese' => array(
138
- 'cheddar' => 'good',
139
- ),
140
- 'fruit' => array(
141
- 'apple' => 'yum',
142
- 'berries' => array(
143
- 'strawberries' => 'awesome',
144
- 'blueberries' => array(
145
- 'in_season' => 'yes',
146
- 'out_of_season' => 'no',
147
- ),
148
- ),
149
- ),
150
- );
151
-
152
- $expected = array(
153
- 'veggies' => 'yes',
154
- 'ice_cream' => 'dope',
155
- 'cheese' => array(
156
- 'cheddar' => 'good',
157
- ),
158
- 'fruit' => array(
159
- 'apple' => 'gross',
160
- 'berries' => array(
161
- 'strawberries' => 'awesome',
162
- 'blueberries' => array(
163
- 'in_season' => 'never',
164
- 'out_of_season' => 'no',
165
- 'oh' => 'boy',
166
- ),
167
- 'cherries' => 'sometimes',
168
- ),
169
- ),
170
- );
171
-
172
- $this->assertEquals( $expected, BP_Group_Extension::parse_args_r( $a, $b ) );
173
- }
174
-
175
- /**
176
- * Config that gets intentionally stored as a direct property of object
177
- */
178
- public function test_access_root_property() {
179
- $class_name = 'BPTest_Group_Extension_Access_Root_Property';
180
- $e = new $class_name();
181
- $e->_register();
182
-
183
- $this->assertEquals( 39, $e->nav_item_position );
184
- }
185
-
186
- /**
187
- * Config that gets registered using init(), but is then accessed via
188
- * the legacy location
189
- */
190
- public function test_access_init_property_using_legacy_location() {
191
- $class_name = 'BPTest_Group_Extension_Access_Init_Property_Using_Legacy_Location';
192
- $e = new $class_name();
193
- $e->_register();
194
-
195
- $this->assertEquals( 18, $e->create_step_position );
196
- }
197
-
198
- /**
199
- * Provides settings_screen* and edit_screen*
200
- */
201
- public function test_get_screen_callback_fallbacks() {
202
- $class_name = 'BPTest_Group_Extension_Get_Screen_Callback_Fallbacks';
203
- $e = new $class_name();
204
- $e->_register();
205
-
206
- $this->assertEquals( array( $e, 'settings_screen' ), $e->screens['create']['screen_callback'] );
207
- $this->assertEquals( array( $e, 'settings_screen_save' ), $e->screens['create']['screen_save_callback'] );
208
- $this->assertEquals( array( $e, 'settings_screen' ), $e->screens['admin']['screen_callback'] );
209
- $this->assertEquals( array( $e, 'settings_screen_save' ), $e->screens['admin']['screen_save_callback'] );
210
- $this->assertEquals( array( $e, 'edit_screen' ), $e->screens['edit']['screen_callback'] );
211
- $this->assertEquals( array( $e, 'edit_screen_save' ), $e->screens['edit']['screen_save_callback'] );
212
- }
213
-
214
- public function test_has_submit_button() {
215
- $a = '<p>Foo bar</p><input type="text" name="awesome" /><input name="save" type="submit" id="saverrrr" />sweet';
216
- $this->assertTrue( BP_Group_Extension::has_submit_button( $a ) );
217
-
218
- $b = '<p>Foo bar</p><input type="text" name="awesome" />sweet';
219
- $this->assertFalse( BP_Group_Extension::has_submit_button( $b ) );
220
-
221
- // switch the quotation marks
222
- $c = "<p>Foo bar</p><input type='text' name='awesome' /><input name='save' type='submit' id='saverrrr' />sweet";
223
- $this->assertTrue( BP_Group_Extension::has_submit_button( $c ) );
224
- }
225
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/groups/class-bp-group-member-query.php DELETED
@@ -1,337 +0,0 @@
1
- <?php
2
- /**
3
- * @group groups
4
- * @group BP_Group_Member_Query
5
- */
6
- class BP_Tests_BP_Group_Member_Query_TestCases extends BP_UnitTestCase {
7
- /**
8
- * Make sure that a manual 'include' param is parsed correctly with
9
- * BP_Group_Member_Query's limiting of the query to group members
10
- */
11
- public function test_with_include() {
12
- $g = $this->factory->group->create();
13
- $u1 = $this->create_user();
14
- $u2 = $this->create_user();
15
- $u3 = $this->create_user();
16
- $time = time();
17
-
18
- $this->add_user_to_group( $u1, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 100 ) ) );
19
- $this->add_user_to_group( $u2, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 200 ) ) );
20
-
21
- $query = new BP_Group_Member_Query( array(
22
- 'group_id' => $g,
23
- 'include' => array( $u2 ),
24
- ) );
25
-
26
- $ids = wp_parse_id_list( array_keys( $query->results ) );
27
- $this->assertEquals( array( $u2, ), $ids );
28
- }
29
-
30
- // Make sure we're falling back on 'member'
31
- public function test_with_group_role_null() {
32
- $g = $this->factory->group->create();
33
- $u1 = $this->create_user();
34
- $u2 = $this->create_user();
35
- $u3 = $this->create_user();
36
- $time = time();
37
-
38
- $this->add_user_to_group( $u1, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 100 ) ) );
39
- $this->add_user_to_group( $u2, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 200 ) ) );
40
- $this->add_user_to_group( $u3, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 300 ) ) );
41
-
42
- $m1 = new BP_Groups_Member( $u1, $g );
43
- $m1->promote( 'admin' );
44
- $m2 = new BP_Groups_Member( $u2, $g );
45
- $m2->promote( 'mod' );
46
-
47
- $query = new BP_Group_Member_Query( array(
48
- 'group_id' => $g,
49
- ) );
50
-
51
- $expected = new BP_Group_Member_Query( array(
52
- 'group_id' => $g,
53
- 'group_role' => array( 'member' ),
54
- ) );
55
-
56
- $this->assertEquals( $expected->results, $query->results );
57
- }
58
-
59
- public function test_with_group_role_member() {
60
- $g = $this->factory->group->create();
61
- $u1 = $this->create_user();
62
- $u2 = $this->create_user();
63
- $u3 = $this->create_user();
64
- $time = time();
65
-
66
- $this->add_user_to_group( $u1, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 100 ) ) );
67
- $this->add_user_to_group( $u2, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 200 ) ) );
68
- $this->add_user_to_group( $u3, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 300 ) ) );
69
-
70
- $m1 = new BP_Groups_Member( $u1, $g );
71
- $m1->promote( 'admin' );
72
- $m2 = new BP_Groups_Member( $u2, $g );
73
- $m2->promote( 'mod' );
74
-
75
- $query_members = new BP_Group_Member_Query( array(
76
- 'group_id' => $g,
77
- 'group_role' => array( 'member' ),
78
- ) );
79
-
80
- $ids = wp_parse_id_list( array_keys( $query_members->results ) );
81
- $this->assertEquals( array( $u3, ), $ids );
82
- }
83
-
84
- public function test_with_group_role_mod() {
85
- $g = $this->factory->group->create();
86
- $u1 = $this->create_user();
87
- $u2 = $this->create_user();
88
- $u3 = $this->create_user();
89
- $time = time();
90
-
91
- $this->add_user_to_group( $u1, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 100 ) ) );
92
- $this->add_user_to_group( $u2, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 200 ) ) );
93
- $this->add_user_to_group( $u3, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 300 ) ) );
94
-
95
- $m1 = new BP_Groups_Member( $u1, $g );
96
- $m1->promote( 'admin' );
97
- $m2 = new BP_Groups_Member( $u2, $g );
98
- $m2->promote( 'mod' );
99
-
100
- $query_members = new BP_Group_Member_Query( array(
101
- 'group_id' => $g,
102
- 'group_role' => array( 'mod' ),
103
- ) );
104
-
105
- $ids = wp_parse_id_list( array_keys( $query_members->results ) );
106
- $this->assertEquals( array( $u2, ), $ids );
107
- }
108
-
109
- public function test_with_group_role_admin() {
110
- $g = $this->factory->group->create();
111
- $u1 = $this->create_user();
112
- $u2 = $this->create_user();
113
- $u3 = $this->create_user();
114
- $time = time();
115
-
116
- $this->add_user_to_group( $u1, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 100 ) ) );
117
- $this->add_user_to_group( $u2, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 200 ) ) );
118
- $this->add_user_to_group( $u3, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 300 ) ) );
119
-
120
- $m1 = new BP_Groups_Member( $u1, $g );
121
- $m1->promote( 'admin' );
122
- $m2 = new BP_Groups_Member( $u2, $g );
123
- $m2->promote( 'mod' );
124
-
125
- $query_members = new BP_Group_Member_Query( array(
126
- 'group_id' => $g,
127
- 'group_role' => array( 'admin' ),
128
- ) );
129
-
130
- $ids = wp_parse_id_list( array_keys( $query_members->results ) );
131
- $this->assertEquals( array( $u1, ), $ids );
132
- }
133
-
134
- public function test_with_group_role_member_mod() {
135
- $g = $this->factory->group->create();
136
- $u1 = $this->create_user();
137
- $u2 = $this->create_user();
138
- $u3 = $this->create_user();
139
- $time = time();
140
-
141
- $this->add_user_to_group( $u1, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 100 ) ) );
142
- $this->add_user_to_group( $u2, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 200 ) ) );
143
- $this->add_user_to_group( $u3, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 300 ) ) );
144
-
145
- $m1 = new BP_Groups_Member( $u1, $g );
146
- $m1->promote( 'admin' );
147
- $m2 = new BP_Groups_Member( $u2, $g );
148
- $m2->promote( 'mod' );
149
-
150
- $query_members = new BP_Group_Member_Query( array(
151
- 'group_id' => $g,
152
- 'group_role' => array( 'member', 'mod' ),
153
- ) );
154
-
155
- $ids = wp_parse_id_list( array_keys( $query_members->results ) );
156
- $this->assertEquals( array( $u2, $u3, ), $ids );
157
- }
158
-
159
- public function test_with_group_role_member_admin() {
160
- $g = $this->factory->group->create();
161
- $u1 = $this->create_user();
162
- $u2 = $this->create_user();
163
- $u3 = $this->create_user();
164
- $time = time();
165
-
166
- $this->add_user_to_group( $u1, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 100 ) ) );
167
- $this->add_user_to_group( $u2, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 200 ) ) );
168
- $this->add_user_to_group( $u3, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 300 ) ) );
169
-
170
- $m1 = new BP_Groups_Member( $u1, $g );
171
- $m1->promote( 'admin' );
172
- $m2 = new BP_Groups_Member( $u2, $g );
173
- $m2->promote( 'mod' );
174
-
175
- $query_members = new BP_Group_Member_Query( array(
176
- 'group_id' => $g,
177
- 'group_role' => array( 'member', 'admin' ),
178
- ) );
179
-
180
- $ids = wp_parse_id_list( array_keys( $query_members->results ) );
181
- $this->assertEquals( array( $u1, $u3, ), $ids );
182
- }
183
-
184
- public function test_with_group_role_mod_admin() {
185
- $g = $this->factory->group->create();
186
- $u1 = $this->create_user();
187
- $u2 = $this->create_user();
188
- $u3 = $this->create_user();
189
- $time = time();
190
-
191
- $this->add_user_to_group( $u1, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 100 ) ) );
192
- $this->add_user_to_group( $u2, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 200 ) ) );
193
- $this->add_user_to_group( $u3, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 300 ) ) );
194
-
195
- $m1 = new BP_Groups_Member( $u1, $g );
196
- $m1->promote( 'admin' );
197
- $m2 = new BP_Groups_Member( $u2, $g );
198
- $m2->promote( 'mod' );
199
-
200
- $query_members = new BP_Group_Member_Query( array(
201
- 'group_id' => $g,
202
- 'group_role' => array( 'mod', 'admin' ),
203
- ) );
204
-
205
- $ids = wp_parse_id_list( array_keys( $query_members->results ) );
206
- $this->assertEquals( array( $u1, $u2, ), $ids );
207
- }
208
-
209
- public function test_with_group_role_member_mod_admin() {
210
- $g = $this->factory->group->create();
211
- $u1 = $this->create_user();
212
- $u2 = $this->create_user();
213
- $u3 = $this->create_user();
214
- $time = time();
215
-
216
- $this->add_user_to_group( $u1, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 100 ) ) );
217
- $this->add_user_to_group( $u2, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 200 ) ) );
218
- $this->add_user_to_group( $u3, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 300 ) ) );
219
-
220
- $m1 = new BP_Groups_Member( $u1, $g );
221
- $m1->promote( 'admin' );
222
- $m2 = new BP_Groups_Member( $u2, $g );
223
- $m2->promote( 'mod' );
224
-
225
- $query_members = new BP_Group_Member_Query( array(
226
- 'group_id' => $g,
227
- 'group_role' => array( 'member', 'mod', 'admin' ),
228
- ) );
229
-
230
- $ids = wp_parse_id_list( array_keys( $query_members->results ) );
231
- $this->assertEquals( array( $u1, $u2, $u3, ), $ids );
232
- }
233
-
234
- public function test_with_group_role_member_mod_admin_banned() {
235
- $g = $this->factory->group->create();
236
- $u1 = $this->create_user();
237
- $u2 = $this->create_user();
238
- $u3 = $this->create_user();
239
- $u4 = $this->create_user();
240
- $time = time();
241
-
242
- $this->add_user_to_group( $u1, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 100 ) ) );
243
- $this->add_user_to_group( $u2, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 200 ) ) );
244
- $this->add_user_to_group( $u3, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 300 ) ) );
245
- $this->add_user_to_group( $u4, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 300 ) ) );
246
-
247
- $m1 = new BP_Groups_Member( $u1, $g );
248
- $m1->promote( 'admin' );
249
- $m2 = new BP_Groups_Member( $u2, $g );
250
- $m2->promote( 'mod' );
251
- $m3 = new BP_Groups_Member( $u3, $g );
252
- $m3->ban();
253
-
254
- $query_members = new BP_Group_Member_Query( array(
255
- 'group_id' => $g,
256
- 'group_role' => array( 'member', 'mod', 'admin', 'banned' ),
257
- ) );
258
-
259
- $ids = wp_parse_id_list( array_keys( $query_members->results ) );
260
- $this->assertEquals( array( $u1, $u2, $u3, $u4, ), $ids );
261
- }
262
-
263
- public function test_with_group_role_banned() {
264
- $g = $this->factory->group->create();
265
- $u1 = $this->create_user();
266
- $u2 = $this->create_user();
267
- $time = time();
268
-
269
- $this->add_user_to_group( $u1, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 100 ) ) );
270
- $this->add_user_to_group( $u2, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 200 ) ) );
271
-
272
- $m1 = new BP_Groups_Member( $u1, $g );
273
- $m1->ban();
274
-
275
- $query_members = new BP_Group_Member_Query( array(
276
- 'group_id' => $g,
277
- 'group_role' => array( 'banned' ),
278
- ) );
279
-
280
- $ids = wp_parse_id_list( array_keys( $query_members->results ) );
281
- $this->assertEquals( array( $u1, ), $ids );
282
- }
283
-
284
- public function test_group_has_no_members() {
285
- $g = $this->factory->group->create();
286
- $u1 = $this->create_user();
287
-
288
- $query_members = new BP_Group_Member_Query( array(
289
- 'group_id' => $g,
290
- 'group_role' => array( 'member', 'mod', 'admin' ),
291
- ) );
292
-
293
- $ids = wp_parse_id_list( array_keys( $query_members->results ) );
294
- $this->assertEquals( array(), $ids );
295
- }
296
-
297
- public function test_group_has_no_members_of_role_mod() {
298
- $g = $this->factory->group->create();
299
- $u1 = $this->create_user();
300
- $time = time();
301
-
302
- $this->add_user_to_group( $u1, $g, array( 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 100 ) ) );
303
-
304
- $query_members = new BP_Group_Member_Query( array(
305
- 'group_id' => $g,
306
- 'group_role' => array( 'mod' ),
307
- ) );
308
-
309
- $ids = wp_parse_id_list( array_keys( $query_members->results ) );
310
- $this->assertEquals( array(), $ids );
311
- }
312
-
313
- public function test_confirmed_members() {
314
- $g = $this->factory->group->create();
315
- $u1 = $this->create_user();
316
- $u2 = $this->create_user();
317
- $time = time();
318
-
319
- $this->add_user_to_group( $u1, $g, array(
320
- 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 100 ),
321
- 'is_confirmed' => 0,
322
- ) );
323
-
324
- $this->add_user_to_group( $u2, $g, array(
325
- 'date_modified' => gmdate( 'Y-m-d H:i:s', $time - 100 ),
326
- 'is_confirmed' => 1,
327
- ) );
328
-
329
- $query_members = new BP_Group_Member_Query( array(
330
- 'group_id' => $g,
331
- ) );
332
-
333
- $ids = wp_parse_id_list( array_keys( $query_members->results ) );
334
- $this->assertEquals( array( $u2 ), $ids );
335
- }
336
-
337
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/groups/class-bp-groups-group.php DELETED
@@ -1,657 +0,0 @@
1
- <?php
2
- /**
3
- * @group groups
4
- * @group BP_Groups_Group
5
- */
6
- class BP_Tests_BP_Groups_Group_TestCases extends BP_UnitTestCase {
7
- public function setUp() {
8
- parent::setUp();
9
- }
10
-
11
- public function tearDown() {
12
- parent::tearDown();
13
- }
14
-
15
- /** __construct() ***************************************************/
16
-
17
- /**
18
- * @group __construct
19
- */
20
- public function test_non_existent_group() {
21
- $group = new BP_Groups_Group( 123456789 );
22
- $this->assertSame( 0, $group->id );
23
- }
24
-
25
- /** get() ************************************************************/
26
-
27
- /**
28
- * @group get
29
- */
30
- public function test_get_with_exclude() {
31
- $g1 = $this->factory->group->create();
32
- $g2 = $this->factory->group->create();
33
- groups_update_groupmeta( $g1, 'foo', 'bar' );
34
-
35
- $groups = BP_Groups_Group::get( array(
36
- 'exclude' => array(
37
- $g1,
38
- 'foobar',
39
- ),
40
- ) );
41
- $ids = wp_list_pluck( $groups['groups'], 'id' );
42
- $this->assertEquals( $ids, array( $g2 ) );
43
- }
44
-
45
- /**
46
- * @group get
47
- */
48
- public function test_get_with_include() {
49
- $g1 = $this->factory->group->create();
50
- $g2 = $this->factory->group->create();
51
- groups_update_groupmeta( $g1, 'foo', 'bar' );
52
-
53
- $groups = BP_Groups_Group::get( array(
54
- 'include' => array(
55
- $g1,
56
- 'foobar',
57
- ),
58
- ) );
59
- $ids = wp_list_pluck( $groups['groups'], 'id' );
60
- $this->assertEquals( $ids, array( $g1 ) );
61
- }
62
-
63
- /**
64
- * @group get
65
- * @group group_meta_query
66
- */
67
- public function test_get_with_meta_query() {
68
- $g1 = $this->factory->group->create();
69
- $g2 = $this->factory->group->create();
70
- groups_update_groupmeta( $g1, 'foo', 'bar' );
71
-
72
- $groups = BP_Groups_Group::get( array(
73
- 'meta_query' => array(
74
- array(
75
- 'key' => 'foo',
76
- 'value' => 'bar',
77
- ),
78
- ),
79
- ) );
80
- $ids = wp_list_pluck( $groups['groups'], 'id' );
81
- $this->assertEquals( $ids, array( $g1 ) );
82
- }
83
-
84
- /**
85
- * @group get
86
- * @group group_meta_query
87
- */
88
- public function test_get_empty_meta_query() {
89
- $g1 = $this->factory->group->create();
90
- $g2 = $this->factory->group->create();
91
- groups_update_groupmeta( $g1, 'foo', 'bar' );
92
-
93
- $groups = BP_Groups_Group::get( array(
94
- 'meta_query' => array(),
95
- ) );
96
- $ids = wp_list_pluck( $groups['groups'], 'id' );
97
- $this->assertEquals( $ids, array( $g1, $g2, ) );
98
- }
99
-
100
- /**
101
- * @group get
102
- * @group group_meta_query
103
- */
104
- public function test_get_with_meta_query_multiple_clauses() {
105
- $now = time();
106
- $g1 = $this->factory->group->create( array(
107
- 'last_activity' => date( 'Y-m-d H:i:s', $now - 60*60 ),
108
- ) );
109
- $g2 = $this->factory->group->create( array(
110
- 'last_activity' => date( 'Y-m-d H:i:s', $now - 60*60*2 ),
111
- ) );
112
- $g3 = $this->factory->group->create( array(
113
- 'last_activity' => date( 'Y-m-d H:i:s', $now - 60*60*3 ),
114
- ) );
115
- groups_update_groupmeta( $g1, 'foo', 'bar' );
116
- groups_update_groupmeta( $g2, 'foo', 'bar' );
117
- groups_update_groupmeta( $g1, 'bar', 'barry' );
118
-
119
- $groups = BP_Groups_Group::get( array(
120
- 'meta_query' => array(
121
- 'relation' => 'AND',
122
- array(
123
- 'key' => 'foo',
124
- 'value' => 'bar',
125
- ),
126
- array(
127
- 'key' => 'bar',
128
- 'value' => 'barry',
129
- ),
130
- ),
131
- ) );
132
- $ids = wp_list_pluck( $groups['groups'], 'id' );
133
- $this->assertEquals( $ids, array( $g1 ) );
134
- $this->assertEquals( 1, $groups['total'] );
135
- }
136
-
137
- /**
138
- * @group get
139
- */
140
- public function test_get_normal_search() {
141
- $g1 = $this->factory->group->create( array(
142
- 'name' => 'Cool Group',
143
- 'description' => 'This is one cool group',
144
- ) );
145
- $g2 = $this->factory->group->create();
146
-
147
- $groups = BP_Groups_Group::get( array(
148
- 'search_terms' => 'Cool',
149
- ) );
150
-
151
- $found = wp_list_pluck( $groups['groups'], 'id' );
152
- $this->assertEquals( array( $g1 ), $found );
153
- }
154
-
155
- /**
156
- * @group get
157
- */
158
- public function test_get_search_with_underscores() {
159
- $g1 = $this->factory->group->create( array(
160
- 'name' => 'Cool Group',
161
- 'description' => '_cool_ dude',
162
- ) );
163
- $g2 = $this->factory->group->create();
164
-
165
- $groups = BP_Groups_Group::get( array(
166
- 'search_terms' => '_cool_',
167
- ) );
168
-
169
- $found = wp_list_pluck( $groups['groups'], 'id' );
170
- $this->assertEquals( array( $g1 ), $found );
171
- }
172
-
173
- /**
174
- * @group get
175
- */
176
- public function test_get_search_with_percent_sign() {
177
- $g1 = $this->factory->group->create( array(
178
- 'name' => 'Cool Group',
179
- 'description' => '100% awesome',
180
- ) );
181
- $g2 = $this->factory->group->create();
182
-
183
- $groups = BP_Groups_Group::get( array(
184
- 'search_terms' => '100%',
185
- ) );
186
-
187
- $found = wp_list_pluck( $groups['groups'], 'id' );
188
- $this->assertEquals( array( $g1 ), $found );
189
- }
190
-
191
- /**
192
- * @group get
193
- */
194
- public function test_get_search_with_quotes() {
195
- $g1 = $this->factory->group->create( array(
196
- 'name' => 'Cool Group',
197
- 'description' => "'tis sweet",
198
- ) );
199
- $g2 = $this->factory->group->create();
200
-
201
- $groups = BP_Groups_Group::get( array(
202
- 'search_terms' => "'tis ",
203
- ) );
204
-
205
- $found = wp_list_pluck( $groups['groups'], 'id' );
206
-
207
- $this->assertEquals( array( $g1 ), $found );
208
- }
209
-
210
- /**
211
- * BP 1.8 will change the default 'type' param in favor of default
212
- * 'order' and 'orderby'. This is to make sure that existing plugins
213
- * will work appropriately
214
- *
215
- * @group get
216
- */
217
- public function test_get_with_default_type_value_should_be_newest() {
218
- $g1 = $this->factory->group->create( array(
219
- 'name' => 'A Group',
220
- 'date_created' => bp_core_current_time(),
221
- ) );
222
- $g2 = $this->factory->group->create( array(
223
- 'name' => 'D Group',
224
- 'date_created' => gmdate( 'Y-m-d H:i:s', time() - 100 ),
225
- ) );
226
- $g3 = $this->factory->group->create( array(
227
- 'name' => 'B Group',
228
- 'date_created' => gmdate( 'Y-m-d H:i:s', time() - 100000 ),
229
- ) );
230
- $g4 = $this->factory->group->create( array(
231
- 'name' => 'C Group',
232
- 'date_created' => gmdate( 'Y-m-d H:i:s', time() - 1000 ),
233
- ) );
234
-
235
- $found = BP_Groups_Group::get();
236
-
237
- $this->assertEquals( BP_Groups_Group::get( array( 'type' => 'newest' ) ), $found );
238
- }
239
-
240
- /**
241
- * @group get
242
- */
243
- public function test_get_with_type_newest() {
244
- $time = time();
245
- $g1 = $this->factory->group->create( array(
246
- 'name' => 'A Group',
247
- 'date_created' => bp_core_current_time(),
248
- ) );
249
- $g2 = $this->factory->group->create( array(
250
- 'name' => 'D Group',
251
- 'date_created' => gmdate( 'Y-m-d H:i:s', $time - 100 ),
252
- ) );
253
- $g3 = $this->factory->group->create( array(
254
- 'name' => 'B Group',
255
- 'date_created' => gmdate( 'Y-m-d H:i:s', $time - 100000 ),
256
- ) );
257
- $g4 = $this->factory->group->create( array(
258
- 'name' => 'C Group',
259
- 'date_created' => gmdate( 'Y-m-d H:i:s', $time - 1000 ),
260
- ) );
261
-
262
- $groups = BP_Groups_Group::get( array( 'type' => 'newest' ) );
263
- $found = wp_parse_id_list( wp_list_pluck( $groups['groups'], 'id' ) );
264
- $this->assertEquals( array( $g1, $g2, $g4, $g3 ), $found );
265
- }
266
-
267
- /**
268
- * @group get
269
- */
270
- public function test_get_with_type_popular() {
271
- $time = time();
272
- $g1 = $this->factory->group->create( array(
273
- 'name' => 'A Group',
274
- 'date_created' => bp_core_current_time(),
275
- ) );
276
- $g2 = $this->factory->group->create( array(
277
- 'name' => 'D Group',
278
- 'date_created' => gmdate( 'Y-m-d H:i:s', $time - 100 ),
279
- ) );
280
- $g3 = $this->factory->group->create( array(
281
- 'name' => 'B Group',
282
- 'date_created' => gmdate( 'Y-m-d H:i:s', $time - 100000 ),
283
- ) );
284
- $g4 = $this->factory->group->create( array(
285
- 'name' => 'C Group',
286
- 'date_created' => gmdate( 'Y-m-d H:i:s', $time - 1000 ),
287
- ) );
288
-
289
- groups_update_groupmeta( $g1, 'total_member_count', 1 );
290
- groups_update_groupmeta( $g2, 'total_member_count', 4 );
291
- groups_update_groupmeta( $g3, 'total_member_count', 2 );
292
- groups_update_groupmeta( $g4, 'total_member_count', 3 );
293
-
294
- $groups = BP_Groups_Group::get( array( 'type' => 'popular' ) );
295
- $found = wp_parse_id_list( wp_list_pluck( $groups['groups'], 'id' ) );
296
- $this->assertEquals( array( $g2, $g4, $g3, $g1 ), $found );
297
- }
298
-
299
- /**
300
- * @group get
301
- * @group group_meta_query
302
- * @ticket BP5099
303
- */
304
- public function test_meta_query_and_total_groups() {
305
- $time = time();
306
-
307
- $g1 = $this->factory->group->create( array(
308
- 'name' => 'A Group',
309
- 'date_created' => bp_core_current_time(),
310
- ) );
311
- $g2 = $this->factory->group->create( array(
312
- 'name' => 'D Group',
313
- 'date_created' => gmdate( 'Y-m-d H:i:s', $time - 100 ),
314
- ) );
315
- $g3 = $this->factory->group->create( array(
316
- 'name' => 'B Group',
317
- 'date_created' => gmdate( 'Y-m-d H:i:s', $time - 100000 ),
318
- ) );
319
- $g4 = $this->factory->group->create( array(
320
- 'name' => 'C Group',
321
- 'date_created' => gmdate( 'Y-m-d H:i:s', $time - 1000 ),
322
- ) );
323
-
324
- // mark one group with the metakey 'supergroup'
325
- groups_update_groupmeta( $g1, 'supergroup', 1 );
326
-
327
- // fetch groups with our 'supergroup' metakey
328
- $groups = BP_Groups_Group::get( array(
329
- 'meta_query' => array(
330
- array(
331
- 'key' => 'supergroup',
332
- 'compare' => 'EXISTS',
333
- )
334
- )
335
- ) );
336
-
337
- // group total should match 1
338
- $this->assertEquals( '1', $groups['total'] );
339
- }
340
-
341
- /** convert_type_to_order_orderby() **********************************/
342
-
343
- /**
344
- * @group convert_type_to_order_orderby
345
- */
346
- public function test_convert_type_to_order_orderby_newest() {
347
- $expected = array(
348
- 'order' => 'DESC',
349
- 'orderby' => 'date_created',
350
- );
351
- $this->assertEquals( $expected, _BP_Groups_Group::_convert_type_to_order_orderby( 'newest' ) );
352
- }
353
-
354
- /**
355
- * @group convert_type_to_order_orderby
356
- */
357
- public function test_convert_type_to_order_orderby_active() {
358
- $expected = array(
359
- 'order' => 'DESC',
360
- 'orderby' => 'last_activity',
361
- );
362
- $this->assertEquals( $expected, _BP_Groups_Group::_convert_type_to_order_orderby( 'active' ) );
363
- }
364
-
365
- /**
366
- * @group convert_type_to_order_orderby
367
- */
368
- public function test_convert_type_to_order_orderby_popular() {
369
- $expected = array(
370
- 'order' => 'DESC',
371
- 'orderby' => 'total_member_count',
372
- );
373
- $this->assertEquals( $expected, _BP_Groups_Group::_convert_type_to_order_orderby( 'popular' ) );
374
- }
375
-
376
- /**
377
- * @group convert_type_to_order_orderby
378
- */
379
- public function test_convert_type_to_order_orderby_alphabetical() {
380
- $expected = array(
381
- 'order' => 'ASC',
382
- 'orderby' => 'name',
383
- );
384
- $this->assertEquals( $expected, _BP_Groups_Group::_convert_type_to_order_orderby( 'alphabetical' ) );
385
- }
386
-
387
- /**
388
- * @group convert_type_to_order_orderby
389
- */
390
- public function test_convert_type_to_order_orderby_random() {
391
- $expected = array(
392
- // order gets thrown out
393
- 'order' => '',
394
- 'orderby' => 'random',
395
- );
396
- $this->assertEquals( $expected, _BP_Groups_Group::_convert_type_to_order_orderby( 'random' ) );
397
- }
398
-
399
- /**
400
- * @group convert_type_to_order_orderby
401
- */
402
- public function test_convert_type_to_order_orderby_invalid() {
403
- $expected = array(
404
- 'order' => '',
405
- 'orderby' => '',
406
- );
407
- $this->assertEquals( $expected, _BP_Groups_Group::_convert_type_to_order_orderby( 'foooooooooooooooobar' ) );
408
- }
409
-
410
- /** convert_orderby_to_order_by_term() **********************************/
411
-
412
- /**
413
- * @group convert_orderby_to_order_by_term
414
- */
415
- public function test_convert_orderby_to_order_by_term_date_created() {
416
- $this->assertEquals( 'g.date_created', _BP_Groups_Group::_convert_orderby_to_order_by_term( 'date_created' ) );
417
- }
418
-
419
- /**
420
- * @group convert_orderby_to_order_by_term
421
- */
422
- public function test_convert_orderby_to_order_by_term_last_activity() {
423
- $c = new _BP_Groups_Group();
424
- $this->assertEquals( 'last_activity', _BP_Groups_Group::_convert_orderby_to_order_by_term( 'last_activity' ) );
425
- }
426
-
427
- /**
428
- * @group convert_orderby_to_order_by_term
429
- */
430
- public function test_convert_orderby_to_order_by_term_total_member_count() {
431
- $c = new _BP_Groups_Group();
432
- $this->assertEquals( 'CONVERT(gm1.meta_value, SIGNED)', _BP_Groups_Group::_convert_orderby_to_order_by_term( 'total_member_count' ) );
433
- }
434
-
435
- /**
436
- * @group convert_orderby_to_order_by_term
437
- */
438
- public function test_convert_orderby_to_order_by_term_name() {
439
- $c = new _BP_Groups_Group();
440
- $this->assertEquals( 'g.name', _BP_Groups_Group::_convert_orderby_to_order_by_term( 'name' ) );
441
- }
442
-
443
- /**
444
- * @group convert_orderby_to_order_by_term
445
- */
446
- public function test_convert_orderby_to_order_by_term_random() {
447
- $c = new _BP_Groups_Group();
448
- $this->assertEquals( 'rand()', _BP_Groups_Group::_convert_orderby_to_order_by_term( 'random' ) );
449
- }
450
-
451
- /**
452
- * @group convert_orderby_to_order_by_term
453
- */
454
- public function test_convert_orderby_to_order_by_term_invalid_fallback_to_date_created() {
455
- $c = new _BP_Groups_Group();
456
- $this->assertEquals( _BP_Groups_Group::_convert_orderby_to_order_by_term( 'date_created' ), _BP_Groups_Group::_convert_orderby_to_order_by_term( 'I am a bad boy' ) );
457
- }
458
-
459
- public function test_filter_user_groups_normal_search() {
460
- $g1 = $this->factory->group->create( array(
461
- 'name' => 'Cool Group',
462
- 'description' => 'This is one cool group',
463
- ) );
464
- $g2 = $this->factory->group->create();
465
- $u = $this->factory->user->create();
466
- self::add_user_to_group( $u, $g1 );
467
-
468
- $groups = BP_Groups_Group::filter_user_groups( 'Cool', $u );
469
-
470
- $found = wp_list_pluck( $groups['groups'], 'group_id' );
471
- $this->assertEquals( array( $g1 ), $found );
472
- }
473
-
474
- public function test_filter_user_groups_search_with_underscores() {
475
- $g1 = $this->factory->group->create( array(
476
- 'name' => 'Cool Group',
477
- 'description' => '_cool_ dude',
478
- ) );
479
- $g2 = $this->factory->group->create();
480
-
481
- $u = $this->factory->user->create();
482
- self::add_user_to_group( $u, $g1 );
483
- self::add_user_to_group( $u, $g2 );
484
-
485
- $groups = BP_Groups_Group::filter_user_groups( '_cool_', $u );
486
-
487
- $found = wp_list_pluck( $groups['groups'], 'group_id' );
488
- $this->assertEquals( array( $g1 ), $found );
489
- }
490
-
491
- public function test_filter_user_groups_search_with_percent_sign() {
492
- $g1 = $this->factory->group->create( array(
493
- 'name' => 'Cool Group',
494
- 'description' => '100% awesome',
495
- ) );
496
- $g2 = $this->factory->group->create();
497
-
498
- $u = $this->factory->user->create();
499
- self::add_user_to_group( $u, $g1 );
500
- self::add_user_to_group( $u, $g2 );
501
-
502
- $groups = BP_Groups_Group::filter_user_groups( '100%', $u );
503
-
504
- $found = wp_list_pluck( $groups['groups'], 'group_id' );
505
- $this->assertEquals( array( $g1 ), $found );
506
- }
507
-
508
- public function test_filter_user_groups_search_with_quotes() {
509
- $g1 = $this->factory->group->create( array(
510
- 'name' => 'Cool Group',
511
- 'description' => "'tis sweet",
512
- ) );
513
- $g2 = $this->factory->group->create();
514
-
515
- $u = $this->factory->user->create();
516
- self::add_user_to_group( $u, $g1 );
517
- self::add_user_to_group( $u, $g2 );
518
-
519
- $groups = BP_Groups_Group::filter_user_groups( "'tis ", $u );
520
-
521
- $found = wp_list_pluck( $groups['groups'], 'group_id' );
522
-
523
- // @todo
524
- //$this->assertEquals( array( $g1->id ), $found );
525
- }
526
-
527
- public function test_search_groups_normal_search() {
528
- $g1 = $this->factory->group->create( array(
529
- 'name' => 'Cool Group',
530
- 'description' => 'This is one cool group',
531
- ) );
532
- $g2 = $this->factory->group->create();
533
-
534
- $groups = BP_Groups_Group::search_groups( 'Cool' );
535
-
536
- $found = wp_list_pluck( $groups['groups'], 'group_id' );
537
- $this->assertEquals( array( $g1 ), $found );
538
- }
539
-
540
- public function test_search_groups_search_with_underscores() {
541
- $g1 = $this->factory->group->create( array(
542
- 'name' => 'Cool Group',
543
- 'description' => '_cool_ dude',
544
- ) );
545
- $g2 = $this->factory->group->create();
546
-
547
- $groups = BP_Groups_Group::search_groups( '_cool_' );
548
-
549
- $found = wp_list_pluck( $groups['groups'], 'group_id' );
550
- $this->assertEquals( array( $g1 ), $found );
551
- }
552
-
553
- public function test_search_groups_search_with_percent_sign() {
554
- $g1 = $this->factory->group->create( array(
555
- 'name' => 'Cool Group',
556
- 'description' => '100% awesome',
557
- ) );
558
- $g2 = $this->factory->group->create();
559
-
560
- $groups = BP_Groups_Group::search_groups( '100%' );
561
-
562
- $found = wp_list_pluck( $groups['groups'], 'group_id' );
563
- $this->assertEquals( array( $g1 ), $found );
564
- }
565
-
566
- public function test_search_groups_search_with_quotes() {
567
- $g1 = $this->factory->group->create( array(
568
- 'name' => 'Cool Group',
569
- 'description' => "'tis sweet",
570
- ) );
571
- $g2 = $this->factory->group->create();
572
-
573
- $groups = BP_Groups_Group::search_groups( "'tis " );
574
-
575
- $found = wp_list_pluck( $groups['groups'], 'group_id' );
576
-
577
- $this->assertEquals( array( $g1 ), $found );
578
- }
579
-
580
- public function test_get_by_letter_with_exclude() {
581
- $g1 = $this->factory->group->create( array(
582
- 'name' => 'Awesome Cool Group',
583
- 'description' => 'Neat',
584
- ) );
585
- $g2 = $this->factory->group->create( array(
586
- 'name' => 'Another Cool Group',
587
- 'description' => 'Awesome',
588
- ) );
589
-
590
- $groups = BP_Groups_Group::get_by_letter( 'A', null, null, true, array( $g1, 'stringthatshouldberemoved' ) );
591
-
592
- $found = wp_list_pluck( $groups['groups'], 'id' );
593
-
594
- $this->assertEquals( array( $g2 ), $found );
595
-
596
- }
597
-
598
- public function test_get_by_letter_starts_with_apostrophe() {
599
- $g1 = $this->factory->group->create( array(
600
- 'name' => "'Tis Sweet",
601
- 'description' => 'Neat',
602
- ) );
603
- $g2 = $this->factory->group->create( array(
604
- 'name' => 'Another Cool Group',
605
- 'description' => 'Awesome',
606
- ) );
607
-
608
- $groups = BP_Groups_Group::get_by_letter( "'" );
609
-
610
- $found = wp_list_pluck( $groups['groups'], 'id' );
611
-
612
- // @todo
613
- // The test fails but at least it's sanitized
614
- //$this->assertEquals( array( $g1->id ), $found );
615
- }
616
-
617
- public function test_get_random_with_exclude() {
618
- $g1 = $this->factory->group->create();
619
- $g2 = $this->factory->group->create();
620
-
621
- // There are only two groups, so excluding one should give us the other
622
- $groups = BP_Groups_Group::get_random( null, null, 0, false, true, array( $g1, 'ignore this' ) );
623
-
624
- $found = wp_list_pluck( $groups['groups'], 'id' );
625
-
626
- $this->assertEquals( array( $g2 ), $found );
627
- }
628
-
629
- public function test_get_random_with_search_terms() {
630
- $g1 = $this->factory->group->create( array(
631
- 'name' => 'Bodacious',
632
- ) );
633
- $g2 = $this->factory->group->create( array(
634
- 'name' => 'Crummy group',
635
- ) );
636
-
637
- // Only one group will match, so the random part doesn't matter
638
- $groups = BP_Groups_Group::get_random( null, null, 0, 'daci' );
639
-
640
- $found = wp_list_pluck( $groups['groups'], 'id' );
641
-
642
- $this->assertEquals( array( $g1 ), $found );
643
- }
644
- }
645
-
646
- /**
647
- * Stub class for accessing protected methods
648
- */
649
- class _BP_Groups_Group extends BP_Groups_Group {
650
- static public function _convert_type_to_order_orderby( $type ) {
651
- return self::convert_type_to_order_orderby( $type );
652
- }
653
-
654
- static public function _convert_orderby_to_order_by_term( $term ) {
655
- return self::convert_orderby_to_order_by_term( $term );
656
- }
657
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/groups/class-bp-groups-member.php DELETED
@@ -1,131 +0,0 @@
1
- <?php
2
- /**
3
- * @group groups
4
- * @group BP_Groups_Member
5
- */
6
- class BP_Tests_BP_Groups_Member_TestCases extends BP_UnitTestCase {
7
- public function setUp() {
8
- parent::setUp();
9
- }
10
-
11
- public function tearDown() {
12
- parent::tearDown();
13
- }
14
-
15
- public static function invite_user_to_group( $user_id, $group_id, $inviter_id ) {
16
- $invite = new BP_Groups_Member;
17
- $invite->group_id = $group_id;
18
- $invite->user_id = $user_id;
19
- $invite->date_modified = bp_core_current_time();
20
- $invite->inviter_id = $inviter_id;
21
- $invite->is_confirmed = 0;
22
- $invite->invite_sent = 1;
23
-
24
- $invite->save();
25
- return $invite->id;
26
- }
27
-
28
- public function test_get_recently_joined_with_filter() {
29
- $g1 = $this->factory->group->create( array(
30
- 'name' => 'Tab',
31
- ) );
32
- $g2 = $this->factory->group->create( array(
33
- 'name' => 'Diet Rite',
34
- ) );
35
-
36
- $u = $this->factory->user->create();
37
- self::add_user_to_group( $u, $g1 );
38
- self::add_user_to_group( $u, $g2 );
39
-
40
- $groups = BP_Groups_Member::get_recently_joined( $u, false, false, 'Rite' );
41
-
42
- $ids = wp_list_pluck( $groups['groups'], 'id' );
43
- $this->assertEquals( $ids, array( $g2 ) );
44
- }
45
-
46
- public function test_get_is_admin_of_with_filter() {
47
- $g1 = $this->factory->group->create( array(
48
- 'name' => 'RC Cola',
49
- ) );
50
- $g2 = $this->factory->group->create( array(
51
- 'name' => 'Pepsi',
52
- ) );
53
-
54
- $u = $this->factory->user->create();
55
- self::add_user_to_group( $u, $g1 );
56
- self::add_user_to_group( $u, $g2 );
57
-
58
- $m1 = new BP_Groups_Member( $u, $g1 );
59
- $m1->promote( 'admin' );
60
- $m2 = new BP_Groups_Member( $u, $g2 );
61
- $m2->promote( 'admin' );
62
-
63
- $groups = BP_Groups_Member::get_is_admin_of( $u, false, false, 'eps' );
64
-
65
- $ids = wp_list_pluck( $groups['groups'], 'id' );
66
- $this->assertEquals( $ids, array( $g2 ) );
67
- }
68
-
69
- public function test_get_is_mod_of_with_filter() {
70
- $g1 = $this->factory->group->create( array(
71
- 'name' => 'RC Cola',
72
- ) );
73
- $g2 = $this->factory->group->create( array(
74
- 'name' => 'Pepsi',
75
- ) );
76
-
77
- $u = $this->factory->user->create();
78
- self::add_user_to_group( $u, $g1 );
79
- self::add_user_to_group( $u, $g2 );
80
-
81
- $m1 = new BP_Groups_Member( $u, $g1 );
82
- $m1->promote( 'mod' );
83
- $m2 = new BP_Groups_Member( $u, $g2 );
84
- $m2->promote( 'mod' );
85
-
86
- $groups = BP_Groups_Member::get_is_mod_of( $u, false, false, 'eps' );
87
-
88
- $ids = wp_list_pluck( $groups['groups'], 'id' );
89
- $this->assertEquals( $ids, array( $g2 ) );
90
- }
91
-
92
- public function test_get_invites_with_exclude() {
93
- $g1 = $this->factory->group->create( array(
94
- 'name' => 'RC Cola',
95
- ) );
96
- $g2 = $this->factory->group->create( array(
97
- 'name' => 'Pepsi',
98
- ) );
99
-
100
- $u1 = $this->factory->user->create();
101
- $u2 = $this->factory->user->create();
102
- self::add_user_to_group( $u1, $g1 );
103
- self::add_user_to_group( $u1, $g2 );
104
- self::invite_user_to_group( $u2, $g1, $u1 );
105
- self::invite_user_to_group( $u2, $g2, $u1 );
106
-
107
- $groups = BP_Groups_Member::get_invites( $u2, false, false, array( 'awesome', $g1 ) );
108
-
109
- $ids = wp_list_pluck( $groups['groups'], 'id' );
110
- $this->assertEquals( $ids, array( $g2 ) );
111
- }
112
-
113
- /**
114
- * @expectedDeprecated BP_Groups_Member::get_all_for_group
115
- */
116
- public function test_get_all_for_group_with_exclude() {
117
- $g1 = $this->factory->group->create();
118
-
119
- $u1 = $this->create_user();
120
- $u2 = $this->create_user();
121
- self::add_user_to_group( $u1, $g1 );
122
- self::add_user_to_group( $u2, $g1 );
123
-
124
- $members = BP_Groups_Member::get_all_for_group( $g1, false, false, true, true, array( $u1 ) );
125
-
126
- $mm = (array) $members['members'];
127
- $ids = wp_list_pluck( $mm, 'user_id' );
128
- $this->assertEquals( array( $u2 ), $ids );
129
- }
130
- }
131
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/groups/functions.php DELETED
@@ -1,288 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * @group groups
5
- * @group functions
6
- */
7
- class BP_Tests_Groups_Functions extends BP_UnitTestCase {
8
- /**
9
- * @group total_group_count
10
- * @group groups_join_group
11
- */
12
- public function test_total_group_count_groups_join_group() {
13
- $u1 = $this->create_user();
14
- $u2 = $this->create_user();
15
- $g = $this->factory->group->create( array( 'creator_id' => $u1 ) );
16
-
17
- groups_join_group( $g, $u2 );
18
- $this->assertEquals( 1, bp_get_user_meta( $u2, 'total_group_count', true ) );
19
- }
20
-
21
- /**
22
- * @group total_group_count
23
- * @group groups_leave_group
24
- */
25
- public function test_total_group_count_groups_leave_group() {
26
- $u1 = $this->create_user();
27
- $u2 = $this->create_user();
28
- $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
29
- $g2 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
30
- groups_join_group( $g1, $u2 );
31
- groups_join_group( $g2, $u2 );
32
-
33
- groups_leave_group( $g1, $u2 );
34
- $this->assertEquals( 1, bp_get_user_meta( $u2, 'total_group_count', true ) );
35
- }
36
-
37
- /**
38
- * @group total_group_count
39
- * @group groups_ban_member
40
- */
41
- public function test_total_group_count_groups_ban_member() {
42
- $u1 = $this->create_user();
43
- $u2 = $this->create_user();
44
- $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
45
- $g2 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
46
- groups_join_group( $g1, $u2 );
47
- groups_join_group( $g2, $u2 );
48
-
49
- // Fool the admin check
50
- $this->set_current_user( $u1 );
51
- buddypress()->is_item_admin = true;
52
-
53
- groups_ban_member( $u2, $g1 );
54
-
55
- $this->assertEquals( 1, bp_get_user_meta( $u2, 'total_group_count', true ) );
56
- }
57
-
58
- /**
59
- * @group total_group_count
60
- * @group groups_unban_member
61
- */
62
- public function test_total_group_count_groups_unban_member() {
63
- $u1 = $this->create_user();
64
- $u2 = $this->create_user();
65
- $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
66
- $g2 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
67
- groups_join_group( $g1, $u2 );
68
- groups_join_group( $g2, $u2 );
69
-
70
- // Fool the admin check
71
- $this->set_current_user( $u1 );
72
- buddypress()->is_item_admin = true;
73
-
74
- groups_ban_member( $u2, $g1 );
75
-
76
- groups_unban_member( $u2, $g1 );
77
-
78
- $this->assertEquals( 2, bp_get_user_meta( $u2, 'total_group_count', true ) );
79
- }
80
-
81
- /**
82
- * @group total_group_count
83
- * @group groups_accept_invite
84
- */
85
- public function test_total_group_count_groups_accept_invite() {
86
- $u1 = $this->create_user();
87
- $u2 = $this->create_user();
88
- $g = $this->factory->group->create();
89
- groups_invite_user( array(
90
- 'user_id' => $u1,
91
- 'group_id' => $g,
92
- 'inviter_id' => $u2,
93
- ) );
94
-
95
- groups_accept_invite( $u2, $g );
96
-
97
- $this->assertEquals( 1, bp_get_user_meta( $u2, 'total_group_count', true ) );
98
- }
99
-
100
- /**
101
- * @group total_group_count
102
- * @group groups_accept_membership_request
103
- */
104
- public function test_total_group_count_groups_accept_membership_request() {
105
- $u = $this->create_user();
106
- $g = $this->factory->group->create();
107
- groups_send_membership_request( $u, $g );
108
-
109
- groups_accept_membership_request( 0, $u, $g );
110
-
111
- $this->assertEquals( 1, bp_get_user_meta( $u, 'total_group_count', true ) );
112
- }
113
-
114
- /**
115
- * @group total_group_count
116
- * @group groups_remove_member
117
- */
118
- public function test_total_group_count_groups_remove_member() {
119
- $u1 = $this->create_user();
120
- $u2 = $this->create_user();
121
- $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
122
- $g2 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
123
- groups_join_group( $g1, $u2 );
124
- groups_join_group( $g2, $u2 );
125
-
126
- // Fool the admin check
127
- $this->set_current_user( $u1 );
128
- buddypress()->is_item_admin = true;
129
-
130
- groups_remove_member( $u2, $g1 );
131
-
132
- $this->assertEquals( 1, bp_get_user_meta( $u2, 'total_group_count', true ) );
133
- }
134
-
135
- /**
136
- * @group total_member_count
137
- * @group groups_join_group
138
- */
139
- public function test_total_member_count_groups_join_group() {
140
- $u1 = $this->create_user();
141
- $u2 = $this->create_user();
142
- $g = $this->factory->group->create( array( 'creator_id' => $u1 ) );
143
-
144
- groups_join_group( $g, $u2 );
145
- $this->assertEquals( 2, groups_get_groupmeta( $g, 'total_member_count' ) );
146
- }
147
-
148
- /**
149
- * @group total_member_count
150
- * @group groups_leave_group
151
- */
152
- public function test_total_member_count_groups_leave_group() {
153
- $u1 = $this->create_user();
154
- $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
155
- groups_join_group( $g1, $u1 );
156
-
157
- groups_leave_group( $g1, $u1 );
158
- $this->assertEquals( 1, groups_get_groupmeta( $g1, 'total_member_count' ) );
159
- }
160
-
161
- /**
162
- * @group total_member_count
163
- * @group groups_ban_member
164
- */
165
- public function test_total_member_count_groups_ban_member() {
166
- $u1 = $this->create_user();
167
- $u2 = $this->create_user();
168
- $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
169
- groups_join_group( $g1, $u2 );
170
-
171
- // Fool the admin check
172
- $this->set_current_user( $u1 );
173
- buddypress()->is_item_admin = true;
174
-
175
- groups_ban_member( $u2, $g1 );
176
-
177
- $this->assertEquals( 1, groups_get_groupmeta( $g1, 'total_member_count' ) );
178
- }
179
-
180
- /**
181
- * @group total_member_count
182
- * @group groups_unban_member
183
- */
184
- public function test_total_member_count_groups_unban_member() {
185
- $u1 = $this->create_user();
186
- $u2 = $this->create_user();
187
- $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
188
- groups_join_group( $g1, $u2 );
189
-
190
- // Fool the admin check
191
- $this->set_current_user( $u1 );
192
- buddypress()->is_item_admin = true;
193
-
194
- groups_ban_member( $u2, $g1 );
195
-
196
- groups_unban_member( $u2, $g1 );
197
-
198
- $this->assertEquals( 2, groups_get_groupmeta( $g1, 'total_member_count' ) );
199
- }
200
-
201
- /**
202
- * @group total_member_count
203
- * @group groups_accept_invite
204
- */
205
- public function test_total_member_count_groups_accept_invite() {
206
- $u1 = $this->create_user();
207
- $u2 = $this->create_user();
208
- $g = $this->factory->group->create( array( 'creator_id' => $u1 ) );
209
- groups_invite_user( array(
210
- 'user_id' => $u1,
211
- 'group_id' => $g,
212
- 'inviter_id' => $u2,
213
- ) );
214
-
215
- groups_accept_invite( $u2, $g );
216
-
217
- $this->assertEquals( 2, groups_get_groupmeta( $g, 'total_member_count' ) );
218
- }
219
-
220
- /**
221
- * @group total_member_count
222
- * @group groups_accept_membership_request
223
- */
224
- public function test_total_member_count_groups_accept_membership_request() {
225
- $u1 = $this->create_user();
226
- $u2 = $this->create_user();
227
- $g = $this->factory->group->create( array( 'creator_id' => $u1 ) );
228
-
229
- $this->setUp_wp_mail();
230
- groups_send_membership_request( $u2, $g );
231
- groups_accept_membership_request( 0, $u2, $g );
232
- $this->tearDown_wp_mail();
233
-
234
- $this->assertEquals( 2, groups_get_groupmeta( $g, 'total_member_count' ) );
235
- }
236
-
237
- /**
238
- * @group total_member_count
239
- * @group groups_remove_member
240
- */
241
- public function test_total_member_count_groups_remove_member() {
242
- $u1 = $this->create_user();
243
- $u2 = $this->create_user();
244
- $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
245
- groups_join_group( $g1, $u2 );
246
-
247
- // Fool the admin check
248
- $this->set_current_user( $u1 );
249
- buddypress()->is_item_admin = true;
250
-
251
- groups_remove_member( $u2, $g1 );
252
-
253
- $this->assertEquals( 1, groups_get_groupmeta( $g1, 'total_member_count' ) );
254
- }
255
-
256
- /**
257
- * @group total_member_count
258
- * @group groups_create_group
259
- */
260
- public function test_total_member_count_groups_create_group() {
261
- $u1 = $this->create_user();
262
- $g = groups_create_group( array(
263
- 'creator_id' => $u1,
264
- 'name' => 'Boone Is Handsome',
265
- 'description' => 'Yes',
266
- 'slug' => 'boone-is-handsome',
267
- 'status' => 'public',
268
- 'enable_forum' => 0,
269
- 'date_created' => bp_core_current_time(),
270
- ) );
271
-
272
- $this->assertEquals( 1, groups_get_groupmeta( $g, 'total_member_count' ) );
273
- }
274
-
275
- /**
276
- * @group groupmeta
277
- * @ticket BP5180
278
- */
279
- public function test_groups_update_groupmeta_with_line_breaks() {
280
- $g = $this->factory->group->create();
281
- $meta_value = 'Foo!
282
-
283
- Bar!';
284
- groups_update_groupmeta( $g, 'linebreak_test', $meta_value );
285
-
286
- $this->assertEquals( $meta_value, groups_get_groupmeta( $g, 'linebreak_test' ) );
287
- }
288
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/groups/template.php DELETED
@@ -1,410 +0,0 @@
1
- <?php
2
- /**
3
- * @group groups
4
- * @group template
5
- */
6
- class BP_Tests_Groups_Template extends BP_UnitTestCase {
7
- public function setUp() {
8
- parent::setUp();
9
- }
10
-
11
- public function tearDown() {
12
- parent::tearDown();
13
- }
14
-
15
- /**
16
- * Integration test to make sure meta_query is getting passed through
17
- *
18
- * @group bp_has_groups
19
- */
20
- public function test_bp_has_groups_with_meta_query() {
21
- $g1 = $this->factory->group->create();
22
- $g2 = $this->factory->group->create();
23
- groups_update_groupmeta( $g1, 'foo', 'bar' );
24
-
25
- global $groups_template;
26
- bp_has_groups( array(
27
- 'meta_query' => array(
28
- array(
29
- 'key' => 'foo',
30
- 'value' => 'bar',
31
- ),
32
- ),
33
- ) );
34
-
35
- $ids = wp_list_pluck( $groups_template->groups, 'id' );
36
- $this->assertEquals( $ids, array( $g1, ) );
37
- }
38
-
39
- /**
40
- * Integration test to make sure order and orderby are interpreted when
41
- * no 'type' value has been passed
42
- *
43
- * @group bp_has_groups
44
- */
45
- public function test_bp_has_groups_with_order_orderby_with_null_type() {
46
- $g1 = $this->factory->group->create( array(
47
- 'name' => 'AAAAA',
48
- 'date_created' => gmdate( 'Y-m-d H:i:s', time() - 100 ),
49
- 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 1000000 ),
50
- ) );
51
- $g2 = $this->factory->group->create( array(
52
- 'name' => 'BBBBB',
53
- 'date_created' => gmdate( 'Y-m-d H:i:s', time() - 1000000 ),
54
- 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 10000 ),
55
- ) );
56
- $g3 = $this->factory->group->create( array(
57
- 'name' => 'CCCCC',
58
- 'date_created' => gmdate( 'Y-m-d H:i:s', time() - 10000 ),
59
- 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 10 ),
60
- ) );
61
-
62
- global $groups_template;
63
- bp_has_groups( array(
64
- 'order' => 'ASC',
65
- 'orderby' => 'name',
66
- ) );
67
-
68
- $ids = wp_parse_id_list( wp_list_pluck( $groups_template->groups, 'id' ) );
69
- $this->assertEquals( array( $g1, $g2, $g3, ), $ids );
70
- }
71
-
72
- /**
73
- * Integration test to make sure 'order' is set to 'DESC' and 'orderby'
74
- * to 'last_activity' when no type or order/orderby params are passed.
75
- * This ensures backpat with the old system, where 'active' was the
76
- * default type param, and there were no order/orderby params.
77
- *
78
- * @group bp_has_groups
79
- */
80
- public function test_bp_has_groups_defaults_to_DESC_last_activity_for_default_type_active_backpat() {
81
- $g1 = $this->factory->group->create( array(
82
- 'name' => 'AAAAA',
83
- 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 100 ),
84
- ) );
85
- $g2 = $this->factory->group->create( array(
86
- 'name' => 'BBBBB',
87
- 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 1000000 ),
88
- ) );
89
- $g3 = $this->factory->group->create( array(
90
- 'name' => 'CCCCC',
91
- 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 10000 ),
92
- ) );
93
-
94
- global $groups_template;
95
- bp_has_groups();
96
-
97
- $ids = wp_parse_id_list( wp_list_pluck( $groups_template->groups, 'id' ) );
98
- $this->assertEquals( array( $g1, $g3, $g2, ), $ids );
99
- }
100
-
101
- /**
102
- * @group bp_group_has_members
103
- */
104
- public function test_bp_group_has_members_vanilla() {
105
- $g = $this->factory->group->create();
106
- $u1 = $this->create_user();
107
- $u2 = $this->create_user();
108
-
109
- $this->add_user_to_group( $u1, $g );
110
-
111
- global $members_template;
112
- bp_group_has_members( array(
113
- 'group_id' => $g,
114
- 'exclude_admins_mods' => false,
115
- ) );
116
-
117
- $ids = wp_parse_id_list( wp_list_pluck( $members_template->members, 'user_id' ) );
118
- $this->assertEquals( array( $u1, ), $ids );
119
- }
120
-
121
- /**
122
- * Switching from BP_Groups_Member to BP_Group_Member_Query meant a
123
- * change in the format of the values returned from the query. For
124
- * backward compatibility, we translate some of the return values
125
- * of BP_Group_Member_Query to the older format. This test makes sure
126
- * that the translation happens properly.
127
- *
128
- * @group bp_group_has_members
129
- */
130
- public function test_bp_group_has_members_backpat_retval_format() {
131
- $u1 = $this->create_user();
132
- $u2 = $this->create_user();
133
- $g = $this->factory->group->create( array( 'creator_id' => $u2 ) );
134
-
135
- $date_modified = gmdate( 'Y-m-d H:i:s', time() - 100 );
136
-
137
- $this->add_user_to_group( $u1, $g, array( 'date_modified' => $date_modified ) );
138
-
139
- global $members_template;
140
- bp_group_has_members( array(
141
- 'group_id' => $g,
142
- ) );
143
-
144
- $u1_object = new WP_User( $u1 );
145
-
146
- $expected = new stdClass;
147
- $expected->user_id = $u1;
148
- $expected->date_modified = $date_modified;
149
- $expected->is_banned = 0;
150
- $expected->user_login = $u1_object->user_login;
151
- $expected->user_nicename = $u1_object->user_nicename;
152
- $expected->user_email = $u1_object->user_email;
153
- $expected->display_name = $u1_object->display_name;
154
-
155
- // In order to use assertEquals, we need to discard the
156
- // irrelevant properties of the found object. Hack alert
157
- $found = new stdClass;
158
- foreach ( array( 'user_id', 'date_modified', 'is_banned', 'user_login', 'user_nicename', 'user_email', 'display_name' ) as $key ) {
159
- if ( isset( $members_template->members[0]->{$key} ) ) {
160
- $found->{$key} = $members_template->members[0]->{$key};
161
- }
162
- }
163
-
164
- $this->assertEquals( $expected, $found );
165
- }
166
-
167
- /**
168
- * @group bp_group_has_members
169
- */
170
- public function test_bp_group_has_members_with_per_page() {
171
- $g = $this->factory->group->create();
172
-
173
- $users = array();
174
- for ( $i = 1; $i <= 10; $i++ ) {
175
- $users[ $i ] = $this->create_user();
176
- }
177
-
178
- $expected = array();
179
- $now = time();
180
- for ( $i = 3; $i <= 10; $i++ ) {
181
- $this->add_user_to_group( $users[ $i ], $g, array(
182
- 'date_modified' => $now - 60 * $i,
183
- ) );
184
- $expected[] = $users[ $i ];
185
- }
186
-
187
- // hack it down to 5 (per page arg below)
188
- $expected = array_slice( $expected, 0, 5 );
189
-
190
- global $members_template;
191
- bp_group_has_members( array(
192
- 'group_id' => $g,
193
- 'per_page' => 5,
194
- ) );
195
-
196
- $ids = wp_parse_id_list( wp_list_pluck( $members_template->members, 'user_id' ) );
197
- $this->assertEquals( $expected, $ids );
198
- }
199
-
200
- /**
201
- * Note: 'max' is a weird parameter. It just changes the member_count
202
- * in the global - not the sql query at all. I'm testing what it
203
- * appears to be designed to do, not what it feels like it ought to do
204
- * if it made any sense. Programming is fun, QED.
205
- *
206
- * @group bp_group_has_members
207
- */
208
- public function test_bp_group_has_members_with_max() {
209
- $g = $this->factory->group->create();
210
-
211
- $users = array();
212
- for ( $i = 1; $i <= 10; $i++ ) {
213
- $users[ $i ] = $this->create_user();
214
- }
215
-
216
- $expected = array();
217
- for ( $i = 3; $i <= 10; $i++ ) {
218
- $this->add_user_to_group( $users[ $i ], $g );
219
- $expected[] = $users[ $i ];
220
- }
221
-
222
- global $members_template;
223
- bp_group_has_members( array(
224
- 'group_id' => $g,
225
- 'max' => 5,
226
- ) );
227
-
228
- $this->assertEquals( 5, $members_template->member_count );
229
- }
230
-
231
- /**
232
- * @group bp_group_has_members
233
- */
234
- public function test_bp_group_has_members_with_exclude() {
235
- $g = $this->factory->group->create();
236
- $u1 = $this->create_user();
237
- $u2 = $this->create_user();
238
-
239
- $this->add_user_to_group( $u1, $g );
240
- $this->add_user_to_group( $u2, $g );
241
-
242
- global $members_template;
243
- bp_group_has_members( array(
244
- 'group_id' => $g,
245
- 'exclude' => $u1,
246
- ) );
247
-
248
- $ids = wp_parse_id_list( wp_list_pluck( $members_template->members, 'user_id' ) );
249
- $this->assertEquals( array( $u2 ), $ids );
250
- }
251
-
252
- /**
253
- * @group bp_group_has_members
254
- */
255
- public function test_bp_group_has_members_with_exclude_admins_mods_1() {
256
- $g = $this->factory->group->create();
257
- $u1 = $this->create_user();
258
- $u2 = $this->create_user();
259
- $u3 = $this->create_user();
260
-
261
- $this->add_user_to_group( $u1, $g );
262
- $this->add_user_to_group( $u2, $g );
263
- $this->add_user_to_group( $u3, $g );
264
-
265
- $m1 = new BP_Groups_Member( $u1, $g );
266
- $m1->promote( 'admin' );
267
- $m2 = new BP_Groups_Member( $u2, $g );
268
- $m2->promote( 'mod' );
269
-
270
- global $members_template;
271
- bp_group_has_members( array(
272
- 'group_id' => $g,
273
- 'exclude_admins_mods' => 1,
274
- ) );
275
-
276
- $ids = wp_parse_id_list( wp_list_pluck( $members_template->members, 'user_id' ) );
277
- $this->assertEquals( array( $u3 ), $ids );
278
- }
279
-
280
- /**
281
- * @group bp_group_has_members
282
- */
283
- public function test_bp_group_has_members_with_exclude_admins_mods_0() {
284
- $u1 = $this->create_user();
285
- $u2 = $this->create_user();
286
- $u3 = $this->create_user();
287
- $g = $this->factory->group->create( array(
288
- 'creator_id' => $u1,
289
- ) );
290
-
291
- $now = time();
292
- $this->add_user_to_group( $u2, $g, array(
293
- 'date_modified' => $now - 60,
294
- ) );
295
- $this->add_user_to_group( $u3, $g, array(
296
- 'date_modified' => $now - 60*60,
297
- ) );
298
-
299
- $m1 = new BP_Groups_Member( $u1, $g );
300
- $m1->promote( 'admin' );
301
- $m2 = new BP_Groups_Member( $u2, $g );
302
- $m2->promote( 'mod' );
303
-
304
- global $members_template;
305
- bp_group_has_members( array(
306
- 'group_id' => $g,
307
- 'exclude_admins_mods' => 0,
308
- ) );
309
-
310
- $ids = wp_parse_id_list( wp_list_pluck( $members_template->members, 'user_id' ) );
311
- $this->assertEquals( array( $u1, $u2, $u3 ), $ids );
312
- }
313
-
314
- /**
315
- * @group bp_group_has_members
316
- */
317
- public function test_bp_group_has_members_with_exclude_banned_1() {
318
- $g = $this->factory->group->create();
319
- $u1 = $this->create_user();
320
- $u2 = $this->create_user();
321
-
322
- $this->add_user_to_group( $u1, $g );
323
- $this->add_user_to_group( $u2, $g );
324
-
325
- $m1 = new BP_Groups_Member( $u1, $g );
326
- $m1->ban();
327
-
328
- global $members_template;
329
- bp_group_has_members( array(
330
- 'group_id' => $g,
331
- 'exclude_banned' => 1,
332
- ) );
333
-
334
- $ids = wp_parse_id_list( wp_list_pluck( $members_template->members, 'user_id' ) );
335
- $this->assertEquals( array( $u2, ), $ids );
336
- }
337
-
338
- /**
339
- * @group bp_group_has_members
340
- */
341
- public function test_bp_group_has_members_with_exclude_banned_0() {
342
- $u1 = $this->create_user();
343
- $u2 = $this->create_user();
344
- $u3 = $this->create_user();
345
-
346
- $g = $this->factory->group->create( array(
347
- 'creator_id' => $u1,
348
- ) );
349
-
350
- $this->add_user_to_group( $u2, $g, array(
351
- 'date_modified' => gmdate( 'Y-m-d H:i:s', time() - 60*60*24 ),
352
- ) );
353
- $this->add_user_to_group( $u3, $g, array(
354
- 'date_modified' => gmdate( 'Y-m-d H:i:s', time() - 60*60*12 ),
355
- ) );
356
-
357
- $m2 = new BP_Groups_Member( $u2, $g );
358
- $m2->ban();
359
-
360
- global $members_template;
361
- bp_group_has_members( array(
362
- 'group_id' => $g,
363
- 'exclude_banned' => 0,
364
- 'exclude_admins_mods' => false,
365
- ) );
366
-
367
- $ids = wp_parse_id_list( wp_list_pluck( $members_template->members, 'user_id' ) );
368
- $this->assertEquals( array( $u1, $u3, $u2 ), $ids );
369
- }
370
-
371
- /**
372
- * Default sort order should be the joined date
373
- *
374
- * @tickett BP5106
375
- * @group bp_group_has_members
376
- */
377
- public function test_bp_group_has_members_default_order() {
378
- $u1 = $this->create_user( array(
379
- 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 60 ),
380
- ) );
381
- $u2 = $this->create_user( array(
382
- 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 600 ),
383
- ) );
384
- $u3 = $this->create_user( array(
385
- 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 6000 ),
386
- ) );
387
-
388
- $g = $this->factory->group->create( array(
389
- 'creator_id' => $u1,
390
- ) );
391
-
392
- $this->add_user_to_group( $u2, $g, array(
393
- 'date_modified' => gmdate( 'Y-m-d H:i:s', time() - 60*60*24 ),
394
- ) );
395
-
396
- $this->add_user_to_group( $u3, $g, array(
397
- 'date_modified' => gmdate( 'Y-m-d H:i:s', time() - 60*60*12 ),
398
- ) );
399
-
400
- global $members_template;
401
- bp_group_has_members( array(
402
- 'group_id' => $g,
403
- 'exclude_banned' => 0,
404
- 'exclude_admins_mods' => false,
405
- ) );
406
-
407
- $ids = wp_parse_id_list( wp_list_pluck( $members_template->members, 'user_id' ) );
408
- $this->assertEquals( array( $u1, $u3, $u2, ), $ids );
409
- }
410
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/members/functions.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
- /**
3
- * @group members
4
- */
5
- class BP_Tests_Members_Functions extends BP_UnitTestCase {
6
- protected $old_current_user = 0;
7
-
8
- public function setUp() {
9
- parent::setUp();
10
-
11
- $this->old_current_user = get_current_user_id();
12
- $this->set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
13
- }
14
-
15
- public function tearDown() {
16
- parent::tearDown();
17
- $this->set_current_user( $this->old_current_user );
18
- }
19
-
20
- /**
21
- * ticket BP4915
22
- */
23
- public function test_bp_core_delete_account() {
24
- // Stash
25
- $current_user = get_current_user_id();
26
- $deletion_disabled = bp_disable_account_deletion();
27
-
28
- // Create an admin for testing
29
- $admin_user = $this->factory->user->create( array( 'role' => 'administrator' ) );
30
- $this->grant_super_admin( $admin_user );
31
-
32
- // 1. Admin can delete user account
33
- $this->set_current_user( $admin_user );
34
- $user1 = $this->factory->user->create( array( 'role' => 'subscriber' ) );
35
- bp_core_delete_account( $user1 );
36
- $maybe_user = new WP_User( $user1 );
37
- $this->assertEquals( 0, $maybe_user->ID );
38
- unset( $maybe_user );
39
-
40
- // 2. Admin cannot delete superadmin account
41
- $user2 = $this->factory->user->create( array( 'role' => 'administrator' ) );
42
- $this->grant_super_admin( $user2 );
43
- bp_core_delete_account( $user2 );
44
- $maybe_user = new WP_User( $user2 );
45
- $this->assertNotEquals( 0, $maybe_user->ID );
46
- unset( $maybe_user );
47
-
48
- // User cannot delete other's account
49
- $user3 = $this->factory->user->create( array( 'role' => 'subscriber' ) );
50
- $user4 = $this->factory->user->create( array( 'role' => 'subscriber' ) );
51
- $this->set_current_user( $user3 );
52
- bp_core_delete_account( $user4 );
53
- $maybe_user = new WP_User( $user4 );
54
- $this->assertNotEquals( 0, $maybe_user->ID );
55
- unset( $maybe_user );
56
-
57
- // User cannot delete own account when account deletion is disabled
58
- $user5 = $this->factory->user->create( array( 'role' => 'subscriber' ) );
59
- $this->set_current_user( $user5 );
60
- bp_update_option( 'bp-disable-account-deletion', 1 );
61
- bp_core_delete_account( $user5 );
62
- $maybe_user = new WP_User( $user5 );
63
- $this->assertNotEquals( 0, $maybe_user->ID );
64
- unset( $maybe_user );
65
-
66
- // User can delete own account when account deletion is enabled
67
- $user6 = $this->factory->user->create( array( 'role' => 'subscriber' ) );
68
- $this->set_current_user( $user6 );
69
- bp_update_option( 'bp-disable-account-deletion', 0 );
70
- bp_core_delete_account( $user6 );
71
- $maybe_user = new WP_User( $user6 );
72
- $this->assertEquals( 0, $maybe_user->ID );
73
- unset( $maybe_user );
74
-
75
- // Cleanup
76
- $this->set_current_user( $current_user );
77
- bp_update_option( 'bp-disable-account-deletion', $deletion_disabled );
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/members/template.php DELETED
@@ -1,102 +0,0 @@
1
- <?php
2
- /**
3
- * @group members
4
- */
5
- class BP_Tests_Members_Template extends BP_UnitTestCase {
6
- protected $old_current_user = 0;
7
-
8
- public function setUp() {
9
- parent::setUp();
10
-
11
- $this->old_current_user = get_current_user_id();
12
- $new_user = $this->factory->user->create( array( 'role' => 'administrator' ) );
13
- $this->set_current_user( $new_user );
14
-
15
- }
16
-
17
- public function tearDown() {
18
- parent::tearDown();
19
- $this->set_current_user( $this->old_current_user );
20
- }
21
-
22
- public function test_bp_has_members_include_on_user_page() {
23
- $u1 = $this->create_user();
24
- $u2 = $this->create_user();
25
-
26
- $this->go_to( bp_core_get_user_domain( $u1 ) );
27
-
28
- global $members_template;
29
- bp_has_members( array(
30
- 'include' => array( $u1, $u2 ),
31
- ) );
32
-
33
- $users = is_array( $members_template->members ) ? array_values( $members_template->members ) : array();
34
- $user_ids = wp_list_pluck( $users, 'ID' );
35
- sort( $user_ids );
36
-
37
- $shouldbe = array( $u1, $u2 );
38
- sort( $shouldbe );
39
-
40
- $this->assertEquals( $user_ids, $shouldbe );
41
- }
42
-
43
- public function test_bp_has_members_friendship_requests() {
44
- $u1 = $this->create_user();
45
- $u2 = $this->create_user();
46
-
47
- $this->setUp_wp_mail();
48
- friends_add_friend( $u1, $u2 );
49
- $this->tearDown_wp_mail();
50
-
51
- $old_user = get_current_user_id();
52
- $this->set_current_user( $u2 );
53
-
54
- $this->go_to( bp_core_get_user_domain( $u2 ) . bp_get_friends_slug() . '/requests/' );
55
- $this->restore_admins();
56
-
57
- global $members_template;
58
- bp_has_members( array(
59
- 'include' => bp_get_friendship_requests( $u2 ),
60
- ) );
61
-
62
- $requests = is_array( $members_template->members ) ? array_values( $members_template->members ) : array();
63
- $request_ids = wp_list_pluck( $requests, 'ID' );
64
- $this->assertEquals( $request_ids, array( $u1 ) );
65
-
66
- $this->set_current_user( $old_user );
67
- }
68
-
69
- /**
70
- * @group bp_has_members
71
- * @group friends
72
- * @ticket BP5071
73
- */
74
- public function test_bp_has_members_friendship_requests_with_no_requests() {
75
- $u1 = $this->create_user();
76
- $u2 = $this->create_user();
77
-
78
- $old_user = get_current_user_id();
79
- $this->set_current_user( $u2 );
80
-
81
- // For some reason, in all the user switching, the cache gets
82
- // confused. Never comes up when BP runs normally, because the
83
- // loggedin_user doesn't change on a pageload. @todo Fix for
84
- // real in BP
85
- wp_cache_delete( 'bp_user_domain_' . $u2, 'bp' );
86
-
87
- $this->go_to( bp_core_get_user_domain( $u2 ) . bp_get_friends_slug() . '/requests/' );
88
- $this->restore_admins();
89
-
90
- global $members_template;
91
- bp_has_members( array(
92
- 'include' => bp_get_friendship_requests( $u2 ),
93
- ) );
94
-
95
- $requests = is_array( $members_template->members ) ? array_values( $members_template->members ) : array();
96
- $request_ids = wp_list_pluck( $requests, 'ID' );
97
- $this->assertEquals( array(), $request_ids );
98
-
99
- $this->set_current_user( $old_user );
100
- }
101
-
102
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/routing/activity.php DELETED
@@ -1,68 +0,0 @@
1
- <?php
2
- /**
3
- * @group activity
4
- * @group routing
5
- */
6
- class BP_Tests_Routing_Activity extends BP_UnitTestCase {
7
- protected $old_current_user = 0;
8
-
9
- public function setUp() {
10
- parent::setUp();
11
-
12
- $this->old_current_user = get_current_user_id();
13
- $this->set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
14
- }
15
-
16
- public function tearDown() {
17
- parent::tearDown();
18
- $this->set_current_user( $this->old_current_user );
19
- }
20
-
21
- function test_activity_directory() {
22
- $this->go_to( bp_get_activity_directory_permalink() );
23
- $this->assertEquals( bp_get_activity_root_slug(), bp_current_component() );
24
- }
25
-
26
- /**
27
- * Can't test using bp_activity_get_permalink(); see bp_activity_action_permalink_router().
28
- */
29
- function test_activity_permalink() {
30
- $a = $this->factory->activity->create();
31
- $activity = $this->factory->activity->get_object_by_id( $a );
32
-
33
- $url = bp_core_get_user_domain( $activity->user_id ) . bp_get_activity_slug() . '/' . $activity->id . '/';
34
- $this->go_to( $url );
35
- $this->assertTrue( bp_is_single_activity() );
36
- }
37
-
38
- function test_member_activity() {
39
- $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() );
40
- $this->assertTrue( bp_is_user_activity() );
41
- }
42
-
43
- function test_member_activity_mentions() {
44
- $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/mentions' );
45
- $this->assertTrue( bp_is_user_activity() );
46
- }
47
-
48
- function test_member_activity_favourites() {
49
- $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/favorites' );
50
- $this->assertTrue( bp_is_user_activity() );
51
- }
52
-
53
- /**
54
- * @group friends
55
- */
56
- function test_member_activity_friends() {
57
- $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/' . bp_get_friends_slug() );
58
- $this->assertTrue( bp_is_user_friends_activity() );
59
- }
60
-
61
- /**
62
- * @group groups
63
- */
64
- function test_member_activity_groups() {
65
- $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/' . bp_get_groups_slug() );
66
- $this->assertTrue( bp_is_user_groups_activity() );
67
- }
68
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/routing/anonymous.php DELETED
@@ -1,29 +0,0 @@
1
- <?php
2
- /**
3
- * @group routing
4
- */
5
- class BP_Tests_Routing_Anonymous extends BP_UnitTestCase {
6
- protected $old_current_user = 0;
7
-
8
- public function setUp() {
9
- parent::setUp();
10
-
11
- $this->old_current_user = get_current_user_id();
12
- $this->set_current_user( 0 );
13
- }
14
-
15
- public function tearDown() {
16
- parent::tearDown();
17
- $this->set_current_user( $this->old_current_user );
18
- }
19
-
20
- function test_wordpress_page() {
21
- $this->go_to( '/' );
22
- $this->assertEmpty( bp_current_component() );
23
- }
24
-
25
- function test_nav_menu() {
26
- $this->go_to( '/' );
27
- $this->assertEmpty( buddypress()->bp_nav );
28
- }
29
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/routing/core.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
- /**
3
- * @group core
4
- * @group routing
5
- */
6
- class BP_Tests_Routing_Core extends BP_UnitTestCase {
7
- protected $old_current_user = 0;
8
-
9
- public function setUp() {
10
- parent::setUp();
11
-
12
- $this->old_current_user = get_current_user_id();
13
- $this->set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
14
- }
15
-
16
- public function tearDown() {
17
- parent::tearDown();
18
- $this->set_current_user( $this->old_current_user );
19
- }
20
-
21
- function test_wordpress_page() {
22
- $this->go_to( '/' );
23
- $this->assertEmpty( bp_current_component() );
24
- }
25
-
26
- function test_nav_menu() {
27
- $this->go_to( '/' );
28
- $this->assertArrayHasKey( 'activity', buddypress()->bp_nav );
29
- $this->assertArrayHasKey( 'profile', buddypress()->bp_nav );
30
- }
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/routing/friends.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
- /**
3
- * @group friends
4
- * @group routing
5
- */
6
- class BP_Tests_Routing_Friends extends BP_UnitTestCase {
7
- protected $old_current_user = 0;
8
-
9
- public function setUp() {
10
- parent::setUp();
11
-
12
- $this->old_current_user = get_current_user_id();
13
- $this->set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
14
- }
15
-
16
- public function tearDown() {
17
- parent::tearDown();
18
- $this->set_current_user( $this->old_current_user );
19
- }
20
-
21
- function test_member_friends() {
22
- $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_friends_slug() );
23
- $this->assertTrue( bp_is_user_friends() );
24
- }
25
-
26
- function test_member_friends_requests() {
27
- $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_friends_slug() . '/requests' );
28
- $this->assertTrue( bp_is_user_friend_requests() );
29
- }
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/routing/groups.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
- /**
3
- * @group groups
4
- * @group routing
5
- */
6
- class BP_Tests_Routing_Groups extends BP_UnitTestCase {
7
- protected $old_current_user = 0;
8
-
9
- public function setUp() {
10
- parent::setUp();
11
-
12
- $this->old_current_user = get_current_user_id();
13
- $this->set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
14
- }
15
-
16
- public function tearDown() {
17
- parent::tearDown();
18
- $this->set_current_user( $this->old_current_user );
19
- }
20
-
21
- function test_member_groups() {
22
- $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_groups_slug() );
23
- $this->assertTrue( bp_is_user_groups() );
24
- }
25
-
26
- function test_member_groups_invitations() {
27
- $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_groups_slug() . '/invites' );
28
- $this->assertTrue( bp_is_user_groups() && bp_is_current_action( 'invites' ) );
29
- }
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/routing/members.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
- /**
3
- * @group members
4
- * @group routing
5
- */
6
- class BP_Tests_Routing_Members extends BP_UnitTestCase {
7
- protected $old_current_user = 0;
8
-
9
- public function setUp() {
10
- parent::setUp();
11
-
12
- $this->old_current_user = get_current_user_id();
13
- $this->set_current_user( $this->factory->user->create( array( 'user_login' => 'paulgibbs', 'role' => 'subscriber' ) ) );
14
- }
15
-
16
- public function tearDown() {
17
- parent::tearDown();
18
- $this->set_current_user( $this->old_current_user );
19
- }
20
-
21
- function test_members_directory() {
22
- $this->go_to( bp_get_members_directory_permalink() );
23
- $this->assertEquals( bp_get_members_root_slug(), bp_current_component() );
24
- }
25
-
26
- function test_member_permalink() {
27
- $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) );
28
- $this->assertTrue( bp_is_my_profile() );
29
- }
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/routing/messages.php DELETED
@@ -1,40 +0,0 @@
1
- <?php
2
- /**
3
- * @group messages
4
- * @group routing
5
- */
6
- class BP_Tests_Routing_Messages extends BP_UnitTestCase {
7
- protected $old_current_user = 0;
8
-
9
- public function setUp() {
10
- parent::setUp();
11
-
12
- $this->old_current_user = get_current_user_id();
13
- $this->set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
14
- }
15
-
16
- public function tearDown() {
17
- parent::tearDown();
18
- $this->set_current_user( $this->old_current_user );
19
- }
20
-
21
- function test_member_messages() {
22
- $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_messages_slug() );
23
- $this->assertTrue( bp_is_messages_inbox() );
24
- }
25
-
26
- function test_member_messages_sentbox() {
27
- $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_messages_slug() . '/sentbox' );
28
- $this->assertTrue( bp_is_messages_sentbox() );
29
- }
30
-
31
- function test_member_messages_compose() {
32
- $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_messages_slug() . '/compose' );
33
- $this->assertTrue( bp_is_messages_compose_screen() );
34
- }
35
-
36
- function test_member_messages_notices() {
37
- $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_messages_slug() . '/notices' );
38
- $this->assertTrue( bp_is_notices() );
39
- }
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/routing/settings.php DELETED
@@ -1,40 +0,0 @@
1
- <?php
2
- /**
3
- * @group settings
4
- * @group routing
5
- */
6
- class BP_Tests_Routing_Settings extends BP_UnitTestCase {
7
- protected $old_current_user = 0;
8
-
9
- public function setUp() {
10
- parent::setUp();
11
-
12
- $this->old_current_user = get_current_user_id();
13
- $this->set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
14
- }
15
-
16
- public function tearDown() {
17
- parent::tearDown();
18
- $this->set_current_user( $this->old_current_user );
19
- }
20
-
21
- function test_member_settings() {
22
- $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_settings_slug() );
23
- $this->assertTrue( bp_is_user_settings_general() );
24
- }
25
-
26
- function test_member_settings_notifications() {
27
- $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_settings_slug() . '/notifications' );
28
- $this->assertTrue( bp_is_user_settings_notifications() );
29
- }
30
-
31
- // @todo How best to test this?
32
- /*function bp_is_user_settings_account_capbilities() {
33
- $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_settings_slug() . '/capabilities' );
34
- }*/
35
-
36
- function bp_is_user_settings_account_delete() {
37
- $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_settings_slug() . '/delete-account' );
38
- $this->assertTrue( bp_is_user_settings_account_delete() );
39
- }
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/routing/xprofile.php DELETED
@@ -1,35 +0,0 @@
1
- <?php
2
- /**
3
- * @group xprofile
4
- * @group routing
5
- */
6
- class BP_Tests_Routing_XProfile extends BP_UnitTestCase {
7
- protected $old_current_user = 0;
8
-
9
- public function setUp() {
10
- parent::setUp();
11
-
12
- $this->old_current_user = get_current_user_id();
13
- $this->set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
14
- }
15
-
16
- public function tearDown() {
17
- parent::tearDown();
18
- $this->set_current_user( $this->old_current_user );
19
- }
20
-
21
- function test_member_profile() {
22
- $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . buddypress()->profile->slug );
23
- $this->assertTrue( bp_is_user_profile() );
24
- }
25
-
26
- function test_member_profile_edit() {
27
- $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . buddypress()->profile->slug . '/edit' );
28
- $this->assertTrue( bp_is_user_profile_edit() );
29
- }
30
-
31
- function test_member_profile_change_avatar() {
32
- $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . buddypress()->profile->slug . '/change-avatar' );
33
- $this->assertTrue( bp_is_user_change_avatar() );
34
- }
35
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/url/url.php DELETED
@@ -1,65 +0,0 @@
1
- <?php
2
- /**
3
- * @group url
4
- */
5
- class BP_Tests_URL extends BP_UnitTestCase {
6
- protected $old_current_user = 0;
7
-
8
- public function setUp() {
9
- parent::setUp();
10
-
11
- $this->old_current_user = get_current_user_id();
12
- $this->set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
13
- }
14
-
15
- public function tearDown() {
16
- parent::tearDown();
17
- $this->set_current_user( $this->old_current_user );
18
- }
19
-
20
- function test_bp_core_ajax_url() {
21
- $forced = force_ssl_admin();
22
-
23
- // (1) HTTPS off
24
- force_ssl_admin( false );
25
- $_SERVER['HTTPS'] = 'off';
26
-
27
- // (1a) Front-end
28
- $this->go_to( '/' );
29
- $this->assertEquals( bp_core_ajax_url(), get_site_url( bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'http' ) );
30
-
31
- // (1b) Dashboard
32
- $this->go_to( '/wp-admin' );
33
- $this->assertEquals( bp_core_ajax_url(), get_site_url( bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'http' ) );
34
-
35
- // (2) FORCE_SSL_ADMIN
36
- force_ssl_admin( true );
37
-
38
- // (2a) Front-end
39
- $this->go_to( '/' );
40
- $this->assertEquals( bp_core_ajax_url(), get_site_url( bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'http' ) );
41
-
42
- // (2b) Dashboard
43
- $this->go_to( '/wp-admin' );
44
- $this->assertEquals( bp_core_ajax_url(), get_site_url( bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'https' ) );
45
-
46
- force_ssl_admin( $forced );
47
-
48
- // (3) Multisite, root blog other than 1
49
- if ( is_multisite() ) {
50
- $original_root_blog = bp_get_root_blog_id();
51
- $blog_id = $this->factory->blog->create();
52
- buddypress()->root_blog_id = $blog_id;
53
-
54
- switch_to_blog( $blog_id );
55
- $blog_details = get_blog_details();
56
-
57
- $this->go_to( $blog_details->path );
58
- $this->assertEquals( $blog_details->siteurl . '/wp-admin/admin-ajax.php', bp_core_ajax_url() );
59
-
60
- restore_current_blog();
61
- buddypress()->root_blog_id = $original_root_blog;
62
- }
63
-
64
- }
65
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/xprofile/class-bp-xprofile-field.php DELETED
@@ -1,29 +0,0 @@
1
- <?php
2
- /**
3
- * @group xprofile
4
- * @group BP_XProfile_Field
5
- */
6
- class BP_Tests_BP_XProfile_XProfile_TestCases extends BP_UnitTestCase {
7
- public function setUp() {
8
- parent::setUp();
9
- }
10
-
11
- public function tearDown() {
12
- parent::tearDown();
13
- }
14
-
15
- public function test_can_delete_save() {
16
- $group = $this->factory->xprofile_group->create();
17
- $field = $this->factory->xprofile_field->create( array(
18
- 'field_group_id' => $group->id,
19
- 'type' => 'textbox',
20
- ) );
21
-
22
- $f = new BP_XProfile_Field( $field->id );
23
- $f->can_delete = 0;
24
- $f->save();
25
-
26
- $f2 = new BP_XProfile_Field( $field->id );
27
- $this->assertEquals( '0', $f2->can_delete );
28
- }
29
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/testcases/xprofile/functions.php DELETED
@@ -1,83 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * @group xprofile
5
- * @group functions
6
- */
7
- class BP_Tests_XProfile_Functions extends BP_UnitTestCase {
8
- public function setUp() {
9
- parent::setUp();
10
- }
11
-
12
- public function tearDown() {
13
- parent::tearDown();
14
- }
15
-
16
- public function test_get_hidden_field_types_for_user_loggedout() {
17
- $duser = $this->create_user();
18
-
19
- $old_current_user = bp_loggedin_user_id();
20
- $this->set_current_user( 0 );
21
-
22
- $this->assertEquals( array( 'friends', 'loggedin', 'adminsonly' ), bp_xprofile_get_hidden_field_types_for_user( $duser, bp_loggedin_user_id() ) );
23
-
24
- $this->set_current_user( $old_current_user );
25
- }
26
-
27
- public function test_get_hidden_field_types_for_user_loggedin() {
28
- $duser = $this->create_user();
29
- $cuser = $this->create_user();
30
-
31
- $old_current_user = bp_loggedin_user_id();
32
- $this->set_current_user( $cuser );
33
-
34
- $this->assertEquals( array( 'friends', 'adminsonly' ), bp_xprofile_get_hidden_field_types_for_user( $duser, bp_loggedin_user_id() ) );
35
-
36
- $this->set_current_user( $old_current_user );
37
- }
38
-
39
- public function test_get_hidden_field_types_for_user_friends() {
40
- $duser = $this->create_user();
41
- $cuser = $this->create_user();
42
- friends_add_friend( $duser, $cuser, true );
43
-
44
- $old_current_user = bp_loggedin_user_id();
45
- $this->set_current_user( $cuser );
46
-
47
- $this->assertEquals( array( 'adminsonly' ), bp_xprofile_get_hidden_field_types_for_user( $duser, bp_loggedin_user_id() ) );
48
-
49
- $this->set_current_user( $old_current_user );
50
- }
51
-
52
- public function test_get_hidden_field_types_for_user_admin() {
53
- $duser = $this->create_user();
54
- $cuser = $this->create_user();
55
- $this->grant_bp_moderate( $cuser );
56
-
57
- $old_current_user = bp_loggedin_user_id();
58
- $this->set_current_user( $cuser );
59
-
60
- $this->assertEquals( array(), bp_xprofile_get_hidden_field_types_for_user( $duser, bp_loggedin_user_id() ) );
61
-
62
- $this->revoke_bp_moderate( $cuser );
63
- $this->set_current_user( $old_current_user );
64
- }
65
-
66
- /**
67
- * @group bp_xprofile_update_meta
68
- * @ticket BP5180
69
- */
70
- public function test_bp_xprofile_update_meta_with_line_breaks() {
71
- $g = $this->factory->xprofile_group->create();
72
- $f = $this->factory->xprofile_field->create( array(
73
- 'field_group_id' => $g->id,
74
- 'type' => 'textbox',
75
- ) );
76
-
77
- $meta_value = 'Foo!
78
-
79
- Bar!';
80
- bp_xprofile_update_meta( $f->id, 'field', 'linebreak_field', $meta_value );
81
- $this->assertEquals( $meta_value, bp_xprofile_get_meta( $f->id, 'field', 'linebreak_field' ) );
82
- }
83
- }