Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/11/2010 04:52:34 PM (14 years ago)
Author:
apeatling
Message:

Fixes #2149, fixed inconsistencies between single WP and WPMU with registration and activation. Single WP users must now activate their accounts and confirm they are using a valid email.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/bp-core.php

    r2815 r2832  
    3333require ( BP_PLUGIN_DIR . '/bp-core/bp-core-catchuri.php' );
    3434require ( BP_PLUGIN_DIR . '/bp-core/bp-core-classes.php' );
     35require ( BP_PLUGIN_DIR . '/bp-core/bp-core-filters.php' );
    3536require ( BP_PLUGIN_DIR . '/bp-core/bp-core-cssjs.php' );
    3637require ( BP_PLUGIN_DIR . '/bp-core/bp-core-avatars.php' );
     
    4041require ( BP_PLUGIN_DIR . '/bp-core/bp-core-notifications.php' );
    4142require ( 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' );
    4643
    4744/* If BP_DISABLE_ADMIN_BAR is defined, do not load the global admin bar. */
     
    16641661    update_site_option( 'illegal_names', $new );
    16651662}
    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 Core
    1673  * @uses get_blog_option() fetches the value for a meta_key in the wp_X_options table
    1674  * @return The blog name for the root blog
    1675  */
    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 sent
    1686  *
    1687  * @package BuddyPress Core
    1688  * @global $current_site Object containing current site metadata
    1689  * @return noreply@sitedomain email address
    1690  */
    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' );
    16971663
    16981664/**
     
    19721938
    19731939/**
    1974  * bp_core_filter_parent_theme()
    1975  *
    1976  * Remove social network parent theme from the theme list.
    1977  *
    1978  * @package BuddyPress Core
    1979  */
    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 show
    1994  * up on the theme selection screen. This function will let the BuddyPress bundled
    1995  * themes show up on the root blog selection screen and bypass this step. It also
    1996  * means that the themes won't show for selection on other blogs.
    1997  *
    1998  * @package BuddyPress Core
    1999  */
    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 /**
    20161940 * bp_core_activation_notice()
    20171941 *
     
    20541978add_action( 'admin_notices', 'bp_core_activation_notice' );
    20551979
    2056 /**
    2057  * bp_core_filter_comments()
    2058  *
    2059  * Filter the blog post comments array and insert BuddyPress URLs for users.
    2060  *
    2061  * @package BuddyPress Core
    2062  */
    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 Core
    2099  */
    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 
    21171980/********************************************************************************
    21181981 * Custom Actions
Note: See TracChangeset for help on using the changeset viewer.