diff --git bp-groups/bp-groups-functions.php bp-groups/bp-groups-functions.php
index 3f1d4eb..649f3ac 100644
|
|
|
function groups_update_groupmeta( $group_id, $meta_key, $meta_value ) { |
| 1044 | 1044 | |
| 1045 | 1045 | $meta_key = preg_replace( '|[^a-z0-9_]|i', '', $meta_key ); |
| 1046 | 1046 | |
| 1047 | | if ( is_string( $meta_value ) ) |
| 1048 | | $meta_value = stripslashes( esc_sql( $meta_value ) ); |
| | 1047 | if ( is_string( $meta_value ) ) { |
| | 1048 | $meta_value = stripslashes( $meta_value ); |
| | 1049 | } |
| 1049 | 1050 | |
| 1050 | 1051 | $meta_value = maybe_serialize( $meta_value ); |
| 1051 | 1052 | |
diff --git tests/testcases/groups/functions.php tests/testcases/groups/functions.php
index 5fd9b6d..32d6899 100644
|
|
|
class BP_Tests_Groups_Functions extends BP_UnitTestCase { |
| 269 | 269 | |
| 270 | 270 | $this->assertEquals( 1, groups_get_groupmeta( $g, 'total_member_count' ) ); |
| 271 | 271 | } |
| | 272 | |
| | 273 | /** |
| | 274 | * @group groupmeta |
| | 275 | * @ticket 5180 |
| | 276 | */ |
| | 277 | public function test_groups_update_groupmeta_with_line_breaks() { |
| | 278 | $g = $this->factory->group->create(); |
| | 279 | $meta_value = 'Foo! |
| | 280 | |
| | 281 | Bar!'; |
| | 282 | groups_update_groupmeta( $g, 'linebreak_test', $meta_value ); |
| | 283 | |
| | 284 | $this->assertEquals( $meta_value, groups_get_groupmeta( $g, 'linebreak_test' ) ); |
| | 285 | } |
| 272 | 286 | } |