Changeset 14068
- Timestamp:
- 11/01/2024 06:07:04 AM (4 days ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/blueprint.json
r13907 r14068 6 6 "wp": "latest" 7 7 }, 8 "phpExtensionBundles": [ 9 "kitchen-sink" 10 ], 8 "login": true, 9 "siteOptions": { 10 "blogname": "BuddyPress stable Playground" 11 }, 11 12 "steps": [ 12 13 { 13 "step": "login", 14 "username": "admin", 15 "password": "password" 14 "step": "installPlugin", 15 "pluginData": { 16 "resource": "wordpress.org/plugins", 17 "slug": "buddypress" 18 } 19 }, 20 { 21 "step": "activateTheme", 22 "themeFolderName": "twentytwentyfour" 16 23 } 17 24 ] -
trunk/src/bp-core/bp-core-catchuri.php
r13904 r14068 38 38 } 39 39 40 bp_reset_query( bp_get_referer_path(), $GLOBALS['wp_query'] ); 40 $referer = bp_get_referer_path(); 41 if ( ! $referer && isset( $_REQUEST['canonicalUrl'] ) ) { 42 $canonical_url = esc_url_raw( wp_unslash( $_REQUEST['canonicalUrl'] ) ); 43 $referer = wp_validate_redirect( wp_parse_url( $canonical_url, PHP_URL_PATH ) ); 44 } 45 46 bp_reset_query( $referer, $GLOBALS['wp_query'] ); 41 47 } 42 48 -
trunk/src/bp-core/bp-core-functions.php
r14029 r14068 1667 1667 $bp = buddypress(); 1668 1668 1669 if ( empty( $bp->template_message ) && isset( $_COOKIE['bp-message'] ) ) { 1669 // For a mysterious reason WP Playground seems to add a 'deleted' value to `$_COOKIE['bp-message']` when not set. 1670 if ( empty( $bp->template_message ) && isset( $_COOKIE['bp-message'] ) && 'deleted' !== $_COOKIE['bp-message'] ) { 1670 1671 $bp->template_message = stripslashes( $_COOKIE['bp-message'] ); 1671 1672 } -
trunk/src/bp-templates/bp-legacy/buddypress-functions.php
r14062 r14068 325 325 // Settings. 326 326 'store_filter_settings' => $store_filter_settings, 327 'canonical_url' => bp_get_canonical_url(), 327 328 ) ); 328 329 wp_localize_script( $asset['handle'], 'BP_DTheme', $params ); -
trunk/src/bp-templates/bp-legacy/js/buddypress.js
r14062 r14068 1 1 /* jshint undef: false, unused:false */ 2 2 /* @version 1.7.0 */ 3 /* @version 1 0.0.0 */3 /* @version 15.0.0 */ 4 4 // AJAX Functions 5 5 var jq = jQuery; … … 176 176 post_data = jq.extend( { 177 177 action: 'post_update', 178 'cookie': bp_get_cookies(),178 cookie: bp_get_cookies(), 179 179 '_wpnonce_post_update': jq('#_wpnonce_post_update').val(), 180 'content': content,181 'object': object,180 content: content, 181 object: object, 182 182 'item_id': item_id, 183 'since': last_date_recorded, 184 '_bp_as_nonce': jq('#_bp_as_nonce').val() || '' 183 since: last_date_recorded, 184 '_bp_as_nonce': jq('#_bp_as_nonce').val() || '', 185 canonicalUrl: BP_DTheme.canonical_url 185 186 }, inputs ); 186 187 … … 316 317 jq.post( ajaxurl, { 317 318 action: 'activity_mark_' + type, 318 'cookie': bp_get_cookies(), 319 'id': parent_id, 320 nonce: nonce 319 cookie: bp_get_cookies(), 320 id: parent_id, 321 nonce: nonce, 322 canonicalUrl: BP_DTheme.canonical_url 321 323 }, 322 324 function(response) { … … 377 379 jq.post( ajaxurl, { 378 380 action: 'delete_activity', 379 'cookie': bp_get_cookies(), 380 'id': id, 381 '_wpnonce': nonce 381 cookie: bp_get_cookies(), 382 id: id, 383 '_wpnonce': nonce, 384 canonicalUrl: BP_DTheme.canonical_url 382 385 }, 383 386 function(response) { … … 408 411 jq.post( ajaxurl, { 409 412 action: 'bp_spam_activity', 410 'cookie': encodeURIComponent( document.cookie ), 411 'id': li.attr( 'id' ).substr( 9, li.attr( 'id' ).length ), 412 '_wpnonce': target.attr( 'href' ).split( '_wpnonce=' )[1] 413 cookie: encodeURIComponent( document.cookie ), 414 id: li.attr( 'id' ).substr( 9, li.attr( 'id' ).length ), 415 '_wpnonce': target.attr( 'href' ).split( '_wpnonce=' )[1], 416 canonicalUrl: BP_DTheme.canonical_url 413 417 }, 414 418 … … 450 454 load_more_args = { 451 455 action: 'activity_get_older_updates', 452 'cookie': bp_get_cookies(),453 'page': oldest_page,456 cookie: bp_get_cookies(), 457 page: oldest_page, 454 458 'offset_lower': offsetLower, 455 'exclude_just_posted': just_posted.join(',') 459 'exclude_just_posted': just_posted.join(','), 460 canonicalUrl: BP_DTheme.canonical_url 456 461 }; 457 462 … … 519 524 jq.post( ajaxurl, { 520 525 action: 'get_single_activity_content', 521 'activity_id': a_id 526 'activity_id': a_id, 527 canonicalUrl: BP_DTheme.canonical_url 522 528 }, 523 529 function(response) { … … 625 631 ajaxdata = { 626 632 action: 'new_activity_comment', 627 'cookie': bp_get_cookies(),633 cookie: bp_get_cookies(), 628 634 '_wpnonce_new_activity_comment': jq('#_wpnonce_new_activity_comment' + '_' + form_id[2] ).val(), 629 635 'comment_id': comment_id, 630 636 'form_id': form_id[2], 631 'content': content.val() 637 content: content.val(), 638 canonicalUrl: BP_DTheme.canonical_url 632 639 }; 633 640 … … 709 716 jq.post( ajaxurl, { 710 717 action: 'delete_activity_comment', 711 'cookie': bp_get_cookies(),718 cookie: bp_get_cookies(), 712 719 '_wpnonce': nonce, 713 'id': comment_id 720 id: comment_id, 721 canonicalUrl: BP_DTheme.canonical_url 714 722 }, 715 723 function(response) { … … 767 775 jq.post( ajaxurl, { 768 776 action: 'bp_spam_activity_comment', 769 'cookie': encodeURIComponent( document.cookie ),777 cookie: encodeURIComponent( document.cookie ), 770 778 '_wpnonce': link_href.split( '_wpnonce=' )[1], 771 'id': link_href.split( 'cid=' )[1].split( '&' )[0] 779 id: link_href.split( 'cid=' )[1].split( '&' )[0], 780 canonicalUrl: BP_DTheme.canonical_url 772 781 }, 773 782 … … 1091 1100 action: 'groups_invite_user', 1092 1101 'friend_action': friend_action, 1093 'cookie': bp_get_cookies(),1102 cookie: bp_get_cookies(), 1094 1103 '_wpnonce': jq('#_wpnonce_invite_uninvite_user').val(), 1095 1104 'friend_id': friend_id, 1096 'group_id': jq('#group_id').val() 1105 'group_id': jq('#group_id').val(), 1106 canonicalUrl: BP_DTheme.canonical_url 1097 1107 }, 1098 1108 function(response) … … 1138 1148 action: 'groups_invite_user', 1139 1149 'friend_action': 'uninvite', 1140 'cookie': bp_get_cookies(),1150 cookie: bp_get_cookies(), 1141 1151 '_wpnonce': jq('#_wpnonce_invite_uninvite_user').val(), 1142 1152 'friend_id': friend_id, 1143 'group_id': jq('#group_id').val() 1153 'group_id': jq('#group_id').val(), 1154 canonicalUrl: BP_DTheme.canonical_url 1144 1155 }, 1145 1156 function() … … 1225 1236 jq.post( ajaxurl, { 1226 1237 action: action, 1227 'cookie': bp_get_cookies(), 1228 'id': id, 1229 '_wpnonce': nonce 1238 cookie: bp_get_cookies(), 1239 id: id, 1240 '_wpnonce': nonce, 1241 canonicalUrl: BP_DTheme.canonical_url 1230 1242 }, 1231 1243 function(response) { … … 1267 1279 jq.post( ajaxurl, { 1268 1280 action: 'addremove_friend', 1269 'cookie': bp_get_cookies(), 1270 'fid': fid, 1271 '_wpnonce': nonce 1281 cookie: bp_get_cookies(), 1282 fid: fid, 1283 '_wpnonce': nonce, 1284 canonicalUrl: BP_DTheme.canonical_url 1272 1285 }, 1273 1286 function(response) … … 1329 1342 jq.post( ajaxurl, { 1330 1343 action: 'joinleave_group', 1331 'cookie': bp_get_cookies(), 1332 'gid': gid, 1333 '_wpnonce': nonce 1344 cookie: bp_get_cookies(), 1345 gid: gid, 1346 '_wpnonce': nonce, 1347 canonicalUrl: BP_DTheme.canonical_url 1334 1348 }, 1335 1349 function(response) … … 1448 1462 jq.post( ajaxurl, { 1449 1463 action: 'messages_send_reply', 1450 'cookie': bp_get_cookies(),1464 cookie: bp_get_cookies(), 1451 1465 '_wpnonce': jq('#send_message_nonce').val(), 1452 1466 1453 'content': jq('#message_content').val(),1467 content: jq('#message_content').val(), 1454 1468 'send_to': jq('#send_to').val(), 1455 'subject': jq('#subject').val(), 1456 'thread_id': jq('#thread_id').val() 1469 subject: jq('#subject').val(), 1470 'thread_id': jq('#thread_id').val(), 1471 canonicalUrl: BP_DTheme.canonical_url 1457 1472 }, 1458 1473 function(response) … … 1538 1553 'message_id': link.data('message-id'), 1539 1554 'star_status': link.data('star-status'), 1540 'nonce': link.data('star-nonce'), 1541 'bulk': link.data('star-bulk') 1555 nonce: link.data('star-nonce'), 1556 bulk: link.data('star-bulk'), 1557 canonicalUrl: BP_DTheme.canonical_url 1542 1558 }, 1543 1559 function(response) { … … 1660 1676 action: 'messages_close_notice', 1661 1677 'notice_id': jq('.notice').attr('rel').substr( 2, jq('.notice').attr('rel').length ), 1662 nonce: jq( '#close-notice-nonce' ).val() 1678 nonce: jq( '#close-notice-nonce' ).val(), 1679 canonicalUrl: BP_DTheme.canonical_url 1663 1680 }, 1664 1681 function(response) { … … 1918 1935 bp_ajax_request = jq.post( ajaxurl, { 1919 1936 action: object + '_filter', 1920 'cookie': cookie, 1921 'object': object, 1922 'filter': filter, 1923 'search_terms': search_terms, 1924 'scope': scope, 1925 'page': page, 1926 'extras': extras, 1927 'template': template 1937 cookie: cookie, 1938 object: object, 1939 filter: filter, 1940 search_terms: search_terms, 1941 scope: scope, 1942 page: page, 1943 extras: extras, 1944 template: template, 1945 canonicalUrl: BP_DTheme.canonical_url 1928 1946 }, 1929 1947 function(response) … … 1982 2000 bp_ajax_request = jq.post( ajaxurl, { 1983 2001 action: 'activity_widget_filter', 1984 'cookie': cookie,2002 cookie: cookie, 1985 2003 '_wpnonce_activity_filter': jq('#_wpnonce_activity_filter').val(), 1986 'scope': scope, 1987 'filter': filter 2004 scope: scope, 2005 filter: filter, 2006 canonicalUrl: BP_DTheme.canonical_url 1988 2007 }, 1989 2008 function(response) -
trunk/src/bp-templates/bp-nouveau/buddypress-functions.php
r14029 r14068 126 126 ); 127 127 128 // When BP Classic is activated, regular themes need this filter. 128 // When BP Classic is activated, regular themes need this filter. 129 129 if ( bp_is_classic() ) { 130 130 // Set the BP Uri for the Ajax customizer preview. … … 503 503 $params = array( 504 504 'ajaxurl' => bp_core_ajax_url(), 505 'canonical_url' => bp_get_canonical_url(), 505 506 'confirm' => __( 'Are you sure?', 'buddypress' ), 506 507 -
trunk/src/bp-templates/bp-nouveau/js/buddypress-activity-post-form.js
r13366 r14068 1 1 /* global BP_Nouveau, _, Backbone */ 2 2 /* @since 3.0.0 */ 3 /* @version 8.0.0 */3 /* @version 15.0.0 */ 4 4 window.wp = window.wp || {}; 5 5 window.bp = window.bp || {}; … … 728 728 729 729 var data = { 730 canonicalUrl: BP_Nouveau.canonical_url, 730 731 '_wpnonce_post_update': BP_Nouveau.activity.params.post_nonce 731 732 }; -
trunk/src/bp-templates/bp-nouveau/js/buddypress-group-invites.js
r13115 r14068 1 1 /* global wp, BP_Nouveau, _, Backbone */ 2 2 /* @since 3.0.0 */ 3 /* @version 8.0.0 */3 /* @version 15.0.0 */ 4 4 window.wp = window.wp || {}; 5 5 window.bp = window.bp || {}; … … 244 244 245 245 initialize : function() { 246 this.options = { page: 1, total_page: 0, group_id: BP_Nouveau.group_invites.group_id }; 246 this.options = { 247 page: 1, 248 total_page: 0, 249 group_id: BP_Nouveau.group_invites.group_id, 250 canonicalUrl: BP_Nouveau.canonical_url 251 }; 247 252 }, 248 253 -
trunk/src/bp-templates/bp-nouveau/js/buddypress-messages.js
r13459 r14068 2 2 /* jshint devel: true */ 3 3 /* @since 3.0.0 */ 4 /* @version 1 1.2.0 */4 /* @version 15.0.0 */ 5 5 window.wp = window.wp || {}; 6 6 window.bp = window.bp || {}; … … 260 260 'messages_send_message', 261 261 _.extend( 262 { nonce: BP_Nouveau.messages.nonces.send }, 262 { 263 nonce: BP_Nouveau.messages.nonces.send, 264 canonicalUrl: BP_Nouveau.canonical_url 265 }, 263 266 this.attributes 264 267 ) … … 292 295 { 293 296 action : 'messages_thread_read', 294 nonce : BP_Nouveau.nonces.messages 297 nonce : BP_Nouveau.nonces.messages, 298 canonicalUrl: BP_Nouveau.canonical_url 295 299 } 296 300 ); … … 330 334 if ( 'read' === method ) { 331 335 options.data = _.extend( options.data, { 332 action: 'messages_get_user_message_threads' 336 action: 'messages_get_user_message_threads', 337 canonicalUrl: BP_Nouveau.canonical_url 333 338 } ); 334 339 … … 391 396 options.data = _.extend( options.data, { 392 397 action: 'messages_' + action, 393 nonce : BP_Nouveau.nonces.messages, 394 id : ids 398 nonce: BP_Nouveau.nonces.messages, 399 id: ids, 400 canonicalUrl: BP_Nouveau.canonical_url 395 401 } ); 396 402 … … 413 419 if ( 'read' === method ) { 414 420 options.data = _.extend( options.data, { 415 action: 'messages_get_thread_messages' 421 action: 'messages_get_thread_messages', 422 canonicalUrl: BP_Nouveau.canonical_url 416 423 } ); 417 424 … … 422 429 options.data = _.extend( options.data, { 423 430 action : 'messages_send_reply', 424 nonce : BP_Nouveau.messages.nonces.send 431 nonce : BP_Nouveau.messages.nonces.send, 432 canonicalUrl: BP_Nouveau.canonical_url 425 433 }, model || {} ); 426 434 -
trunk/src/bp-templates/bp-nouveau/js/buddypress-nouveau.js
r13341 r14068 3 3 /* jshint browser: true */ 4 4 /* @since 3.0.0 */ 5 /* @version 1 0.0.0 */5 /* @version 15.0.0 */ 6 6 window.wp = window.wp || {}; 7 7 window.bp = window.bp || {}; … … 196 196 197 197 // Extend posted data with stored data and object nonce. 198 var postData = $.extend( {}, bp.Nouveau.getStorage( 'bp-' + object ), { nonce: BP_Nouveau.nonces[object] }, post_data );198 var postData = $.extend( {}, bp.Nouveau.getStorage( 'bp-' + object ), { nonce: BP_Nouveau.nonces[object], canonicalUrl: BP_Nouveau.canonical_url }, post_data ); 199 199 200 200 if ( undefined !== BP_Nouveau.customizer_settings ) { -
trunk/src/bp-xprofile/bp-xprofile-functions.php
r13890 r14068 1478 1478 * 1479 1479 * @since 8.0.0 1480 * @since 15.0.0 The SQL request was adapted to support WP Playground's SQLite DB. 1480 1481 * 1481 1482 * @global wpdb $wpdb WordPress database object. … … 1490 1491 $bp = buddypress(); 1491 1492 1492 $signup_field_ids = $wpdb->get_col( "SELECT object_id FROM {$bp->profile->table_name_meta} WHERE object_type = 'field' AND meta_key = 'signup_position' ORDER BY CONVERT(meta_value, SIGNED) ASC" ); 1493 // WP Playground's SQLite DB does not support CONVERT AS SIGNED. 1494 $results = $wpdb->get_results( "SELECT object_id, meta_value FROM {$bp->profile->table_name_meta} WHERE object_type = 'field' AND meta_key = 'signup_position'" ); 1495 $signup_field_ids = array(); 1496 1497 foreach ( $results as $result ) { 1498 $index = (int) $result->meta_value; 1499 $signup_field_ids[ $index ] = (int) $result->object_id; 1500 } 1501 1502 // Sort. 1503 ksort( $signup_field_ids ); 1493 1504 1494 1505 wp_cache_set( 'signup_fields', $signup_field_ids, 'bp_xprofile' ); 1495 1506 } 1496 1507 1497 return array_ map( 'intval',$signup_field_ids );1508 return array_values( $signup_field_ids ); 1498 1509 } 1499 1510 -
trunk/tests/blueprints/14-0-0-RC1.json
r13951 r14068 6 6 "wp": "latest" 7 7 }, 8 "phpExtensionBundles": [ 9 "kitchen-sink" 10 ], 8 "login": true, 9 "siteOptions": { 10 "blogname": "BuddyPress 14.0.0-RC1 Playground" 11 }, 11 12 "steps": [ 12 13 { 13 "step": "login",14 "username": "admin",15 "password": "password"16 },17 {18 14 "step": "installPlugin", 19 "plugin ZipFile": {15 "pluginData": { 20 16 "resource": "url", 21 17 "url": "https://downloads.wordpress.org/plugin/buddypress.14.0.0-RC1.zip" 22 18 } 19 }, 20 { 21 "step": "activateTheme", 22 "themeFolderName": "twentytwentyfour" 23 23 } 24 24 ] -
trunk/tests/blueprints/14-0-0-beta1.json
r13929 r14068 1 1 { 2 2 "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 "landingPage": "\/wp-admin\/admin.php?page=bp-components", 3 4 "preferredVersions": { 4 5 "php": "8.2", 5 6 "wp": "latest" 6 7 }, 7 "phpExtensionBundles": [ 8 "kitchen-sink" 9 ], 8 "login": true, 9 "siteOptions": { 10 "blogname": "BuddyPress 14.0.0-beta1 Playground" 11 }, 10 12 "steps": [ 11 13 { 12 "step": "login",13 "username": "admin",14 "password": "password"15 },16 {17 14 "step": "installPlugin", 18 "plugin ZipFile": {15 "pluginData": { 19 16 "resource": "url", 20 17 "url": "https://downloads.wordpress.org/plugin/buddypress.14.0.0-beta1.zip" 21 18 } 19 }, 20 { 21 "step": "activateTheme", 22 "themeFolderName": "twentytwentyfour" 22 23 } 23 24 ] -
trunk/tests/blueprints/14-0-0-beta2.json
r13939 r14068 1 1 { 2 2 "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 "landingPage": "\/wp-admin\/admin.php?page=bp-components", 3 4 "preferredVersions": { 4 5 "php": "8.2", 5 6 "wp": "latest" 6 7 }, 7 "phpExtensionBundles": [ 8 "kitchen-sink" 9 ], 8 "login": true, 9 "siteOptions": { 10 "blogname": "BuddyPress 14.0.0-beta2 Playground" 11 }, 10 12 "steps": [ 11 13 { 12 "step": "login",13 "username": "admin",14 "password": "password"15 },16 {17 14 "step": "installPlugin", 18 "plugin ZipFile": {15 "pluginData": { 19 16 "resource": "url", 20 17 "url": "https://downloads.wordpress.org/plugin/buddypress.14.0.0-beta2.zip" 21 18 } 19 }, 20 { 21 "step": "activateTheme", 22 "themeFolderName": "twentytwentyfour" 22 23 } 23 24 ] -
trunk/tests/phpunit/testcases/xprofile/functions.php
r13980 r14068 1421 1421 $this->assertEquals( '', $updated_u->last_name ); 1422 1422 } 1423 1424 /** 1425 * @ticket BP9207 1426 */ 1427 public function test_bp_xprofile_get_signup_field_ids() { 1428 add_filter( 'bp_get_signup_allowed', '__return_true' ); 1429 $signup_test_group = self::factory()->xprofile_group->create(); 1430 1431 $third = self::factory()->xprofile_field->create( 1432 array( 1433 'field_group_id' => $signup_test_group, 1434 'type' => 'textbox', 1435 'name' => 'thirdPosition' 1436 ) 1437 ); 1438 1439 $first = self::factory()->xprofile_field->create( 1440 array( 1441 'field_group_id' => $signup_test_group, 1442 'type' => 'textbox', 1443 'name' => 'firstPosition' 1444 ) 1445 ); 1446 1447 $tenth = self::factory()->xprofile_field->create( 1448 array( 1449 'field_group_id' => $signup_test_group, 1450 'type' => 'textbox', 1451 'name' => 'tenthPosition' 1452 ) 1453 ); 1454 1455 // Set order. 1456 bp_xprofile_update_field_meta( $first, 'signup_position', 1 ); 1457 bp_xprofile_update_field_meta( 1, 'signup_position', 2 ); 1458 bp_xprofile_update_field_meta( $third, 'signup_position', 3 ); 1459 bp_xprofile_update_field_meta( $tenth, 'signup_position', 10 ); 1460 1461 $this->assertSame( bp_xprofile_get_signup_field_ids(), array( $first, 1, $third, $tenth ) ); 1462 1463 xprofile_delete_field_group( $signup_test_group ); 1464 remove_filter( 'bp_get_signup_allowed', '__return_true' ); 1465 } 1423 1466 }
Note: See TracChangeset
for help on using the changeset viewer.