[ Index ] |
PHP Cross Reference of BuddyPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Signups Management class. 4 * 5 * @package BuddyPress 6 * @subpackage coreClasses 7 * @since 2.0.0 8 */ 9 10 /** 11 * Class used to handle Signups. 12 * 13 * @since 2.0.0 14 */ 15 class BP_Signup { 16 17 /** 18 * ID of the signup which the object relates to. 19 * 20 * @since 2.0.0 21 * @var integer 22 */ 23 public $id; 24 25 /** 26 * The URL to the full size of the avatar for the user. 27 * 28 * @since 2.0.0 29 * @var string 30 */ 31 public $avatar; 32 33 /** 34 * The username for the user. 35 * 36 * @since 2.0.0 37 * @var string 38 */ 39 public $user_login; 40 41 /** 42 * The email for the user. 43 * 44 * @since 2.0.0 45 * @var string 46 */ 47 public $user_email; 48 49 /** 50 * The full name of the user. 51 * 52 * @since 2.0.0 53 * @var string 54 */ 55 public $user_name; 56 57 /** 58 * Metadata associated with the signup. 59 * 60 * @since 2.0.0 61 * @var array 62 */ 63 public $meta; 64 65 /** 66 * The registered date for the user. 67 * 68 * @since 2.0.0 69 * @var string 70 */ 71 public $registered; 72 73 /** 74 * The activation key for the user. 75 * 76 * @since 2.0.0 77 * @var string 78 */ 79 public $activation_key; 80 81 82 /** Public Methods *******************************************************/ 83 84 /** 85 * Class constructor. 86 * 87 * @since 2.0.0 88 * 89 * @param integer $signup_id The ID for the signup being queried. 90 */ 91 public function __construct( $signup_id = 0 ) { 92 if ( !empty( $signup_id ) ) { 93 $this->id = $signup_id; 94 $this->populate(); 95 } 96 } 97 98 /** 99 * Populate the instantiated class with data based on the signup_id provided. 100 * 101 * @since 2.0.0 102 */ 103 public function populate() { 104 global $wpdb; 105 106 $signups_table = buddypress()->members->table_name_signups; 107 $signup = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$signups_table} WHERE signup_id = %d AND active = 0", $this->id ) ); 108 109 $this->avatar = get_avatar( $signup->user_email, 32 ); 110 $this->user_login = $signup->user_login; 111 $this->user_email = $signup->user_email; 112 $this->meta = maybe_unserialize( $signup->meta ); 113 $this->user_name = ! empty( $this->meta['field_1'] ) ? wp_unslash( $this->meta['field_1'] ) : ''; 114 $this->registered = $signup->registered; 115 $this->activation_key = $signup->activation_key; 116 } 117 118 /** Static Methods *******************************************************/ 119 120 /** 121 * Fetch signups based on parameters. 122 * 123 * @since 2.0.0 124 * @since 6.0.0 Added a list of allowed orderby parameters. 125 * 126 * @param array $args { 127 * The argument to retrieve desired signups. 128 * @type int $offset Offset amount. Default 0. 129 * @type int $number How many to fetch. Default 1. 130 * @type bool|string $usersearch Whether or not to search for a username. Default false. 131 * @type string $orderby Order By parameter. Possible values are `signup_id`, `login`, `email`, 132 * `registered`, `activated`. Default `signup_id`. 133 * @type string $order Order direction. Default 'DESC'. 134 * @type bool $include Whether or not to include more specific query params. 135 * @type string $activation_key Activation key to search for. 136 * @type string $user_login Specific user login to return. 137 * @type string $fields Which fields to return. Specify 'ids' to fetch a list of signups IDs. 138 * Default: 'all' (return BP_Signup objects). 139 * } 140 * @return array { 141 * @type array $signups Located signups. (IDs only if `fields` is set to `ids`.) 142 * @type int $total Total number of signups matching params. 143 * } 144 */ 145 public static function get( $args = array() ) { 146 global $wpdb; 147 148 $r = bp_parse_args( $args, 149 array( 150 'offset' => 0, 151 'number' => 1, 152 'usersearch' => false, 153 'orderby' => 'signup_id', 154 'order' => 'DESC', 155 'include' => false, 156 'activation_key' => '', 157 'user_login' => '', 158 'fields' => 'all', 159 ), 160 'bp_core_signups_get_args' 161 ); 162 163 // Make sure the orderby clause is allowed. 164 if ( ! in_array( $r['orderby'], array( 'login', 'email', 'registered', 'activated' ), true ) ) { 165 $r['orderby'] = 'signup_id'; 166 } 167 168 if ( 'login' === $r['orderby'] || 'email' === $r['orderby'] ) { 169 $r['orderby'] = 'user_' . $r['orderby']; 170 } 171 172 $r['orderby'] = sanitize_title( $r['orderby'] ); 173 174 $sql = array(); 175 $signups_table = buddypress()->members->table_name_signups; 176 $sql['select'] = "SELECT * FROM {$signups_table}"; 177 $sql['where'] = array(); 178 $sql['where'][] = "active = 0"; 179 180 if ( empty( $r['include'] ) ) { 181 182 // Search terms. 183 if ( ! empty( $r['usersearch'] ) ) { 184 $search_terms_like = '%' . bp_esc_like( $r['usersearch'] ) . '%'; 185 $sql['where'][] = $wpdb->prepare( "( user_login LIKE %s OR user_email LIKE %s OR meta LIKE %s )", $search_terms_like, $search_terms_like, $search_terms_like ); 186 } 187 188 // Activation key. 189 if ( ! empty( $r['activation_key'] ) ) { 190 $sql['where'][] = $wpdb->prepare( "activation_key = %s", $r['activation_key'] ); 191 } 192 193 // User login. 194 if ( ! empty( $r['user_login'] ) ) { 195 $sql['where'][] = $wpdb->prepare( "user_login = %s", $r['user_login'] ); 196 } 197 198 $sql['orderby'] = "ORDER BY {$r['orderby']}"; 199 $sql['order'] = bp_esc_sql_order( $r['order'] ); 200 $sql['limit'] = $wpdb->prepare( "LIMIT %d, %d", $r['offset'], $r['number'] ); 201 } else { 202 $in = implode( ',', wp_parse_id_list( $r['include'] ) ); 203 $sql['in'] = "AND signup_id IN ({$in})"; 204 } 205 206 // Implode WHERE clauses. 207 $sql['where'] = 'WHERE ' . implode( ' AND ', $sql['where'] ); 208 209 /** 210 * Filters the Signups paged query. 211 * 212 * @since 2.0.0 213 * 214 * @param string $value SQL statement. 215 * @param array $sql Array of SQL statement parts. 216 * @param array $args Array of original arguments for get() method. 217 * @param array $r Array of parsed arguments for get() method. 218 */ 219 $paged_signups = $wpdb->get_results( apply_filters( 'bp_members_signups_paged_query', join( ' ', $sql ), $sql, $args, $r ) ); 220 221 if ( empty( $paged_signups ) ) { 222 return array( 'signups' => false, 'total' => false ); 223 } 224 225 // We only want the IDs. 226 if ( 'ids' === $r['fields'] ) { 227 $paged_signups = wp_list_pluck( $paged_signups, 'signup_id' ); 228 } else { 229 230 // Used to calculate a diff between now & last 231 // time an activation link has been resent. 232 $now = current_time( 'timestamp', true ); 233 234 foreach ( (array) $paged_signups as $key => $signup ) { 235 236 $signup->id = intval( $signup->signup_id ); 237 238 $signup->meta = ! empty( $signup->meta ) ? maybe_unserialize( $signup->meta ) : false; 239 240 $signup->user_name = ''; 241 if ( ! empty( $signup->meta['field_1'] ) ) { 242 $signup->user_name = wp_unslash( $signup->meta['field_1'] ); 243 } 244 245 // Sent date defaults to date of registration. 246 if ( ! empty( $signup->meta['sent_date'] ) ) { 247 $signup->date_sent = $signup->meta['sent_date']; 248 } else { 249 $signup->date_sent = $signup->registered; 250 } 251 252 $sent_at = mysql2date('U', $signup->date_sent ); 253 $diff = $now - $sent_at; 254 255 /** 256 * Add a boolean in case the last time an activation link 257 * has been sent happened less than a day ago. 258 */ 259 if ( $diff < 1 * DAY_IN_SECONDS ) { 260 $signup->recently_sent = true; 261 } 262 263 if ( ! empty( $signup->meta['count_sent'] ) ) { 264 $signup->count_sent = absint( $signup->meta['count_sent'] ); 265 } else { 266 $signup->count_sent = 1; 267 } 268 269 $paged_signups[ $key ] = $signup; 270 } 271 } 272 273 unset( $sql['limit'] ); 274 $sql['select'] = preg_replace( "/SELECT.*?FROM/", "SELECT COUNT(*) FROM", $sql['select'] ); 275 276 /** 277 * Filters the Signups count query. 278 * 279 * @since 2.0.0 280 * 281 * @param string $value SQL statement. 282 * @param array $sql Array of SQL statement parts. 283 * @param array $args Array of original arguments for get() method. 284 * @param array $r Array of parsed arguments for get() method. 285 */ 286 $total_signups = $wpdb->get_var( apply_filters( 'bp_members_signups_count_query', join( ' ', $sql ), $sql, $args, $r ) ); 287 288 return array( 'signups' => $paged_signups, 'total' => $total_signups ); 289 } 290 291 /** 292 * Add a signup. 293 * 294 * @since 2.0.0 295 * 296 * @param array $args { 297 * Array of arguments for signup addition. 298 * @type string $domain New user's domain. 299 * @type string $path New user's path. 300 * @type string $title New user's title. 301 * @type string $user_login New user's user_login. 302 * @type string $user_email New user's email address. 303 * @type int|string $registered Time the user registered. 304 * @type string $activation_key New user's activation key. 305 * @type string $meta New user's user meta. 306 * } 307 * @return int|bool ID of newly created signup on success, false on failure. 308 */ 309 public static function add( $args = array() ) { 310 global $wpdb; 311 312 $r = bp_parse_args( $args, 313 array( 314 'domain' => '', 315 'path' => '', 316 'title' => '', 317 'user_login' => '', 318 'user_email' => '', 319 'registered' => current_time( 'mysql', true ), 320 'activation_key' => '', 321 'meta' => '', 322 ), 323 'bp_core_signups_add_args' 324 ); 325 326 $r['meta'] = maybe_serialize( $r['meta'] ); 327 328 $inserted = $wpdb->insert( 329 buddypress()->members->table_name_signups, 330 $r, 331 array( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) 332 ); 333 334 if ( $inserted ) { 335 $retval = $wpdb->insert_id; 336 } else { 337 $retval = false; 338 } 339 340 /** 341 * Filters the result of a signup addition. 342 * 343 * @since 2.0.0 344 * 345 * @param int|bool $retval Newly added user ID on success, false on failure. 346 */ 347 return apply_filters( 'bp_core_signups_add', $retval ); 348 } 349 350 /** 351 * Create a WP user at signup. 352 * 353 * Since BP 2.0, non-multisite configurations have stored signups in 354 * the same way as Multisite configs traditionally have: in the 355 * wp_signups table. However, because some plugins may be looking 356 * directly in the wp_users table for non-activated signups, we 357 * mirror signups there by creating "phantom" users, mimicking WP's 358 * default behavior. 359 * 360 * @since 2.0.0 361 * 362 * @param string $user_login User login string. 363 * @param string $user_password User password. 364 * @param string $user_email User email address. 365 * @param array $usermeta Metadata associated with the signup. 366 * @return int User id. 367 */ 368 public static function add_backcompat( $user_login = '', $user_password = '', $user_email = '', $usermeta = array() ) { 369 global $wpdb; 370 371 $user_id = wp_insert_user( array( 372 'user_login' => $user_login, 373 'user_pass' => $user_password, 374 'display_name' => sanitize_title( $user_login ), 375 'user_email' => $user_email 376 ) ); 377 378 if ( is_wp_error( $user_id ) || empty( $user_id ) ) { 379 return $user_id; 380 } 381 382 // Update the user status to '2', ie "not activated" 383 // (0 = active, 1 = spam, 2 = not active). 384 $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET user_status = 2 WHERE ID = %d", $user_id ) ); 385 386 // WordPress creates these options automatically on 387 // wp_insert_user(), but we delete them so that inactive 388 // signups don't appear in various user counts. 389 delete_user_option( $user_id, 'capabilities' ); 390 delete_user_option( $user_id, 'user_level' ); 391 392 // Set any profile data. 393 if ( bp_is_active( 'xprofile' ) ) { 394 if ( ! empty( $usermeta['profile_field_ids'] ) ) { 395 $profile_field_ids = explode( ',', $usermeta['profile_field_ids'] ); 396 397 foreach ( (array) $profile_field_ids as $field_id ) { 398 if ( empty( $usermeta["field_{$field_id}"] ) ) { 399 continue; 400 } 401 402 $current_field = $usermeta["field_{$field_id}"]; 403 xprofile_set_field_data( $field_id, $user_id, $current_field ); 404 405 /* 406 * Save the visibility level. 407 * 408 * Use the field's default visibility if not present, and 'public' if a 409 * default visibility is not defined. 410 */ 411 $key = "field_{$field_id}_visibility"; 412 if ( isset( $usermeta[ $key ] ) ) { 413 $visibility_level = $usermeta[ $key ]; 414 } else { 415 $vfield = xprofile_get_field( $field_id, null, false ); 416 $visibility_level = isset( $vfield->default_visibility ) ? $vfield->default_visibility : 'public'; 417 } 418 xprofile_set_field_visibility_level( $field_id, $user_id, $visibility_level ); 419 } 420 } 421 } 422 423 /** 424 * Filters the user ID for the backcompat functionality. 425 * 426 * @since 2.0.0 427 * 428 * @param int $user_id User ID being registered. 429 */ 430 return apply_filters( 'bp_core_signups_add_backcompat', $user_id ); 431 } 432 433 /** 434 * Check a user status (from wp_users) on a non-multisite config. 435 * 436 * @since 2.0.0 437 * 438 * @param int $user_id ID of the user being checked. 439 * @return int|bool The status if found, otherwise false. 440 */ 441 public static function check_user_status( $user_id = 0 ) { 442 global $wpdb; 443 444 if ( empty( $user_id ) ) { 445 return false; 446 } 447 448 $user_status = $wpdb->get_var( $wpdb->prepare( "SELECT user_status FROM {$wpdb->users} WHERE ID = %d", $user_id ) ); 449 450 /** 451 * Filters the user status of a provided user ID. 452 * 453 * @since 2.0.0 454 * 455 * @param int $value User status of the provided user ID. 456 */ 457 return apply_filters( 'bp_core_signups_check_user_status', intval( $user_status ) ); 458 } 459 460 /** 461 * Activate a signup. 462 * 463 * @since 2.0.0 464 * 465 * @param string $key Activation key. 466 * @return bool True on success, false on failure. 467 */ 468 public static function validate( $key = '' ) { 469 global $wpdb; 470 471 if ( empty( $key ) ) { 472 return; 473 } 474 475 $activated = $wpdb->update( 476 // Signups table. 477 buddypress()->members->table_name_signups, 478 array( 479 'active' => 1, 480 'activated' => current_time( 'mysql', true ), 481 ), 482 array( 483 'activation_key' => $key, 484 ), 485 // Data sanitization format. 486 array( 487 '%d', 488 '%s', 489 ), 490 // WHERE sanitization format. 491 array( 492 '%s', 493 ) 494 ); 495 496 /** 497 * Filters the status of the activated user. 498 * 499 * @since 2.0.0 500 * 501 * @param bool $activated Whether or not the activation was successful. 502 */ 503 return apply_filters( 'bp_core_signups_validate', $activated ); 504 } 505 506 /** 507 * How many inactive signups do we have? 508 * 509 * @since 2.0.0 510 * 511 * @return int The number of signups. 512 */ 513 public static function count_signups() { 514 global $wpdb; 515 516 $signups_table = buddypress()->members->table_name_signups; 517 $count_signups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) AS total FROM {$signups_table} WHERE active = %d", 0 ) ); 518 519 /** 520 * Filters the total inactive signups. 521 * 522 * @since 2.0.0 523 * 524 * @param int $count_signups How many total signups there are. 525 */ 526 return apply_filters( 'bp_core_signups_count', (int) $count_signups ); 527 } 528 529 /** 530 * Update the meta for a signup. 531 * 532 * This is the way we use to "trace" the last date an activation 533 * email was sent and how many times activation was sent. 534 * 535 * @since 2.0.0 536 * 537 * @param array $args { 538 * Array of arguments for the signup update. 539 * @type int $signup_id User signup ID. 540 * @type array $meta Meta to update. 541 * } 542 * @return int The signup id. 543 */ 544 public static function update( $args = array() ) { 545 global $wpdb; 546 547 $r = bp_parse_args( $args, 548 array( 549 'signup_id' => 0, 550 'meta' => array(), 551 ), 552 'bp_core_signups_update_args' 553 ); 554 555 if ( empty( $r['signup_id'] ) || empty( $r['meta'] ) ) { 556 return false; 557 } 558 559 $wpdb->update( 560 // Signups table. 561 buddypress()->members->table_name_signups, 562 // Data to update. 563 array( 564 'meta' => serialize( $r['meta'] ), 565 ), 566 // WHERE. 567 array( 568 'signup_id' => $r['signup_id'], 569 ), 570 // Data sanitization format. 571 array( 572 '%s', 573 ), 574 // WHERE sanitization format. 575 array( 576 '%d', 577 ) 578 ); 579 580 /** 581 * Filters the signup ID which received a meta update. 582 * 583 * @since 2.0.0 584 * 585 * @param int $value The signup ID. 586 */ 587 return apply_filters( 'bp_core_signups_update', $r['signup_id'] ); 588 } 589 590 /** 591 * Resend an activation email. 592 * 593 * @since 2.0.0 594 * 595 * @param array $signup_ids Single ID or list of IDs to resend. 596 * @return array 597 */ 598 public static function resend( $signup_ids = array() ) { 599 if ( empty( $signup_ids ) || ! is_array( $signup_ids ) ) { 600 return false; 601 } 602 603 $to_resend = self::get( array( 604 'include' => $signup_ids, 605 ) ); 606 607 if ( ! $signups = $to_resend['signups'] ) { 608 return false; 609 } 610 611 $result = array(); 612 613 /** 614 * Fires before activation emails are resent. 615 * 616 * @since 2.0.0 617 * 618 * @param array $signup_ids Array of IDs to resend activation emails to. 619 */ 620 do_action( 'bp_core_signup_before_resend', $signup_ids ); 621 622 foreach ( $signups as $signup ) { 623 624 $meta = $signup->meta; 625 $meta['sent_date'] = current_time( 'mysql', true ); 626 $meta['count_sent'] = $signup->count_sent + 1; 627 628 // Send activation email. 629 if ( is_multisite() ) { 630 wpmu_signup_user_notification( $signup->user_login, $signup->user_email, $signup->activation_key, serialize( $meta ) ); 631 } else { 632 633 // Check user status before sending email. 634 $user_id = email_exists( $signup->user_email ); 635 636 if ( ! empty( $user_id ) && 2 != self::check_user_status( $user_id ) ) { 637 638 // Status is not 2, so user's account has been activated. 639 $result['errors'][ $signup->signup_id ] = array( $signup->user_login, esc_html__( 'the sign-up has already been activated.', 'buddypress' ) ); 640 641 // Repair signups table. 642 self::validate( $signup->activation_key ); 643 644 continue; 645 646 // Send the validation email. 647 } else { 648 $salutation = $signup->user_login; 649 if ( bp_is_active( 'xprofile' ) && isset( $meta[ 'field_' . bp_xprofile_fullname_field_id() ] ) ) { 650 $salutation = $meta[ 'field_' . bp_xprofile_fullname_field_id() ]; 651 } 652 653 bp_core_signup_send_validation_email( false, $signup->user_email, $signup->activation_key, $salutation ); 654 } 655 } 656 657 // Update metas. 658 $result['resent'][] = self::update( array( 659 'signup_id' => $signup->signup_id, 660 'meta' => $meta, 661 ) ); 662 } 663 664 /** 665 * Fires after activation emails are resent. 666 * 667 * @since 2.0.0 668 * 669 * @param array $signup_ids Array of IDs to resend activation emails to. 670 * @param array $result Updated metadata related to activation emails. 671 */ 672 do_action( 'bp_core_signup_after_resend', $signup_ids, $result ); 673 674 /** 675 * Filters the result of the metadata for signup activation email resends. 676 * 677 * @since 2.0.0 678 * 679 * @param array $result Updated metadata related to activation emails. 680 */ 681 return apply_filters( 'bp_core_signup_resend', $result ); 682 } 683 684 /** 685 * Activate a pending account. 686 * 687 * @since 2.0.0 688 * 689 * @param array $signup_ids Single ID or list of IDs to activate. 690 * @return array 691 */ 692 public static function activate( $signup_ids = array() ) { 693 if ( empty( $signup_ids ) || ! is_array( $signup_ids ) ) { 694 return false; 695 } 696 697 $to_activate = self::get( array( 698 'include' => $signup_ids, 699 ) ); 700 701 if ( ! $signups = $to_activate['signups'] ) { 702 return false; 703 } 704 705 $result = array(); 706 707 /** 708 * Fires before activation of user accounts. 709 * 710 * @since 2.0.0 711 * 712 * @param array $signup_ids Array of IDs to activate. 713 */ 714 do_action( 'bp_core_signup_before_activate', $signup_ids ); 715 716 foreach ( $signups as $signup ) { 717 718 $user = bp_core_activate_signup( $signup->activation_key ); 719 720 if ( ! empty( $user->errors ) ) { 721 722 $user_id = username_exists( $signup->user_login ); 723 724 if ( 2 !== self::check_user_status( $user_id ) ) { 725 $user_id = false; 726 } 727 728 if ( empty( $user_id ) ) { 729 730 // Status is not 2, so user's account has been activated. 731 $result['errors'][ $signup->signup_id ] = array( $signup->user_login, esc_html__( 'the sign-up has already been activated.', 'buddypress' ) ); 732 733 // Repair signups table. 734 self::validate( $signup->activation_key ); 735 736 // We have a user id, account is not active, let's delete it. 737 } else { 738 $result['errors'][ $signup->signup_id ] = array( $signup->user_login, $user->get_error_message() ); 739 } 740 741 } else { 742 $result['activated'][] = $user; 743 } 744 } 745 746 /** 747 * Fires after activation of user accounts. 748 * 749 * @since 2.0.0 750 * 751 * @param array $signup_ids Array of IDs activated activate. 752 * @param array $result Array of data for activated accounts. 753 */ 754 do_action( 'bp_core_signup_after_activate', $signup_ids, $result ); 755 756 /** 757 * Filters the result of the metadata after user activation. 758 * 759 * @since 2.0.0 760 * 761 * @param array $result Updated metadata related to user activation. 762 */ 763 return apply_filters( 'bp_core_signup_activate', $result ); 764 } 765 766 /** 767 * Delete a pending account. 768 * 769 * @since 2.0.0 770 * 771 * @param array $signup_ids Single ID or list of IDs to delete. 772 * @return array 773 */ 774 public static function delete( $signup_ids = array() ) { 775 global $wpdb; 776 777 if ( empty( $signup_ids ) || ! is_array( $signup_ids ) ) { 778 return false; 779 } 780 781 $to_delete = self::get( array( 782 'include' => $signup_ids, 783 ) ); 784 785 if ( ! $signups = $to_delete['signups'] ) { 786 return false; 787 } 788 789 $result = array(); 790 791 /** 792 * Fires before deletion of pending accounts. 793 * 794 * @since 2.0.0 795 * 796 * @param array $signup_ids Array of pending IDs to delete. 797 */ 798 do_action( 'bp_core_signup_before_delete', $signup_ids ); 799 800 foreach ( $signups as $signup ) { 801 $user_id = username_exists( $signup->user_login ); 802 803 if ( ! empty( $user_id ) && $signup->activation_key === bp_get_user_meta( $user_id, 'activation_key', true ) ) { 804 805 if ( 2 != self::check_user_status( $user_id ) ) { 806 807 // Status is not 2, so user's account has been activated. 808 $result['errors'][ $signup->signup_id ] = array( $signup->user_login, esc_html__( 'the sign-up has already been activated.', 'buddypress' ) ); 809 810 // Repair signups table. 811 self::validate( $signup->activation_key ); 812 813 // We have a user id, account is not active, let's delete it. 814 } else { 815 bp_core_delete_account( $user_id ); 816 } 817 } 818 819 if ( empty( $result['errors'][ $signup->signup_id ] ) ) { 820 $wpdb->delete( 821 // Signups table. 822 buddypress()->members->table_name_signups, 823 // Where. 824 array( 'signup_id' => $signup->signup_id, ), 825 // WHERE sanitization format. 826 array( '%d', ) 827 ); 828 829 $result['deleted'][] = $signup->signup_id; 830 } 831 } 832 833 /** 834 * Fires after deletion of pending accounts. 835 * 836 * @since 2.0.0 837 * 838 * @param array $signup_ids Array of pending IDs to delete. 839 * @param array $result Array of data for deleted accounts. 840 */ 841 do_action( 'bp_core_signup_after_delete', $signup_ids, $result ); 842 843 /** 844 * Filters the result of the metadata for deleted pending accounts. 845 * 846 * @since 2.0.0 847 * 848 * @param array $result Updated metadata related to deleted pending accounts. 849 */ 850 return apply_filters( 'bp_core_signup_delete', $result ); 851 } 852 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Mar 5 01:01:35 2021 | Cross-referenced by PHPXref 0.7.1 |