Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/15/2015 07:57:03 PM (9 years ago)
Author:
tw2113
Message:

[Samus Aran]
I first battled the documentation inconsistencies on planet Zebes. It was there that I foiled the plans of the
Space Pirate leader Mother Brain to use the issues to attack galactic civilization...

I next fought the inconsistencies on their homeworld SR388. I completely eradicated them except for an @since tag,
which after hatching followed me like a confused child...

I personally delivered it to the Galactic Research Station at Ceres so scientists could study its energy production qualities...

The scientists' findings were astounding! They discovered that the powers of the docs inconsistencies
might be harnessed for the good of galactic civilization!

Satisfied that all was well, I left the station to seek a new bounty to hunt. But, I had hardly gone beyond the asteroid
belt when I picked up a distress signal!

Ceres station was under attack!

More documentation cleanup for part of BP-Core component.

See #6398.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-filters.php

    r10276 r10356  
    4444add_filter( 'map_meta_cap',            'bp_map_meta_caps',       10, 4 );
    4545
    46 // Add some filters to feedback messages
     46// Add some filters to feedback messages.
    4747add_filter( 'bp_core_render_message_content', 'wptexturize'       );
    4848add_filter( 'bp_core_render_message_content', 'convert_smilies'   );
     
    6262add_filter( 'bp_template_include',   'bp_template_include_theme_compat',   4, 2 );
    6363
    64 // Filter BuddyPress template locations
     64// Filter BuddyPress template locations.
    6565add_filter( 'bp_get_template_stack', 'bp_add_template_stack_locations' );
    6666
    67 // Turn comments off for BuddyPress pages
     67// Turn comments off for BuddyPress pages.
    6868add_filter( 'comments_open', 'bp_comments_open', 10, 2 );
    6969
     
    7575 * @param array $pages List of excluded page IDs, as passed to the
    7676 *                     'wp_list_pages_excludes' filter.
    77  *
    7877 * @return array The exclude list, with BP's pages added.
    7978 */
    8079function bp_core_exclude_pages( $pages = array() ) {
    8180
    82     // Bail if not the root blog
     81    // Bail if not the root blog.
    8382    if ( ! bp_is_root_blog() )
    8483        return $pages;
     
    115114 *
    116115 * @param object|null $object The post type object used in the meta box.
    117  *
    118116 * @return object|null The $object, with a query argument to remove register and activate pages id.
    119117 */
    120118function bp_core_exclude_pages_from_nav_menu_admin( $object = null ) {
    121119
    122     // Bail if not the root blog
     120    // Bail if not the root blog.
    123121    if ( ! bp_is_root_blog() ) {
    124122        return $object;
     
    160158 * @param array   $retval CSS classes for the current menu page in the menu.
    161159 * @param WP_Post $page   The page properties for the current menu item.
    162  *
    163160 * @return array
    164161 */
     
    170167    $page_id = false;
    171168
    172     // loop against all BP component pages
     169    // Loop against all BP component pages.
    173170    foreach ( (array) buddypress()->pages as $component => $bp_page ) {
    174         // handles the majority of components
     171        // Handles the majority of components.
    175172        if ( bp_is_current_component( $component ) ) {
    176173                    $page_id = (int) $bp_page->id;
    177174        }
    178175
    179         // stop if not on a user page
     176        // Stop if not on a user page.
    180177        if ( ! bp_is_user() && ! empty( $page_id ) ) {
    181178            break;
    182179        }
    183180
    184         // members component requires an explicit check due to overlapping components
     181        // Members component requires an explicit check due to overlapping components.
    185182        if ( bp_is_user() && 'members' === $component ) {
    186183            $page_id = (int) $bp_page->id;
     
    189186    }
    190187
    191     // duplicate some logic from Walker_Page::start_el() to highlight menu items
     188    // Duplicate some logic from Walker_Page::start_el() to highlight menu items.
    192189    if ( ! empty( $page_id ) ) {
    193190        $_bp_page = get_post( $page_id );
     
    218215 * @param array   $retval CSS classes for the current nav menu item in the menu.
    219216 * @param WP_Post $item   The properties for the current nav menu item.
    220  *
    221217 * @return array
    222218 */
     
    227223    }
    228224
    229     // get the WP page
     225    // Get the WP page.
    230226    $page   = get_post( $item->object_id );
    231227
    232     // see if we should add our highlight CSS classes for the page
     228    // See if we should add our highlight CSS classes for the page.
    233229    $retval = bp_core_menu_highlight_parent_page( $retval, $page );
    234230
     
    262258 * @param array $comments The array of comments supplied to the comments template.
    263259 * @param int   $post_id  The post ID.
    264  *
    265260 * @return array $comments The modified comment array.
    266261 */
     
    305300 * @param WP_User $user            The WP_User object corresponding to a successfully
    306301 *                                 logged-in user. Otherwise a WP_Error object.
    307  *
    308302 * @return string The redirect URL.
    309303 */
    310304function bp_core_login_redirect( $redirect_to, $redirect_to_raw, $user ) {
    311305
    312     // Only modify the redirect if we're on the main BP blog
     306    // Only modify the redirect if we're on the main BP blog.
    313307    if ( !bp_is_root_blog() ) {
    314308        return $redirect_to;
    315309    }
    316310
    317     // Only modify the redirect once the user is logged in
     311    // Only modify the redirect once the user is logged in.
    318312    if ( !is_a( $user, 'WP_User' ) ) {
    319313        return $redirect_to;
     
    340334    // If a 'redirect_to' parameter has been passed that contains 'wp-admin', verify that the
    341335    // logged-in user has any business to conduct in the Dashboard before allowing the
    342     // redirect to go through
     336    // redirect to go through.
    343337    if ( !empty( $redirect_to ) && ( false === strpos( $redirect_to, 'wp-admin' ) || user_can( $user, 'edit_posts' ) ) ) {
    344338        return $redirect_to;
     
    370364 *
    371365 * @param string $welcome_email Complete email passed through WordPress.
    372  *
    373366 * @return string Filtered $welcome_email with the password replaced
    374367 *                by '[User Set]'.
     
    376369function bp_core_filter_user_welcome_email( $welcome_email ) {
    377370
    378     // Don't touch the email when a user is registered by the site admin
     371    // Don't touch the email when a user is registered by the site admin.
    379372    if ( ( is_admin() || is_network_admin() ) && buddypress()->members->admin->signups_page != get_current_screen()->id ) {
    380373        return $welcome_email;
     
    385378    }
    386379
    387     // Don't touch the email if we don't have a custom registration template
     380    // Don't touch the email if we don't have a custom registration template.
    388381    if ( ! bp_has_custom_signup_page() ) {
    389382        return $welcome_email;
     
    408401 * @param int    $user_id       ID of the user joining.
    409402 * @param string $password      Password of user.
    410  *
    411403 * @return string Filtered $welcome_email with $password replaced by '[User Set]'.
    412404 */
    413405function bp_core_filter_blog_welcome_email( $welcome_email, $blog_id, $user_id, $password ) {
    414406
    415     // Don't touch the email when a user is registered by the site admin
     407    // Don't touch the email when a user is registered by the site admin.
    416408    if ( ( is_admin() || is_network_admin() ) && buddypress()->members->admin->signups_page != get_current_screen()->id ) {
    417409        return $welcome_email;
    418410    }
    419411
    420     // Don't touch the email if we don't have a custom registration template
     412    // Don't touch the email if we don't have a custom registration template.
    421413    if ( ! bp_has_custom_signup_page() )
    422414        return $welcome_email;
     
    440432 * @param string $user       The user's login name.
    441433 * @param string $user_email The user's email address.
    442  * @param string $key        The activation key created in wpmu_signup_blog()
     434 * @param string $key        The activation key created in wpmu_signup_blog().
    443435 * @param array  $meta       By default, contains the requested privacy setting and
    444436 *                           lang_id.
    445  *
    446437 * @return bool True on success, false on failure.
    447438 */
    448439function bp_core_activation_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta ) {
    449440
    450     // Set up activation link
     441    // Set up activation link.
    451442    $activate_url = bp_get_activation_page() ."?key=$key";
    452443    $activate_url = esc_url( $activate_url );
    453444
    454     // Email contents
     445    // Email contents.
    455446    $message = sprintf( __( "%1\$s,\n\n\n\nThanks for registering! To complete the activation of your account and blog, please click the following link:\n\n%2\$s\n\n\n\nAfter you activate, you can visit your blog here:\n\n%3\$s", 'buddypress' ), $user, $activate_url, esc_url( "http://{$domain}{$path}" ) );
    456447    $subject = bp_get_email_subject( array( 'text' => sprintf( __( 'Activate %s', 'buddypress' ), 'http://' . $domain . $path ) ) );
     
    504495    $message = apply_filters( 'bp_core_activation_signup_blog_notification_message', $message, $domain, $path, $title, $user, $user_email, $key, $meta );
    505496
    506     // Send the email
     497    // Send the email.
    507498    wp_mail( $to, $subject, $message );
    508499
    509     // Set up the $admin_email to pass to the filter
     500    // Set up the $admin_email to pass to the filter.
    510501    $admin_email = bp_get_option( 'admin_email' );
    511502
     
    528519    do_action( 'bp_core_sent_blog_signup_email', $admin_email, $subject, $message, $domain, $path, $title, $user, $user_email, $key, $meta );
    529520
    530     // Return false to stop the original WPMU function from continuing
     521    // Return false to stop the original WPMU function from continuing.
    531522    return false;
    532523}
     
    540531 * @param string $user       The user's login name.
    541532 * @param string $user_email The user's email address.
    542  * @param string $key        The activation key created in wpmu_signup_user()
     533 * @param string $key        The activation key created in wpmu_signup_user().
    543534 * @param array  $meta       By default, an empty array.
    544  *
    545535 * @return bool|string True on success, false on failure.
    546536 */
     
    548538
    549539    if ( is_admin() ) {
    550         // If the user is created from the WordPress Add User screen, don't send BuddyPress signup notifications
     540        // If the user is created from the WordPress Add User screen, don't send BuddyPress signup notifications.
    551541        if( in_array( get_current_screen()->id, array( 'user', 'user-network' ) ) ) {
    552             // If the Super Admin want to skip confirmation email
     542            // If the Super Admin want to skip confirmation email.
    553543            if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) {
    554544                return false;
    555545
    556             // WordPress will manage the signup process
     546            // WordPress will manage the signup process.
    557547            } else {
    558548                return $user;
     
    562552         * There can be a case where the user was created without the skip confirmation
    563553         * And the super admin goes in pending accounts to resend it. In this case, as the
    564          * meta['password'] is not set, the activation url must be WordPress one
     554         * meta['password'] is not set, the activation url must be WordPress one.
    565555         */
    566556        } elseif ( buddypress()->members->admin->signups_page == get_current_screen()->id ) {
     
    573563    }
    574564
    575     // Set up activation link
     565    // Set up activation link.
    576566    $activate_url = bp_get_activation_page() . "?key=$key";
    577567    $activate_url = esc_url( $activate_url );
    578568
    579     // Email contents
     569    // Email contents.
    580570    $message = sprintf( __( "Thanks for registering! To complete the activation of your account please click the following link:\n\n%1\$s\n\n", 'buddypress' ), $activate_url );
    581571    $subject = bp_get_email_subject( array( 'text' => __( 'Activate Your Account', 'buddypress' ) ) );
     
    620610    $message = apply_filters( 'bp_core_activation_signup_user_notification_message', $message, $user, $user_email, $key, $meta );
    621611
    622     // Send the email
     612    // Send the email.
    623613    wp_mail( $to, $subject, $message );
    624614
    625     // Set up the $admin_email to pass to the filter
     615    // Set up the $admin_email to pass to the filter.
    626616    $admin_email = bp_get_option( 'admin_email' );
    627617
     
    641631    do_action( 'bp_core_sent_user_signup_email', $admin_email, $subject, $message, $user, $user_email, $key, $meta );
    642632
    643     // Return false to stop the original WPMU function from continuing
     633    // Return false to stop the original WPMU function from continuing.
    644634    return false;
    645635}
     
    657647 * @param  string $sep         How to separate the various items within the page title.
    658648 * @param  string $seplocation Direction to display title.
    659  *
    660649 * @return string              New page title.
    661650 */
     
    663652    global $bp, $paged, $page, $_wp_theme_features;
    664653
    665     // If this is not a BP page, just return the title produced by WP
     654    // If this is not a BP page, just return the title produced by WP.
    666655    if ( bp_is_blog_page() ) {
    667656        return $title;
    668657    }
    669658
    670     // If this is a 404, let WordPress handle it
     659    // If this is a 404, let WordPress handle it.
    671660    if ( is_404() ) {
    672661        return $title;
    673662    }
    674663
    675     // If this is the front page of the site, return WP's title
     664    // If this is the front page of the site, return WP's title.
    676665    if ( is_front_page() || is_home() ) {
    677666        return $title;
    678667    }
    679668
    680     // Return WP's title if not a BuddyPress page
     669    // Return WP's title if not a BuddyPress page.
    681670    if ( ! is_buddypress() ) {
    682671        return $title;
    683672    }
    684673
    685     // Setup an empty title parts array
     674    // Setup an empty title parts array.
    686675    $title_parts = array();
    687676
     
    689678    $displayed_user_name = bp_get_displayed_user_fullname();
    690679
    691     // Displayed user
     680    // Displayed user.
    692681    if ( ! empty( $displayed_user_name ) && ! is_404() ) {
    693682
    694         // Get the component's ID to try and get its name
     683        // Get the component's ID to try and get its name.
    695684        $component_id = $component_name = bp_current_component();
    696685
    697         // Set empty subnav name
     686        // Set empty subnav name.
    698687        $component_subnav_name = '';
    699688
    700         // Use the component nav name
     689        // Use the component nav name.
    701690        if ( ! empty( $bp->bp_nav[$component_id] ) ) {
    702691            $component_name = _bp_strip_spans_from_title( $bp->bp_nav[ $component_id ]['name'] );
    703692
    704         // Fall back on the component ID
     693        // Fall back on the component ID.
    705694        } elseif ( ! empty( $bp->{$component_id}->id ) ) {
    706695            $component_name = ucwords( $bp->{$component_id}->id );
    707696        }
    708697
    709         // Append action name if we're on a member component sub-page
     698        // Append action name if we're on a member component sub-page.
    710699        if ( ! empty( $bp->bp_options_nav[ $component_id ] ) && ! empty( $bp->canonical_stack['action'] ) ) {
    711700            $component_subnav_name = wp_filter_object_list( $bp->bp_options_nav[ $component_id ], array( 'slug' => bp_current_action() ), 'and', 'name' );
     
    716705        }
    717706
    718         // If on the user profile's landing page, just use the fullname
     707        // If on the user profile's landing page, just use the fullname.
    719708        if ( bp_is_current_component( $bp->default_component ) && ( bp_get_requested_url() === bp_displayed_user_domain() ) ) {
    720709            $title_parts[] = $displayed_user_name;
    721710
    722         // Use component name on member pages
     711        // Use component name on member pages.
    723712        } else {
    724713            $title_parts = array_merge( $title_parts, array_map( 'strip_tags', array(
     
    727716            ) ) );
    728717
    729             // If we have a subnav name, add it separately for localization
     718            // If we have a subnav name, add it separately for localization.
    730719            if ( ! empty( $component_subnav_name ) ) {
    731720                $title_parts[] = strip_tags( $component_subnav_name );
     
    733722        }
    734723
    735     // A single group
     724    // A single group.
    736725    } elseif ( bp_is_active( 'groups' ) && ! empty( $bp->groups->current_group ) && ! empty( $bp->bp_options_nav[ $bp->groups->current_group->slug ] ) ) {
    737726        $subnav      = isset( $bp->bp_options_nav[ $bp->groups->current_group->slug ][ bp_current_action() ]['name'] ) ? $bp->bp_options_nav[ $bp->groups->current_group->slug ][ bp_current_action() ]['name'] : '';
    738727        $title_parts = array( $bp->bp_options_title, $subnav );
    739728
    740     // A single item from a component other than groups
     729    // A single item from a component other than groups.
    741730    } elseif ( bp_is_single_item() ) {
    742731        $title_parts = array( $bp->bp_options_title, $bp->bp_options_nav[ bp_current_item() ][ bp_current_action() ]['name'] );
    743732
    744     // An index or directory
     733    // An index or directory.
    745734    } elseif ( bp_is_directory() ) {
    746735        $current_component = bp_current_component();
    747736
    748         // No current component (when does this happen?)
     737        // No current component (when does this happen?).
    749738        $title_parts = array( _x( 'Directory', 'component directory title', 'buddypress' ) );
    750739
     
    753742        }
    754743
    755     // Sign up page
     744    // Sign up page.
    756745    } elseif ( bp_is_register_page() ) {
    757746        $title_parts = array( __( 'Create an Account', 'buddypress' ) );
    758747
    759     // Activation page
     748    // Activation page.
    760749    } elseif ( bp_is_activation_page() ) {
    761750        $title_parts = array( __( 'Activate Your Account', 'buddypress' ) );
    762751
    763     // Group creation page
     752    // Group creation page.
    764753    } elseif ( bp_is_group_create() ) {
    765754        $title_parts = array( __( 'Create a Group', 'buddypress' ) );
    766755
    767     // Blog creation page
     756    // Blog creation page.
    768757    } elseif ( bp_is_create_blog() ) {
    769758        $title_parts = array( __( 'Create a Site', 'buddypress' ) );
    770759    }
    771760
    772     // Strip spans
     761    // Strip spans.
    773762    $title_parts = array_map( '_bp_strip_spans_from_title', $title_parts );
    774763
    775     // sep on right, so reverse the order
     764    // Sep on right, so reverse the order.
    776765    if ( 'right' == $seplocation ) {
    777766        $title_parts = array_reverse( $title_parts );
    778767    }
    779768
    780     // Get the blog name, so we can check if the original $title included it
     769    // Get the blog name, so we can check if the original $title included it.
    781770    $blogname = get_bloginfo( 'name', 'display' );
    782771
     
    789778    $title_tag_compatibility = (bool) ( ! empty( $_wp_theme_features['title-tag'] ) || strstr( $title, $blogname ) );
    790779
    791     // Append the site title to title parts if theme supports title tag
     780    // Append the site title to title parts if theme supports title tag.
    792781    if ( true === $title_tag_compatibility ) {
    793782        $title_parts[] = $blogname;
     
    798787    }
    799788
    800     // Pad the separator with 1 space on each side
     789    // Pad the separator with 1 space on each side.
    801790    $prefix = str_pad( $sep, strlen( $sep ) + 2, ' ', STR_PAD_BOTH );
    802791
    803     // Join the parts together
     792    // Join the parts together.
    804793    $new_title = join( $prefix, array_filter( $title_parts ) );
    805794
    806     // Append the prefix for pre `title-tag` compatibility
     795    // Append the prefix for pre `title-tag` compatibility.
    807796    if ( false === $title_tag_compatibility ) {
    808797        $new_title = $new_title . $prefix;
     
    832821 * less than 4.0, and should be removed at a later date.
    833822 *
    834  * @param  string $title_part
    835  *
     823 * @param string $title_part Title part to clean up.
    836824 * @return string
    837825 */
     
    851839 *
    852840 * @param WP_Post $menu_item The menu item.
    853  *
    854841 * @return WP_Post The modified WP_Post object.
    855842 */
     
    859846    }
    860847
    861     // Prevent a notice error when using the customizer
     848    // Prevent a notice error when using the customizer.
    862849    $menu_classes = $menu_item->classes;
    863850
     
    867854
    868855    // We use information stored in the CSS class to determine what kind of
    869     // menu item this is, and how it should be treated
     856    // menu item this is, and how it should be treated.
    870857    preg_match( '/\sbp-(.*)-nav/', $menu_classes, $matches );
    871858
    872     // If this isn't a BP menu item, we can stop here
     859    // If this isn't a BP menu item, we can stop here.
    873860    if ( empty( $matches[1] ) ) {
    874861        return $menu_item;
     
    894881            break;
    895882
    896         // Don't show the Register link to logged-in users
     883        // Don't show the Register link to logged-in users.
    897884        case 'register' :
    898885            if ( is_user_logged_in() ) {
     
    903890
    904891        // All other BP nav items are specific to the logged-in user,
    905         // and so are not relevant to logged-out users
     892        // and so are not relevant to logged-out users.
    906893        default:
    907894            if ( is_user_logged_in() ) {
     
    914901    }
    915902
    916     // If component is deactivated, make sure menu item doesn't render
     903    // If component is deactivated, make sure menu item doesn't render.
    917904    if ( empty( $menu_item->url ) ) {
    918905        $menu_item->_invalid = true;
    919906
    920     // Highlight the current page
     907    // Highlight the current page.
    921908    } else {
    922909        $current = bp_get_requested_url();
     
    936923
    937924/**
    938  * Populate BuddyPress user nav items for the customizer
     925 * Populate BuddyPress user nav items for the customizer.
    939926 *
    940927 * @since  2.3.3
    941928 *
    942  * @param  array   $items  The array of menu items
    943  * @param  string  $type   The requested type
    944  * @param  string  $object The requested object name
    945  * @param  integer $page   The page num being requested
     929 * @param  array   $items  The array of menu items.
     930 * @param  string  $type   The requested type.
     931 * @param  string  $object The requested object name.
     932 * @param  integer $page   The page num being requested.
    946933 * @return array           The paginated BuddyPress user nav items.
    947934 */
     
    973960
    974961/**
    975  * Set BuddyPress item navs for the customizer
     962 * Set BuddyPress item navs for the customizer.
    976963 *
    977964 * @since  2.3.3
     
    1012999 *
    10131000 * @param string $q SQL query.
    1014  *
    10151001 * @return string
    10161002 */
     
    10441030 * @param  string $edit_link The edit link.
    10451031 * @param  int    $post_id   Post ID.
    1046  *
    10471032 * @return bool|string Will be a boolean (false) if $post_id is 0. Will be a string (the unchanged edit link)
    10481033 *                     otherwise
     
    10641049 * @param bool $load_mentions    True to load mentions assets, false otherwise.
    10651050 * @param bool $mentions_enabled True if mentions are enabled.
    1066  *
    10671051 * @return bool True if mentions scripts should be loaded.
    10681052 */
Note: See TracChangeset for help on using the changeset viewer.