| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Deprecated functions from WordPress MU and the multisite feature. You shouldn't 4 * use these functions and look for the alternatives instead. The functions will be 5 * removed in a later version. 6 * 7 * @package WordPress 8 * @subpackage Deprecated 9 * @since 3.0.0 10 */ 11 12 /* 13 * Deprecated functions come here to die. 14 */ 15 16 /** 17 * Get the "dashboard blog", the blog where users without a blog edit their profile data. 18 * Dashboard blog functionality was removed in WordPress 3.1, replaced by the user admin. 19 * 20 * @since MU (3.0.0) 21 * @deprecated 3.1.0 Use get_site() 22 * @see get_site() 23 * 24 * @return WP_Site Current site object. 25 */ 26 function get_dashboard_blog() { 27 _deprecated_function( __FUNCTION__, '3.1.0', 'get_site()' ); 28 if ( $blog = get_site_option( 'dashboard_blog' ) ) { 29 return get_site( $blog ); 30 } 31 32 return get_site( get_network()->site_id ); 33 } 34 35 /** 36 * Generates a random password. 37 * 38 * @since MU (3.0.0) 39 * @deprecated 3.0.0 Use wp_generate_password() 40 * @see wp_generate_password() 41 * 42 * @param int $len Optional. The length of password to generate. Default 8. 43 */ 44 function generate_random_password( $len = 8 ) { 45 _deprecated_function( __FUNCTION__, '3.0.0', 'wp_generate_password()' ); 46 return wp_generate_password( $len ); 47 } 48 49 /** 50 * Determine if user is a site admin. 51 * 52 * Plugins should use is_multisite() instead of checking if this function exists 53 * to determine if multisite is enabled. 54 * 55 * This function must reside in a file included only if is_multisite() due to 56 * legacy function_exists() checks to determine if multisite is enabled. 57 * 58 * @since MU (3.0.0) 59 * @deprecated 3.0.0 Use is_super_admin() 60 * @see is_super_admin() 61 * 62 * @param string $user_login Optional. Username for the user to check. Default empty. 63 */ 64 function is_site_admin( $user_login = '' ) { 65 _deprecated_function( __FUNCTION__, '3.0.0', 'is_super_admin()' ); 66 67 if ( empty( $user_login ) ) { 68 $user_id = get_current_user_id(); 69 if ( !$user_id ) 70 return false; 71 } else { 72 $user = get_user_by( 'login', $user_login ); 73 if ( ! $user->exists() ) 74 return false; 75 $user_id = $user->ID; 76 } 77 78 return is_super_admin( $user_id ); 79 } 80 81 if ( !function_exists( 'graceful_fail' ) ) : 82 /** 83 * Deprecated functionality to gracefully fail. 84 * 85 * @since MU (3.0.0) 86 * @deprecated 3.0.0 Use wp_die() 87 * @see wp_die() 88 * 89 * @return never 90 */ 91 function graceful_fail( $message ) { 92 _deprecated_function( __FUNCTION__, '3.0.0', 'wp_die()' ); 93 $message = apply_filters( 'graceful_fail', $message ); 94 $message_template = apply_filters( 'graceful_fail_template', 95 '<!DOCTYPE html> 96 <html><head> 97 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 98 <title>Error!</title> 99 <style> 100 img { 101 border: 0; 102 } 103 body { 104 line-height: 1.6em; font-family: Georgia, serif; width: 390px; margin: auto; 105 text-align: center; 106 } 107 .message { 108 font-size: 22px; 109 width: 350px; 110 margin: auto; 111 } 112 </style> 113 </head> 114 <body> 115 <p class="message">%s</p> 116 </body> 117 </html>' ); 118 die( sprintf( $message_template, $message ) ); 119 } 120 endif; 121 122 /** 123 * Deprecated functionality to retrieve user information. 124 * 125 * @since MU (3.0.0) 126 * @deprecated 3.0.0 Use get_user_by() 127 * @see get_user_by() 128 * 129 * @param string $username Username. 130 */ 131 function get_user_details( $username ) { 132 _deprecated_function( __FUNCTION__, '3.0.0', 'get_user_by()' ); 133 return get_user_by('login', $username); 134 } 135 136 /** 137 * Deprecated functionality to clear the global post cache. 138 * 139 * @since MU (3.0.0) 140 * @deprecated 3.0.0 Use clean_post_cache() 141 * @see clean_post_cache() 142 * 143 * @param int $post_id Post ID. 144 */ 145 function clear_global_post_cache( $post_id ) { 146 _deprecated_function( __FUNCTION__, '3.0.0', 'clean_post_cache()' ); 147 } 148 149 /** 150 * Deprecated functionality to determine if the current site is the main site. 151 * 152 * @since MU (3.0.0) 153 * @deprecated 3.0.0 Use is_main_site() 154 * @see is_main_site() 155 */ 156 function is_main_blog() { 157 _deprecated_function( __FUNCTION__, '3.0.0', 'is_main_site()' ); 158 return is_main_site(); 159 } 160 161 /** 162 * Deprecated functionality to validate an email address. 163 * 164 * @since MU (3.0.0) 165 * @deprecated 3.0.0 Use is_email() 166 * @see is_email() 167 * 168 * @param string $email Email address to verify. 169 * @param bool $check_domain Deprecated. 170 * @return string|false Valid email address on success, false on failure. 171 */ 172 function validate_email( $email, $check_domain = true) { 173 _deprecated_function( __FUNCTION__, '3.0.0', 'is_email()' ); 174 return is_email( $email, $check_domain ); 175 } 176 177 /** 178 * Deprecated functionality to retrieve a list of all sites. 179 * 180 * @since MU (3.0.0) 181 * @deprecated 3.0.0 Use wp_get_sites() 182 * @see wp_get_sites() 183 * 184 * @global wpdb $wpdb WordPress database abstraction object. 185 * 186 * @param int $start Optional. Offset for retrieving the blog list. Default 0. 187 * @param int $num Optional. Number of blogs to list. Default 10. 188 * @param string $deprecated Unused. 189 */ 190 function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) { 191 _deprecated_function( __FUNCTION__, '3.0.0', 'wp_get_sites()' ); 192 193 global $wpdb; 194 $blogs = $wpdb->get_results( $wpdb->prepare( "SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", get_current_network_id() ), ARRAY_A ); 195 196 $blog_list = array(); 197 foreach ( (array) $blogs as $details ) { 198 $blog_list[ $details['blog_id'] ] = $details; 199 $blog_list[ $details['blog_id'] ]['postcount'] = $wpdb->get_var( "SELECT COUNT(ID) FROM " . $wpdb->get_blog_prefix( $details['blog_id'] ). "posts WHERE post_status='publish' AND post_type='post'" ); 200 } 201 202 if ( ! $blog_list ) { 203 return array(); 204 } 205 206 if ( 'all' === $num ) { 207 return array_slice( $blog_list, $start, count( $blog_list ) ); 208 } else { 209 return array_slice( $blog_list, $start, $num ); 210 } 211 } 212 213 /** 214 * Deprecated functionality to retrieve a list of the most active sites. 215 * 216 * @since MU (3.0.0) 217 * @deprecated 3.0.0 218 * 219 * @param int $num Optional. Number of activate blogs to retrieve. Default 10. 220 * @param bool $display Optional. Whether or not to display the most active blogs list. Default true. 221 * @return array List of "most active" sites. 222 */ 223 function get_most_active_blogs( $num = 10, $display = true ) { 224 _deprecated_function( __FUNCTION__, '3.0.0' ); 225 226 $blogs = get_blog_list( 0, 'all', false ); // $blog_id -> $details 227 if ( is_array( $blogs ) ) { 228 reset( $blogs ); 229 $most_active = array(); 230 $blog_list = array(); 231 foreach ( (array) $blogs as $key => $details ) { 232 $most_active[ $details['blog_id'] ] = $details['postcount']; 233 $blog_list[ $details['blog_id'] ] = $details; // array_slice() removes keys! 234 } 235 arsort( $most_active ); 236 reset( $most_active ); 237 $t = array(); 238 foreach ( (array) $most_active as $key => $details ) { 239 $t[ $key ] = $blog_list[ $key ]; 240 } 241 unset( $most_active ); 242 $most_active = $t; 243 } 244 245 if ( $display ) { 246 if ( is_array( $most_active ) ) { 247 reset( $most_active ); 248 foreach ( (array) $most_active as $key => $details ) { 249 $url = esc_url('http://' . $details['domain'] . $details['path']); 250 echo '<li>' . $details['postcount'] . " <a href='$url'>$url</a></li>"; 251 } 252 } 253 } 254 return array_slice( $most_active, 0, $num ); 255 } 256 257 /** 258 * Redirect a user based on $_GET or $_POST arguments. 259 * 260 * The function looks for redirect arguments in the following order: 261 * 1) $_GET['ref'] 262 * 2) $_POST['ref'] 263 * 3) $_SERVER['HTTP_REFERER'] 264 * 4) $_GET['redirect'] 265 * 5) $_POST['redirect'] 266 * 6) $url 267 * 268 * @since MU (3.0.0) 269 * @deprecated 3.3.0 Use wp_redirect() 270 * @see wp_redirect() 271 * 272 * @param string $url Optional. Redirect URL. Default empty. 273 * @return never 274 */ 275 function wpmu_admin_do_redirect( $url = '' ) { 276 _deprecated_function( __FUNCTION__, '3.3.0', 'wp_redirect()' ); 277 278 $ref = ''; 279 if ( isset( $_GET['ref'] ) && isset( $_POST['ref'] ) && $_GET['ref'] !== $_POST['ref'] ) { 280 wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 ); 281 } elseif ( isset( $_POST['ref'] ) ) { 282 $ref = $_POST['ref']; 283 } elseif ( isset( $_GET['ref'] ) ) { 284 $ref = $_GET['ref']; 285 } 286 287 if ( $ref ) { 288 $ref = wpmu_admin_redirect_add_updated_param( $ref ); 289 wp_redirect( $ref ); 290 exit; 291 } 292 if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) { 293 wp_redirect( $_SERVER['HTTP_REFERER'] ); 294 exit; 295 } 296 297 $url = wpmu_admin_redirect_add_updated_param( $url ); 298 if ( isset( $_GET['redirect'] ) && isset( $_POST['redirect'] ) && $_GET['redirect'] !== $_POST['redirect'] ) { 299 wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 ); 300 } elseif ( isset( $_GET['redirect'] ) ) { 301 if ( str_starts_with( $_GET['redirect'], 's_' ) ) 302 $url .= '&action=blogs&s='. esc_html( substr( $_GET['redirect'], 2 ) ); 303 } elseif ( isset( $_POST['redirect'] ) ) { 304 $url = wpmu_admin_redirect_add_updated_param( $_POST['redirect'] ); 305 } 306 wp_redirect( $url ); 307 exit; 308 } 309 310 /** 311 * Adds an 'updated=true' argument to a URL. 312 * 313 * @since MU (3.0.0) 314 * @deprecated 3.3.0 Use add_query_arg() 315 * @see add_query_arg() 316 * 317 * @param string $url Optional. Redirect URL. Default empty. 318 * @return string 319 */ 320 function wpmu_admin_redirect_add_updated_param( $url = '' ) { 321 _deprecated_function( __FUNCTION__, '3.3.0', 'add_query_arg()' ); 322 323 if ( ! str_contains( $url, 'updated=true' ) ) { 324 if ( ! str_contains( $url, '?' ) ) 325 return $url . '?updated=true'; 326 else 327 return $url . '&updated=true'; 328 } 329 return $url; 330 } 331 332 /** 333 * Get a numeric user ID from either an email address or a login. 334 * 335 * A numeric string is considered to be an existing user ID 336 * and is simply returned as such. 337 * 338 * @since MU (3.0.0) 339 * @deprecated 3.6.0 Use get_user_by() 340 * @see get_user_by() 341 * 342 * @param string $email_or_login Either an email address or a login. 343 * @return int 344 */ 345 function get_user_id_from_string( $email_or_login ) { 346 _deprecated_function( __FUNCTION__, '3.6.0', 'get_user_by()' ); 347 348 if ( is_email( $email_or_login ) ) 349 $user = get_user_by( 'email', $email_or_login ); 350 elseif ( is_numeric( $email_or_login ) ) 351 return $email_or_login; 352 else 353 $user = get_user_by( 'login', $email_or_login ); 354 355 if ( $user ) 356 return $user->ID; 357 return 0; 358 } 359 360 /** 361 * Get a full site URL, given a domain and a path. 362 * 363 * @since MU (3.0.0) 364 * @deprecated 3.7.0 365 * 366 * @param string $domain 367 * @param string $path 368 * @return string 369 */ 370 function get_blogaddress_by_domain( $domain, $path ) { 371 _deprecated_function( __FUNCTION__, '3.7.0' ); 372 373 if ( is_subdomain_install() ) { 374 $url = "http://" . $domain.$path; 375 } else { 376 if ( $domain != $_SERVER['HTTP_HOST'] ) { 377 $blogname = substr( $domain, 0, strpos( $domain, '.' ) ); 378 $url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path; 379 // We're not installing the main blog. 380 if ( 'www.' !== $blogname ) 381 $url .= $blogname . '/'; 382 } else { // Main blog. 383 $url = 'http://' . $domain . $path; 384 } 385 } 386 return sanitize_url( $url ); 387 } 388 389 /** 390 * Create an empty blog. 391 * 392 * @since MU (3.0.0) 393 * @deprecated 4.4.0 394 * 395 * @param string $domain The new blog's domain. 396 * @param string $path The new blog's path. 397 * @param string $weblog_title The new blog's title. 398 * @param int $site_id Optional. Defaults to 1. 399 * @return string|int The ID of the newly created blog 400 */ 401 function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) { 402 _deprecated_function( __FUNCTION__, '4.4.0' ); 403 404 if ( empty($path) ) 405 $path = '/'; 406 407 // Check if the domain has been used already. We should return an error message. 408 if ( domain_exists($domain, $path, $site_id) ) 409 return __( '<strong>Error:</strong> Site URL you’ve entered is already taken.' ); 410 411 /* 412 * Need to back up wpdb table names, and create a new wp_blogs entry for new blog. 413 * Need to get blog_id from wp_blogs, and create new table names. 414 * Must restore table names at the end of function. 415 */ 416 417 if ( ! $blog_id = insert_blog($domain, $path, $site_id) ) 418 return __( '<strong>Error:</strong> There was a problem creating site entry.' ); 419 420 switch_to_blog($blog_id); 421 install_blog($blog_id); 422 restore_current_blog(); 423 424 return $blog_id; 425 } 426 427 /** 428 * Get the admin for a domain/path combination. 429 * 430 * @since MU (3.0.0) 431 * @deprecated 4.4.0 432 * 433 * @global wpdb $wpdb WordPress database abstraction object. 434 * 435 * @param string $domain Optional. Network domain. 436 * @param string $path Optional. Network path. 437 * @return array|false The network admins. 438 */ 439 function get_admin_users_for_domain( $domain = '', $path = '' ) { 440 _deprecated_function( __FUNCTION__, '4.4.0' ); 441 442 global $wpdb; 443 444 if ( ! $domain ) { 445 $network_id = get_current_network_id(); 446 } else { 447 $_networks = get_networks( array( 448 'fields' => 'ids', 449 'number' => 1, 450 'domain' => $domain, 451 'path' => $path, 452 ) ); 453 $network_id = ! empty( $_networks ) ? array_shift( $_networks ) : 0; 454 } 455 456 if ( $network_id ) 457 return $wpdb->get_results( $wpdb->prepare( "SELECT u.ID, u.user_login, u.user_pass FROM $wpdb->users AS u, $wpdb->sitemeta AS sm WHERE sm.meta_key = 'admin_user_id' AND u.ID = sm.meta_value AND sm.site_id = %d", $network_id ), ARRAY_A ); 458 459 return false; 460 } 461 462 /** 463 * Return an array of sites for a network or networks. 464 * 465 * @since 3.7.0 466 * @deprecated 4.6.0 Use get_sites() 467 * @see get_sites() 468 * 469 * @param array $args { 470 * Array of default arguments. Optional. 471 * 472 * @type int|int[] $network_id A network ID or array of network IDs. Set to null to retrieve sites 473 * from all networks. Defaults to current network ID. 474 * @type int $public Retrieve public or non-public sites. Default null, for any. 475 * @type int $archived Retrieve archived or non-archived sites. Default null, for any. 476 * @type int $mature Retrieve mature or non-mature sites. Default null, for any. 477 * @type int $spam Retrieve spam or non-spam sites. Default null, for any. 478 * @type int $deleted Retrieve deleted or non-deleted sites. Default null, for any. 479 * @type int $limit Number of sites to limit the query to. Default 100. 480 * @type int $offset Exclude the first x sites. Used in combination with the $limit parameter. Default 0. 481 * } 482 * @return array[] An empty array if the installation is considered "large" via wp_is_large_network(). Otherwise, 483 * an associative array of WP_Site data as arrays. 484 */ 485 function wp_get_sites( $args = array() ) { 486 _deprecated_function( __FUNCTION__, '4.6.0', 'get_sites()' ); 487 488 if ( wp_is_large_network() ) 489 return array(); 490 491 $defaults = array( 492 'network_id' => get_current_network_id(), 493 'public' => null, 494 'archived' => null, 495 'mature' => null, 496 'spam' => null, 497 'deleted' => null, 498 'limit' => 100, 499 'offset' => 0, 500 ); 501 502 $args = wp_parse_args( $args, $defaults ); 503 504 // Backward compatibility. 505 if( is_array( $args['network_id'] ) ){ 506 $args['network__in'] = $args['network_id']; 507 $args['network_id'] = null; 508 } 509 510 if( is_numeric( $args['limit'] ) ){ 511 $args['number'] = $args['limit']; 512 $args['limit'] = null; 513 } elseif ( ! $args['limit'] ) { 514 $args['number'] = 0; 515 $args['limit'] = null; 516 } 517 518 // Make sure count is disabled. 519 $args['count'] = false; 520 521 $_sites = get_sites( $args ); 522 523 $results = array(); 524 525 foreach ( $_sites as $_site ) { 526 $_site = get_site( $_site ); 527 $results[] = $_site->to_array(); 528 } 529 530 return $results; 531 } 532 533 /** 534 * Check whether a usermeta key has to do with the current blog. 535 * 536 * @since MU (3.0.0) 537 * @deprecated 4.9.0 538 * 539 * @global wpdb $wpdb WordPress database abstraction object. 540 * 541 * @param string $key 542 * @param int $user_id Optional. Defaults to current user. 543 * @param int $blog_id Optional. Defaults to current blog. 544 * @return bool 545 */ 546 function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) { 547 global $wpdb; 548 549 _deprecated_function( __FUNCTION__, '4.9.0' ); 550 551 $current_user = wp_get_current_user(); 552 if ( $blog_id == 0 ) { 553 $blog_id = get_current_blog_id(); 554 } 555 $local_key = $wpdb->get_blog_prefix( $blog_id ) . $key; 556 557 return isset( $current_user->$local_key ); 558 } 559 560 /** 561 * Store basic site info in the blogs table. 562 * 563 * This function creates a row in the wp_blogs table and returns 564 * the new blog's ID. It is the first step in creating a new blog. 565 * 566 * @since MU (3.0.0) 567 * @deprecated 5.1.0 Use wp_insert_site() 568 * @see wp_insert_site() 569 * 570 * @param string $domain The domain of the new site. 571 * @param string $path The path of the new site. 572 * @param int $site_id Unless you're running a multi-network install, be sure to set this value to 1. 573 * @return int|false The ID of the new row 574 */ 575 function insert_blog($domain, $path, $site_id) { 576 _deprecated_function( __FUNCTION__, '5.1.0', 'wp_insert_site()' ); 577 578 $data = array( 579 'domain' => $domain, 580 'path' => $path, 581 'site_id' => $site_id, 582 ); 583 584 $site_id = wp_insert_site( $data ); 585 if ( is_wp_error( $site_id ) ) { 586 return false; 587 } 588 589 clean_blog_cache( $site_id ); 590 591 return $site_id; 592 } 593 594 /** 595 * Install an empty blog. 596 * 597 * Creates the new blog tables and options. If calling this function 598 * directly, be sure to use switch_to_blog() first, so that $wpdb 599 * points to the new blog. 600 * 601 * @since MU (3.0.0) 602 * @deprecated 5.1.0 603 * 604 * @global wpdb $wpdb WordPress database abstraction object. 605 * @global WP_Roles $wp_roles WordPress role management object. 606 * 607 * @param int $blog_id The value returned by wp_insert_site(). 608 * @param string $blog_title The title of the new site. 609 */ 610 function install_blog( $blog_id, $blog_title = '' ) { 611 global $wpdb, $wp_roles; 612 613 _deprecated_function( __FUNCTION__, '5.1.0' ); 614 615 // Cast for security. 616 $blog_id = (int) $blog_id; 617 618 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 619 620 $suppress = $wpdb->suppress_errors(); 621 if ( $wpdb->get_results( "DESCRIBE {$wpdb->posts}" ) ) { 622 die( '<h1>' . __( 'Already Installed' ) . '</h1><p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p></body></html>' ); 623 } 624 $wpdb->suppress_errors( $suppress ); 625 626 $url = get_blogaddress_by_id( $blog_id ); 627 628 // Set everything up. 629 make_db_current_silent( 'blog' ); 630 populate_options(); 631 populate_roles(); 632 633 // populate_roles() clears previous role definitions so we start over. 634 $wp_roles = new WP_Roles(); 635 636 $siteurl = $home = untrailingslashit( $url ); 637 638 if ( ! is_subdomain_install() ) { 639 640 if ( 'https' === parse_url( get_site_option( 'siteurl' ), PHP_URL_SCHEME ) ) { 641 $siteurl = set_url_scheme( $siteurl, 'https' ); 642 } 643 if ( 'https' === parse_url( get_home_url( get_network()->site_id ), PHP_URL_SCHEME ) ) { 644 $home = set_url_scheme( $home, 'https' ); 645 } 646 } 647 648 update_option( 'siteurl', $siteurl ); 649 update_option( 'home', $home ); 650 651 if ( get_site_option( 'ms_files_rewriting' ) ) { 652 update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" ); 653 } else { 654 update_option( 'upload_path', get_blog_option( get_network()->site_id, 'upload_path' ) ); 655 } 656 657 update_option( 'blogname', wp_unslash( $blog_title ) ); 658 update_option( 'admin_email', '' ); 659 660 // Remove all permissions. 661 $table_prefix = $wpdb->get_blog_prefix(); 662 delete_metadata( 'user', 0, $table_prefix . 'user_level', null, true ); // Delete all. 663 delete_metadata( 'user', 0, $table_prefix . 'capabilities', null, true ); // Delete all. 664 } 665 666 /** 667 * Set blog defaults. 668 * 669 * This function creates a row in the wp_blogs table. 670 * 671 * @since MU (3.0.0) 672 * @deprecated MU 673 * @deprecated Use wp_install_defaults() 674 * 675 * @global wpdb $wpdb WordPress database abstraction object. 676 * 677 * @param int $blog_id Ignored in this function. 678 * @param int $user_id 679 */ 680 function install_blog_defaults( $blog_id, $user_id ) { 681 global $wpdb; 682 683 _deprecated_function( __FUNCTION__, 'MU' ); 684 685 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 686 687 $suppress = $wpdb->suppress_errors(); 688 689 wp_install_defaults( $user_id ); 690 691 $wpdb->suppress_errors( $suppress ); 692 } 693 694 /** 695 * Update the status of a user in the database. 696 * 697 * Previously used in core to mark a user as spam or "ham" (not spam) in Multisite. 698 * 699 * @since 3.0.0 700 * @since 3.0.2 Deprecated fourth argument. 701 * @deprecated 5.3.0 Use wp_update_user() 702 * @see wp_update_user() 703 * 704 * @global wpdb $wpdb WordPress database abstraction object. 705 * 706 * @param int $id The user ID. 707 * @param string $pref The column in the wp_users table to update the user's status 708 * in (presumably user_status, spam, or deleted). 709 * @param int $value The new status for the user. 710 * @param mixed $deprecated Not used. 711 * @return int The initially passed $value. 712 */ 713 function update_user_status( $id, $pref, $value, $deprecated = null ) { 714 global $wpdb; 715 716 _deprecated_function( __FUNCTION__, '5.3.0', 'wp_update_user()' ); 717 718 if ( null !== $deprecated ) { 719 _deprecated_argument( __FUNCTION__, '3.0.2' ); 720 } 721 722 $wpdb->update( $wpdb->users, array( sanitize_key( $pref ) => $value ), array( 'ID' => $id ) ); 723 724 $user = new WP_User( $id ); 725 clean_user_cache( $user ); 726 727 if ( 'spam' === $pref ) { 728 if ( $value == 1 ) { 729 /** This filter is documented in wp-includes/user.php */ 730 do_action( 'make_spam_user', $id ); 731 } else { 732 /** This filter is documented in wp-includes/user.php */ 733 do_action( 'make_ham_user', $id ); 734 } 735 } 736 737 return $value; 738 } 739 740 /** 741 * Maintains a canonical list of terms by syncing terms created for each blog with the global terms table. 742 * 743 * @since 3.0.0 744 * @since 6.1.0 This function no longer does anything. 745 * @deprecated 6.1.0 746 * 747 * @param int $term_id An ID for a term on the current blog. 748 * @param string $deprecated Not used. 749 * @return int An ID from the global terms table mapped from $term_id. 750 */ 751 function global_terms( $term_id, $deprecated = '' ) { 752 _deprecated_function( __FUNCTION__, '6.1.0' ); 753 754 return $term_id; 755 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Sat Jul 25 08:20:20 2026 | Cross-referenced by PHPXref |