Changeset 9053 for trunk/wp-admin/includes/user.php
- Timestamp:
- 10/02/2008 01:03:26 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/user.php
r8944 r9053 1 1 <?php 2 3 // Creates a new user from the "Users" form using $_POST information. 2 /** 3 * WordPress user administration API. 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 8 9 /** 10 * Creates a new user from the "Users" form using $_POST information. 11 * 12 * {@internal Missing Long Description}} 13 * 14 * @since unknown 15 * 16 * @param int $user_id Optional. User ID. 17 * @return null|WP_Error|int Null when adding user, WP_Error or User ID integer when no parameters. 18 */ 4 19 function add_user() { 5 20 if ( func_num_args() ) { // The hackiest hack that ever did hack … … 19 34 } 20 35 36 /** 37 * {@internal Missing Short Description}} 38 * 39 * {@internal Missing Long Description}} 40 * 41 * @since unknown 42 * 43 * @param int $user_id Optional. User ID. 44 * @return unknown 45 */ 21 46 function edit_user( $user_id = 0 ) { 22 47 global $current_user, $wp_roles, $wpdb; … … 143 168 } 144 169 170 /** 171 * {@internal Missing Short Description}} 172 * 173 * {@internal Missing Long Description}} 174 * 175 * @since unknown 176 * 177 * @return array List of user IDs. 178 */ 145 179 function get_author_user_ids() { 146 180 global $wpdb; … … 149 183 } 150 184 185 /** 186 * {@internal Missing Short Description}} 187 * 188 * {@internal Missing Long Description}} 189 * 190 * @since unknown 191 * 192 * @param int $user_id User ID. 193 * @return array|bool List of editable authors. False if no editable users. 194 */ 151 195 function get_editable_authors( $user_id ) { 152 196 global $wpdb; … … 164 208 } 165 209 210 /** 211 * {@internal Missing Short Description}} 212 * 213 * {@internal Missing Long Description}} 214 * 215 * @since unknown 216 * 217 * @param int $user_id User ID. 218 * @param bool $exclude_zeros Optional, default is true. Whether to exclude zeros. 219 * @return unknown 220 */ 166 221 function get_editable_user_ids( $user_id, $exclude_zeros = true ) { 167 222 global $wpdb; … … 185 240 } 186 241 242 /** 243 * {@internal Missing Short Description}} 244 * 245 * {@internal Missing Long Description}} 246 * 247 * @since unknown 248 * 249 * @return unknown 250 */ 187 251 function get_nonauthor_user_ids() { 188 252 global $wpdb; … … 192 256 } 193 257 258 /** 259 * Retrieve editable posts from other users. 260 * 261 * @since unknown 262 * 263 * @param int $user_id User ID to not retrieve posts from. 264 * @param string $type Optional, defaults to 'any'. Post type to retrieve, can be 'draft' or 'pending'. 265 * @return array List of posts from others. 266 */ 194 267 function get_others_unpublished_posts($user_id, $type='any') { 195 268 global $wpdb; … … 214 287 } 215 288 289 /** 290 * Retrieve drafts from other users. 291 * 292 * @since unknown 293 * 294 * @param int $user_id User ID. 295 * @return array List of drafts from other users. 296 */ 216 297 function get_others_drafts($user_id) { 217 298 return get_others_unpublished_posts($user_id, 'draft'); 218 299 } 219 300 301 /** 302 * Retrieve pending review posts from other users. 303 * 304 * @since unknown 305 * 306 * @param int $user_id User ID. 307 * @return array List of posts with pending review post type from other users. 308 */ 220 309 function get_others_pending($user_id) { 221 310 return get_others_unpublished_posts($user_id, 'pending'); 222 311 } 223 312 313 /** 314 * Retrieve user data and filter it. 315 * 316 * @since unknown 317 * 318 * @param int $user_id User ID. 319 * @return object WP_User object with user data. 320 */ 224 321 function get_user_to_edit( $user_id ) { 225 322 $user = new WP_User( $user_id ); … … 239 336 } 240 337 338 /** 339 * Retrieve the user's drafts. 340 * 341 * @since unknown 342 * 343 * @param int $user_id User ID. 344 * @return array 345 */ 241 346 function get_users_drafts( $user_id ) { 242 347 global $wpdb; … … 246 351 } 247 352 353 /** 354 * Remove user and optionally reassign posts and links to another user. 355 * 356 * If the $reassign parameter is not assigned to an User ID, then all posts will 357 * be deleted of that user. The action 'delete_user' that is passed the User ID 358 * being deleted will be run after the posts are either reassigned or deleted. 359 * The user meta will also be deleted that are for that User ID. 360 * 361 * @since unknown 362 * 363 * @param int $id User ID. 364 * @param int $reassign Optional. Reassign posts and links to new User ID. 365 * @return bool True when finished. 366 */ 248 367 function wp_delete_user($id, $reassign = 'novalue') { 249 368 global $wpdb; … … 280 399 } 281 400 401 /** 402 * Remove all capabilities from user. 403 * 404 * @since unknown 405 * 406 * @param int $id User ID. 407 */ 282 408 function wp_revoke_user($id) { 283 409 $id = (int) $id; … … 287 413 } 288 414 289 // WP_User_Search class290 // by Mark Jaquith291 292 415 if ( !class_exists('WP_User_Search') ) : 416 /** 417 * WordPress User Search class. 418 * 419 * @since unknown 420 * @author Mark Jaquith 421 */ 293 422 class WP_User_Search { 423 424 /** 425 * {@internal Missing Description}} 426 * 427 * @since unknown 428 * @access private 429 * @var unknown_type 430 */ 294 431 var $results; 432 433 /** 434 * {@internal Missing Description}} 435 * 436 * @since unknown 437 * @access private 438 * @var unknown_type 439 */ 295 440 var $search_term; 441 442 /** 443 * Page number. 444 * 445 * @since unknown 446 * @access private 447 * @var int 448 */ 296 449 var $page; 450 451 /** 452 * Role name that users have. 453 * 454 * @since unknown 455 * @access private 456 * @var string 457 */ 297 458 var $role; 459 460 /** 461 * Raw page number. 462 * 463 * @since unknown 464 * @access private 465 * @var int|bool 466 */ 298 467 var $raw_page; 468 469 /** 470 * Amount of users to display per page. 471 * 472 * @since unknown 473 * @access public 474 * @var int 475 */ 299 476 var $users_per_page = 50; 477 478 /** 479 * {@internal Missing Description}} 480 * 481 * @since unknown 482 * @access private 483 * @var unknown_type 484 */ 300 485 var $first_user; 486 487 /** 488 * {@internal Missing Description}} 489 * 490 * @since unknown 491 * @access private 492 * @var int 493 */ 301 494 var $last_user; 495 496 /** 497 * {@internal Missing Description}} 498 * 499 * @since unknown 500 * @access private 501 * @var unknown_type 502 */ 302 503 var $query_limit; 504 505 /** 506 * {@internal Missing Description}} 507 * 508 * @since unknown 509 * @access private 510 * @var unknown_type 511 */ 303 512 var $query_sort; 513 514 /** 515 * {@internal Missing Description}} 516 * 517 * @since unknown 518 * @access private 519 * @var unknown_type 520 */ 304 521 var $query_from_where; 522 523 /** 524 * {@internal Missing Description}} 525 * 526 * @since unknown 527 * @access private 528 * @var int 529 */ 305 530 var $total_users_for_query = 0; 531 532 /** 533 * {@internal Missing Description}} 534 * 535 * @since unknown 536 * @access private 537 * @var bool 538 */ 306 539 var $too_many_total_users = false; 540 541 /** 542 * {@internal Missing Description}} 543 * 544 * @since unknown 545 * @access private 546 * @var unknown_type 547 */ 307 548 var $search_errors; 549 550 /** 551 * {@internal Missing Description}} 552 * 553 * @since unknown 554 * @access private 555 * @var unknown_type 556 */ 308 557 var $paging_text; 309 558 310 function WP_User_Search ($search_term = '', $page = '', $role = '') { // constructor 559 /** 560 * PHP4 Constructor - Sets up the object properties. 561 * 562 * @since unknown 563 * 564 * @param string $search_term Search terms string. 565 * @param int $page Optional. Page ID. 566 * @param string $role Role name. 567 * @return WP_User_Search 568 */ 569 function WP_User_Search ($search_term = '', $page = '', $role = '') { 311 570 $this->search_term = $search_term; 312 571 $this->raw_page = ( '' == $page ) ? false : (int) $page; … … 320 579 } 321 580 581 /** 582 * {@internal Missing Short Description}} 583 * 584 * {@internal Missing Long Description}} 585 * 586 * @since unknown 587 * @access public 588 */ 322 589 function prepare_query() { 323 590 global $wpdb; … … 344 611 } 345 612 613 /** 614 * {@internal Missing Short Description}} 615 * 616 * {@internal Missing Long Description}} 617 * 618 * @since unknown 619 * @access public 620 */ 346 621 function query() { 347 622 global $wpdb; … … 354 629 } 355 630 631 /** 632 * {@internal Missing Short Description}} 633 * 634 * {@internal Missing Long Description}} 635 * 636 * @since unknown 637 * @access public 638 */ 356 639 function prepare_vars_for_template_usage() { 357 640 $this->search_term = stripslashes($this->search_term); // done with DB, from now on we want slashes gone 358 641 } 359 642 643 /** 644 * {@internal Missing Short Description}} 645 * 646 * {@internal Missing Long Description}} 647 * 648 * @since unknown 649 * @access public 650 */ 360 651 function do_paging() { 361 652 if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results … … 376 667 } 377 668 669 /** 670 * {@internal Missing Short Description}} 671 * 672 * {@internal Missing Long Description}} 673 * 674 * @since unknown 675 * @access public 676 * 677 * @return unknown 678 */ 378 679 function get_results() { 379 680 return (array) $this->results; 380 681 } 381 682 683 /** 684 * Displaying paging text. 685 * 686 * @see do_paging() Builds paging text. 687 * 688 * @since unknown 689 * @access public 690 */ 382 691 function page_links() { 383 692 echo $this->paging_text; 384 693 } 385 694 695 /** 696 * Whether paging is enabled. 697 * 698 * @see do_paging() Builds paging text. 699 * 700 * @since unknown 701 * @access public 702 * 703 * @return bool 704 */ 386 705 function results_are_paged() { 387 706 if ( $this->paging_text ) … … 390 709 } 391 710 711 /** 712 * Whether there are search terms. 713 * 714 * @since unknown 715 * @access public 716 * 717 * @return bool 718 */ 392 719 function is_search() { 393 720 if ( $this->search_term )
Note: See TracChangeset
for help on using the changeset viewer.