Changeset 2842 for trunk/bp-core.php
- Timestamp:
- 03/12/2010 01:03:42 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core.php
r2822 r2842 33 33 require ( BP_PLUGIN_DIR . '/bp-core/bp-core-catchuri.php' ); 34 34 require ( BP_PLUGIN_DIR . '/bp-core/bp-core-classes.php' ); 35 require ( BP_PLUGIN_DIR . '/bp-core/bp-core-filters.php' ); 35 36 require ( BP_PLUGIN_DIR . '/bp-core/bp-core-cssjs.php' ); 36 37 require ( BP_PLUGIN_DIR . '/bp-core/bp-core-avatars.php' ); … … 40 41 require ( BP_PLUGIN_DIR . '/bp-core/bp-core-notifications.php' ); 41 42 require ( BP_PLUGIN_DIR . '/bp-core/bp-core-signup.php' ); 42 43 /* Multisite includes built in account activation support. */44 if ( bp_core_is_multisite() )45 require ( BP_PLUGIN_DIR . '/bp-core/bp-core-activation.php' );46 43 47 44 /* If BP_DISABLE_ADMIN_BAR is defined, do not load the global admin bar. */ … … 1664 1661 update_site_option( 'illegal_names', $new ); 1665 1662 } 1666 1667 /**1668 * bp_core_email_from_name_filter()1669 *1670 * Sets the "From" name in emails sent to the name of the site and not "WordPress"1671 *1672 * @package BuddyPress Core1673 * @uses get_blog_option() fetches the value for a meta_key in the wp_X_options table1674 * @return The blog name for the root blog1675 */1676 function bp_core_email_from_name_filter() {1677 return apply_filters( 'bp_core_email_from_name_filter', get_blog_option( BP_ROOT_BLOG, 'blogname' ) );1678 }1679 add_filter( 'wp_mail_from_name', 'bp_core_email_from_name_filter' );1680 1681 1682 /**1683 * bp_core_email_from_name_filter()1684 *1685 * Sets the "From" address in emails sent1686 *1687 * @package BuddyPress Core1688 * @global $current_site Object containing current site metadata1689 * @return noreply@sitedomain email address1690 */1691 function bp_core_email_from_address_filter() {1692 $domain = (array) explode( '/', site_url() );1693 1694 return apply_filters( 'bp_core_email_from_address_filter', __( 'noreply', 'buddypress' ) . '@' . $domain[2] );1695 }1696 add_filter( 'wp_mail_from', 'bp_core_email_from_address_filter' );1697 1663 1698 1664 /** … … 1972 1938 1973 1939 /** 1974 * bp_core_filter_parent_theme()1975 *1976 * Remove social network parent theme from the theme list.1977 *1978 * @package BuddyPress Core1979 */1980 function bp_core_filter_parent_theme() {1981 global $wp_themes, $pagenow;1982 1983 if ( is_admin() && 'themes.php' == $pagenow )1984 $wp_themes = get_themes();1985 1986 unset( $wp_themes['BuddyPress Classic Parent'] );1987 }1988 add_filter( 'admin_menu', 'bp_core_filter_parent_theme' );1989 1990 /**1991 * bp_core_allow_default_theme()1992 *1993 * On multiblog installations you must first allow themes to be activated and show1994 * up on the theme selection screen. This function will let the BuddyPress bundled1995 * themes show up on the root blog selection screen and bypass this step. It also1996 * means that the themes won't show for selection on other blogs.1997 *1998 * @package BuddyPress Core1999 */2000 function bp_core_allow_default_theme( $themes ) {2001 global $bp, $current_blog;2002 2003 if ( !is_site_admin() )2004 return $themes;2005 2006 if ( $current_blog->ID == $bp->root_blog ) {2007 $themes['bp-default'] = 1;2008 $themes['bp-classic'] = 1;2009 }2010 2011 return $themes;2012 }2013 add_filter( 'allowed_themes', 'bp_core_allow_default_theme' );2014 2015 /**2016 1940 * bp_core_activation_notice() 2017 1941 * … … 2054 1978 add_action( 'admin_notices', 'bp_core_activation_notice' ); 2055 1979 2056 /**2057 * bp_core_filter_comments()2058 *2059 * Filter the blog post comments array and insert BuddyPress URLs for users.2060 *2061 * @package BuddyPress Core2062 */2063 function bp_core_filter_comments( $comments, $post_id ) {2064 global $wpdb;2065 2066 foreach( (array)$comments as $comment ) {2067 if ( $comment->user_id )2068 $user_ids[] = $comment->user_id;2069 }2070 2071 if ( empty( $user_ids ) )2072 return $comments;2073 2074 $user_ids = implode( ',', $user_ids );2075 2076 if ( !$userdata = $wpdb->get_results( $wpdb->prepare( "SELECT ID as user_id, user_login, user_nicename FROM {$wpdb->users} WHERE ID IN ({$user_ids})" ) ) )2077 return $comments;2078 2079 foreach( (array)$userdata as $user )2080 $users[$user->user_id] = bp_core_get_user_domain( $user->user_id, $user->user_nicename, $user->user_login );2081 2082 foreach( (array)$comments as $i => $comment ) {2083 if ( !empty( $comment->user_id ) ) {2084 if ( !empty( $users[$comment->user_id] ) )2085 $comments[$i]->comment_author_url = $users[$comment->user_id];2086 }2087 }2088 2089 return $comments;2090 }2091 add_filter( 'comments_array', 'bp_core_filter_comments', 10, 2 );2092 2093 /**2094 * bp_core_login_redirect()2095 *2096 * When a user logs in, always redirect them back to the previous page. NOT the admin area.2097 *2098 * @package BuddyPress Core2099 */2100 function bp_core_login_redirect( $redirect_to ) {2101 global $bp, $current_blog;2102 2103 if ( bp_core_is_multisite() && $current_blog->blog_id != BP_ROOT_BLOG )2104 return $redirect_to;2105 2106 if ( !empty( $_REQUEST['redirect_to'] ) || strpos( $_REQUEST['redirect_to'], 'wp-admin' ) )2107 return $redirect_to;2108 2109 if ( false === strpos( wp_get_referer(), 'wp-login.php' ) && false === strpos( wp_get_referer(), 'activate' ) && empty( $_REQUEST['nr'] ) )2110 return wp_get_referer();2111 2112 return $bp->root_domain;2113 }2114 add_filter( 'login_redirect', 'bp_core_login_redirect' );2115 2116 2117 1980 /******************************************************************************** 2118 1981 * Custom Actions
Note: See TracChangeset
for help on using the changeset viewer.