Changeset 9270
- Timestamp:
- 12/24/2014 02:30:41 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-members/bp-members-functions.php
r9231 r9270 140 140 } 141 141 142 /** 143 * Filters the results of the user query. 144 * 145 * @since BuddyPress (1.2.0) 146 * 147 * @param array $retval Array of users for the current query. 148 * @param array $r Array of parsed query arguments. 149 */ 142 150 return apply_filters( 'bp_core_get_users', $retval, $r ); 143 151 } … … 169 177 $domain = apply_filters( 'bp_core_get_user_domain_pre_cache', $domain, $user_id, $user_nicename, $user_login ); 170 178 179 /** 180 * Filters the domain for the passed user. 181 * 182 * @since BuddyPress (1.0.1) 183 * 184 * @param string $domain Domain for the passed user. 185 * @param int $user_id ID of the passed user. 186 * @param string $user_nicename User nicename of the passed user. 187 * @param string $user_login User login of the passed user. 188 */ 171 189 return apply_filters( 'bp_core_get_user_domain', $domain, $user_id, $user_nicename, $user_login ); 172 190 } … … 187 205 wp_cache_set( 'bp_core_userdata_' . $user_id, $userdata, 'bp' ); 188 206 } 207 208 /** 209 * Filters the userdata for a passed user. 210 * 211 * @since BuddyPress (1.2.0) 212 * 213 * @param array $userdata Array of user data for a passed user. 214 */ 189 215 return apply_filters( 'bp_core_get_core_userdata', $userdata ); 190 216 } … … 219 245 $user = get_user_by( 'login', $username ); 220 246 247 /** 248 * Filters the ID of a user, based on user_login. 249 * 250 * @since BuddyPress (1.0.1) 251 * 252 * @param int|null $value ID of the user or null. 253 * @param string $username User login to check. 254 */ 221 255 return apply_filters( 'bp_core_get_userid', ! empty( $user->ID ) ? $user->ID : NULL, $username ); 222 256 } … … 237 271 $user = get_user_by( 'slug', $user_nicename ); 238 272 273 /** 274 * Filters the user ID based on user_nicename. 275 * 276 * @since BuddyPress (1.2.3) 277 * 278 * @param int|null $value ID of the user or null. 279 * @param string $user_nicename User nicename to check. 280 */ 239 281 return apply_filters( 'bp_core_get_userid_from_nicename', ! empty( $user->ID ) ? $user->ID : NULL, $user_nicename ); 240 282 } … … 311 353 } 312 354 355 /** 356 * Filters the username based on originally provided user ID. 357 * 358 * @since BuddyPress (1.0.1) 359 * 360 * @param string $username Username determined by user ID. 361 */ 313 362 return apply_filters( 'bp_core_get_username', $username ); 314 363 } … … 368 417 } 369 418 419 /** 420 * Filters the user_nicename based on originally provided user ID. 421 * 422 * @since BuddyPress (1.5.0) 423 * 424 * @param string $username User nice name determined by user ID. 425 */ 370 426 return apply_filters( 'bp_members_get_user_nicename', $user_nicename ); 371 427 } … … 395 451 } 396 452 453 /** 454 * Filters the user email for user based on user ID. 455 * 456 * @since BuddyPress (1.0.1) 457 * 458 * @param string $email Email determined for the user. 459 */ 397 460 return apply_filters( 'bp_core_get_user_email', $email ); 398 461 } … … 432 495 } 433 496 497 /** 498 * Filters the link text for the passed in user. 499 * 500 * @since BuddyPress (1.2.0) 501 * 502 * @param string $value Link text based on passed parameters. 503 * @param int $user_id ID of the user to check. 504 */ 434 505 return apply_filters( 'bp_core_get_userlink', '<a href="' . $url . '" title="' . $display_name . '">' . $display_name . '</a>', $user_id ); 435 506 } … … 551 622 } 552 623 624 /** 625 * Filters the display name for the passed in user. 626 * 627 * @since BuddyPress (1.0.1) 628 * 629 * @param string $fullname Display name for the user. 630 * @param int $user_id ID of the user to check. 631 */ 553 632 return apply_filters( 'bp_core_get_user_displayname', $fullname, $user_id ); 554 633 } … … 566 645 function bp_core_get_userlink_by_email( $email ) { 567 646 $user = get_user_by( 'email', $email ); 647 648 /** 649 * Filters the user link for the user based on user email address. 650 * 651 * @since BuddyPress (1.0.1) 652 * 653 * @param string|bool $value URL for the user if found, otherwise false. 654 */ 568 655 return apply_filters( 'bp_core_get_userlink_by_email', bp_core_get_userlink( $user->ID, false, false, true ) ); 569 656 } … … 583 670 } 584 671 672 /** 673 * Filters the user link for the user based on username. 674 * 675 * @since BuddyPress (1.0.1) 676 * 677 * @param string|bool $value URL for the user if found, otherwise false. 678 */ 585 679 return apply_filters( 'bp_core_get_userlink_by_username', bp_core_get_userlink( $user_id, false, false, true ) ); 586 680 } … … 606 700 } 607 701 702 /** 703 * Filters the total number of members for the installation. 704 * 705 * @since BuddyPress (1.2.0) 706 * 707 * @param int $count Total number of members. 708 */ 608 709 return apply_filters( 'bp_core_get_total_member_count', $count ); 609 710 } … … 634 735 } 635 736 737 /** 738 * Filters the total number of members for the installation limited to those with last_activity. 739 * 740 * @since BuddyPress (1.6.0) 741 * 742 * @param int $count Total number of active members. 743 */ 636 744 return apply_filters( 'bp_core_get_active_member_count', $count ); 637 745 } … … 713 821 // Call multisite actions in single site mode for good measure 714 822 if ( !is_multisite() ) { 715 $wp_action = ( true === $is_spam ) ? 'make_spam_user' : 'make_ham_user'; 716 do_action( $wp_action, bp_displayed_user_id() ); 823 if ( true === $is_spam ) { 824 825 /** 826 * Fires at end of processing spammer in Dashboard if not multisite and user is spam. 827 * 828 * @since BuddyPress (1.5.0) 829 * 830 * @param int $value Displayed user ID. 831 */ 832 do_action( 'make_spam_user', bp_displayed_user_id() ); 833 } else { 834 835 /** 836 * Fires at end of processing spammer in Dashboard if not multisite and user is not spam. 837 * 838 * @since BuddyPress (1.5.0) 839 * 840 * @param int $value Displayed user ID. 841 */ 842 do_action( 'make_ham_user', bp_displayed_user_id() ); 843 } 844 845 717 846 } 718 847 } … … 724 853 725 854 // We need a special hook for is_spam so that components can delete data at spam time 726 $bp_action = ( true === $is_spam ) ? 'bp_make_spam_user' : 'bp_make_ham_user'; 727 do_action( $bp_action, $user_id ); 728 729 // Allow plugins to do neat things 855 if ( true === $is_spam ) { 856 857 /** 858 * Fires at the end of the process spammer process if the user is spam. 859 * 860 * @since BuddyPress (1.5.0) 861 * 862 * @param int $value Displayed user ID. 863 */ 864 do_action( 'bp_make_spam_user', $user_id ); 865 } else { 866 867 /** 868 * Fires at the end of the process spammer process if the user is not spam. 869 * 870 * @since BuddyPress (1.5.0) 871 * 872 * @param int $value Displayed user ID. 873 */ 874 do_action( 'bp_make_ham_user', $user_id ); 875 } 876 877 /** 878 * Fires at the end of the process for hanlding spammer status. 879 * 880 * @since BuddyPress (1.5.5) 881 * 882 * @param int $user_id ID of the processed user. 883 * @param bool $is_spam The determined spam status of processed user. 884 */ 730 885 do_action( 'bp_core_process_spammer_status', $user_id, $is_spam ); 731 886 … … 815 970 } 816 971 972 /** 973 * Filters whether a user is marked as a spammer. 974 * 975 * @since BuddyPress (1.6.0) 976 * 977 * @param bool $is_spammer Whether or not user is marked as spammer. 978 */ 817 979 return apply_filters( 'bp_is_user_spammer', (bool) $is_spammer ); 818 980 } … … 872 1034 } 873 1035 1036 /** 1037 * Filters whether a user is marked as deleted. 1038 * 1039 * @since BuddyPress (1.6.0) 1040 * 1041 * @param bool $is_deleted Whether or not user is marked as deleted. 1042 */ 874 1043 return apply_filters( 'bp_is_user_deleted', (bool) $is_deleted ); 875 1044 } … … 1056 1225 } 1057 1226 1227 /** 1228 * Filters the last activity for a given user. 1229 * 1230 * @since BuddyPress (1.9.0) 1231 * 1232 * @param string $activity Time of last activity, in 'Y-m-d H:i:s' format or 1233 * an empty string if none found. 1234 * @param int $user_id ID of the user being checked. 1235 */ 1058 1236 return apply_filters( 'bp_get_user_last_activity', $activity, $user_id ); 1059 1237 } … … 1142 1320 } 1143 1321 1322 /** 1323 * Fires before the processing of an account deletion. 1324 * 1325 * @since BuddyPress (1.6.0) 1326 * 1327 * @param int $user_id ID of the user account being deleted. 1328 */ 1144 1329 do_action( 'bp_core_pre_delete_account', $user_id ); 1145 1330 … … 1157 1342 } 1158 1343 1344 /** 1345 * Fires after the deletion of an account. 1346 * 1347 * @since BuddyPress (1.6.0) 1348 * 1349 * @param int $user_id ID of the user account that was deleted. 1350 */ 1159 1351 do_action( 'bp_core_deleted_account', $user_id ); 1160 1352 … … 1333 1525 } 1334 1526 1335 // Add our slugs to the array and allow them to be filtered 1527 /** 1528 * Filters the array of default illegal usernames. 1529 * 1530 * @since BuddyPress (1.2.2) 1531 * 1532 * @param array $value Merged and unique array of illegal usernames. 1533 */ 1336 1534 $filtered_illegal_names = apply_filters( 'bp_core_illegal_usernames', array_merge( array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' ), $bp_component_slugs ) ); 1337 1535 … … 1342 1540 $illegal_names = array_unique( (array) $merged_names ); 1343 1541 1542 /** 1543 * Filters the array of default illegal names. 1544 * 1545 * @since BuddyPress (1.2.5) 1546 * 1547 * @param array $value Merged and unique array of illegal names. 1548 */ 1344 1549 return apply_filters( 'bp_core_illegal_names', $illegal_names ); 1345 1550 } … … 1453 1658 $errors = new WP_Error(); 1454 1659 1455 // Apply any user_login filters added by BP or other plugins before validating 1660 /** 1661 * Filters the username before being validated. 1662 * 1663 * @since BuddyPress (1.5.5) 1664 * 1665 * @param string $user_name Username to validate. 1666 */ 1456 1667 $user_name = apply_filters( 'pre_user_login', $user_name ); 1457 1668 … … 1517 1728 } 1518 1729 1730 /** 1731 * Filters the result of the user signup validation. 1732 * 1733 * @since BuddyPress (1.2.2) 1734 * 1735 * @param array $result Results of user validation including errors, if any. 1736 */ 1519 1737 return apply_filters( 'bp_core_validate_user_signup', $result ); 1520 1738 } … … 1534 1752 } 1535 1753 1754 /** 1755 * Filters the validated blog url and title provided at signup. 1756 * 1757 * @since BuddyPress (1.2.2) 1758 * 1759 * @param array $value Array with the new site data and error messages. 1760 */ 1536 1761 return apply_filters( 'bp_core_validate_blog_signup', wpmu_validate_blog_signup( $blog_url, $blog_title ) ); 1537 1762 } … … 1598 1823 BP_Signup::add( $args ); 1599 1824 1825 /** 1826 * Filters if BuddyPress should send an activation key for a new signup. 1827 * 1828 * @since BuddyPress (1.2.3) 1829 * 1830 * @param bool $value Whether or not to send the activation key. 1831 * @param int $user_id User ID to send activation key to. 1832 * @param string $user_email User email to send activation key to. 1833 * @param string $activation_key Activation key to be sent. 1834 * @param array $usermeta Miscellaneous metadata about the user (blog-specific 1835 * signup data, xprofile data, etc). 1836 */ 1600 1837 if ( apply_filters( 'bp_core_signup_send_activation_key', true, $user_id, $user_email, $activation_key, $usermeta ) ) { 1601 1838 bp_core_signup_send_validation_email( $user_id, $user_email, $activation_key ); … … 1605 1842 $bp->signup->username = $user_login; 1606 1843 1844 /** 1845 * Fires at the end of the process to sign up a user. 1846 * 1847 * @since BuddyPress (1.2.2) 1848 * 1849 * @param bool|WP_Error $user_id True on success, WP_Error on failure. 1850 * @param string $user_login Login name requested by the user. 1851 * @param string $user_password Password requested by the user. 1852 * @param string $user_email Email address requested by the user. 1853 * @param array $usermeta Miscellaneous metadata about the user (blog-specific 1854 * signup data, xprofile data, etc). 1855 */ 1607 1856 do_action( 'bp_core_signup_user', $user_id, $user_login, $user_password, $user_email, $usermeta ); 1608 1857 … … 1625 1874 } 1626 1875 1876 /** 1877 * Filters the result of wpmu_signup_blog() 1878 * 1879 * This filter provides no value and is retained for 1880 * backwards compatibility. 1881 * 1882 * @since BuddyPress (1.2.2) 1883 * 1884 * @param void $value 1885 */ 1627 1886 return apply_filters( 'bp_core_signup_blog', wpmu_signup_blog( $blog_domain, $blog_path, $blog_title, $user_name, $user_email, $usermeta ) ); 1628 1887 } … … 1726 1985 1727 1986 if ( isset( $user_already_created ) ) { 1987 1988 /** 1989 * Fires if the user has already been created. 1990 * 1991 * @since BuddyPress (1.2.2) 1992 * 1993 * @param int $user_id ID of the user being checked. 1994 * @param string $key Activation key. 1995 * @param array $user Array of user data. 1996 */ 1728 1997 do_action( 'bp_core_activated_user', $user_id, $key, $user ); 1729 1998 return $user_id; … … 1761 2030 } 1762 2031 2032 /** 2033 * Fires at the end of the user activation process. 2034 * 2035 * @since BuddyPress (1.2.2) 2036 * 2037 * @param int $user_id ID of the user being checked. 2038 * @param string $key Activation key. 2039 * @param array $user Array of user data. 2040 */ 1763 2041 do_action( 'bp_core_activated_user', $user_id, $key, $user ); 1764 2042 … … 1928 2206 $newsubdir = '/avatars/signups/' . $bp->signup->avatar_dir; 1929 2207 2208 /** 2209 * Filters the avatar storage directory for use during registration. 2210 * 2211 * @since BuddyPress (1.1.1) 2212 * 2213 * @param array $value Array of path and URL values for created storage directory. 2214 */ 1930 2215 return apply_filters( 'bp_core_signup_avatar_upload_dir', array( 1931 2216 'path' => $path, … … 1952 2237 $subject = bp_get_email_subject( array( 'text' => __( 'Activate Your Account', 'buddypress' ) ) ); 1953 2238 1954 // Send the message 2239 /** 2240 * Filters the user email that the validation email will be sent to. 2241 * 2242 * @since BuddyPress (1.5.0) 2243 * 2244 * @param string $user_email User email the notification is being sent to. 2245 * @param int $user_id ID of the new user receiving email. 2246 */ 1955 2247 $to = apply_filters( 'bp_core_signup_send_validation_email_to', $user_email, $user_id ); 2248 2249 /** 2250 * Filters the validation email subject that will be sent to user. 2251 * 2252 * @since BuddyPress (1.5.0) 2253 * 2254 * @param string $subject Email validation subject text. 2255 * @param int $user_id ID of the new user receiving email. 2256 */ 1956 2257 $subject = apply_filters( 'bp_core_signup_send_validation_email_subject', $subject, $user_id ); 2258 2259 /** 2260 * Filters the validation email message that will be sent to user. 2261 * 2262 * @since BuddyPress (1.5.0) 2263 * 2264 * @param string $message Email validation message text. 2265 * @param int $user_id ID of the new user receiving email. 2266 * @param string $activate_url URL to use for activating account. 2267 */ 1957 2268 $message = apply_filters( 'bp_core_signup_send_validation_email_message', $message, $user_id, $activate_url ); 1958 2269 1959 2270 wp_mail( $to, $subject, $message ); 1960 2271 2272 /** 2273 * Fires after the sending of activation email to a newly registered user. 2274 * 2275 * @since BuddyPress (1.5.0) 2276 * 2277 * @param string $subject Subject for the sent email. 2278 * @param string $message Message for the sent email. 2279 * @param int $user_id ID of the new user. 2280 * @param string $user_email Email address of the new user. 2281 * @param string $key Activation key. 2282 */ 1961 2283 do_action( 'bp_core_sent_user_validation_email', $subject, $message, $user_id, $user_email, $key ); 1962 2284 } … … 2127 2449 ); 2128 2450 2129 // setup login URL 2451 /** 2452 * Filters the url used for redirection for a logged in user marked as spam. 2453 * 2454 * @since BuddyPress (1.8.0) 2455 * 2456 * @param string $value URL to redirect user to. 2457 */ 2130 2458 $login_url = apply_filters( 'bp_live_spammer_redirect', add_query_arg( $args, wp_login_url() ) ); 2131 2459 … … 2261 2589 * @param array $types Member type objects, keyed by name. 2262 2590 * @param array $args Array of key=>value arguments for filtering. 2263 * @param string $operator 'or' to match any of $args, 'and' to require all.2591 * @param string $operator 'or' to match any of $args, 'and' to require all. 2264 2592 */ 2265 2593 $types = apply_filters( 'bp_get_member_types', $types, $args, $operator );
Note: See TracChangeset
for help on using the changeset viewer.