Skip to:
Content

BuddyPress.org

Changeset 9664


Ignore:
Timestamp:
03/31/2015 04:19:19 AM (6 years ago)
Author:
tw2113
Message:

Adds hooks documentation for bp-core-filters.php and bp-core-catchuri.php, fixes version number.

See #5940.

Location:
trunk/src/bp-core
Files:
3 edited

Legend:

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

    r9559 r9664  
    5656        $path = esc_url( $_SERVER['REQUEST_URI'] );
    5757
    58     // Filter the path
     58    /**
     59     * Filters the BuddyPress global URI path.
     60     *
     61     * @since BuddyPress (1.0.0)
     62     *
     63     * @param string $path Path to set.
     64     */
    5965    $path = apply_filters( 'bp_uri', $path );
    6066
     
    328334        $retval = true;
    329335
     336    /**
     337     * Filters whether or not root profiles are enabled and allowed.
     338     *
     339     * @since BuddyPress (1.6.0)
     340     *
     341     * @param bool $retval Whether or not root profiles are available.
     342     */
    330343    return apply_filters( 'bp_core_enable_root_profiles', $retval );
    331344}
     
    371384    }
    372385
    373     // Filter the template locations so that plugins can alter where they are located
     386    /**
     387     * Filters the template locations.
     388     *
     389     * Allows plugins to alter where the template files are located.
     390     *
     391     * @since BuddyPress (1.1.0)
     392     *
     393     * @param string $template           Located template path.
     394     * @param array  $filtered_templates Array of templates to attempt to load.
     395     */
    374396    $located_template = apply_filters( 'bp_located_template', $template, $filtered_templates );
    375397    if ( !empty( $located_template ) ) {
     
    380402        $wp_query->is_404      = false;
    381403
     404        /**
     405         * Fires before the loading of a located template file.
     406         *
     407         * @since BuddyPress (1.6.0)
     408         *
     409         * @param string $located_template Template found to be loaded.
     410         */
    382411        do_action( 'bp_core_pre_load_template', $located_template );
    383412
     413        /**
     414         * Filters the selected template right before loading.
     415         *
     416         * @since BuddyPress (1.1.0)
     417         *
     418         * @param string $located_template Template found to be loaded.
     419         */
    384420        load_template( apply_filters( 'bp_load_template', $located_template ) );
    385421
     422        /**
     423         * Fires after the loading of a located template file.
     424         *
     425         * @since BuddyPress (1.6.0)
     426         *
     427         * @param string $located_template Template found that was loaded.
     428         */
    386429        do_action( 'bp_core_post_load_template', $located_template );
    387430
     
    402445        }
    403446
     447        /**
     448         * Fires if there are no found templates to load and theme compat is needed.
     449         *
     450         * @since BuddyPress (1.7.0)
     451         */
    404452        do_action( 'bp_setup_theme_compat' );
    405453    }
     
    411459function bp_core_catch_profile_uri() {
    412460    if ( !bp_is_active( 'xprofile' ) ) {
     461
     462        /**
     463         * Filters the path to redirect users to if XProfile is not enabled.
     464         *
     465         * @since BuddyPress (1.0.0)
     466         *
     467         * @param string $value Path to redirect users to.
     468         */
    413469        bp_core_load_template( apply_filters( 'bp_core_template_display_profile', 'members/single/home' ) );
    414470    }
     
    473529
    474530    $r = wp_parse_args( $args, $defaults );
     531
     532    /**
     533     * Filters the arguments used for user redirecting when visiting access controlled areas.
     534     *
     535     * @since BuddyPress (1.6.0)
     536     *
     537     * @param array $r Array of parsed arguments for redirect determination.
     538     */
    475539    $r = apply_filters( 'bp_core_no_access', $r );
    476540    extract( $r, EXTR_SKIP );
     
    529593    global $error;
    530594
     595    /**
     596     * Filters the error message for wp-login.php when needing to log in before accessing.
     597     *
     598     * @since BuddyPress (1.5.0)
     599     *
     600     * @param string $value Error message to display.
     601     * @param string $value URL to redirect user to after successful login.
     602     */
    531603    $error = apply_filters( 'bp_wp_login_error', __( 'You must log in to access the page you requested.', 'buddypress' ), $_REQUEST['redirect_to'] );
    532604
     
    555627function bp_redirect_canonical() {
    556628
     629    /**
     630     * Filters whether or not to do canonical redirects on BuddyPress URLs.
     631     *
     632     * @since BuddyPress (1.6.0)
     633     *
     634     * @param bool $value Whether or not to do canonical redirects. Default true.
     635     */
    557636    if ( !bp_is_blog_page() && apply_filters( 'bp_do_redirect_canonical', true ) ) {
    558637        // If this is a POST request, don't do a canonical redirect.
     
    655734        // the members directory to avoid redirect loops
    656735        } elseif ( bp_is_register_page() && 'register' == $front_page_component && is_user_logged_in() ) {
     736
     737            /**
     738             * Filters the logged in register page redirect URL.
     739             *
     740             * @since BuddyPress (1.5.1)
     741             *
     742             * @param string $value URL to redirect logged in members to.
     743             */
    657744            $bp->canonical_stack['canonical_url'] = apply_filters( 'bp_loggedin_register_page_redirect_to', bp_get_members_directory_permalink() );
    658745        }
     
    696783    }
    697784
     785    /**
     786     * Filters the canonical url of the current page.
     787     *
     788     * @since BuddyPress (1.6.0)
     789     *
     790     * @param string $canonical_url Canonical URL of the current page.
     791     * @param array  $args          Array of arguments to help determine canonical URL.
     792     */
    698793    return apply_filters( 'bp_get_canonical_url', $canonical_url, $args );
    699794}
     
    714809    }
    715810
     811    /**
     812     * Filters the URL as requested on the current page load by the user agent.
     813     *
     814     * @since BuddyPress (1.7.0)
     815     *
     816     * @param string $value Requested URL string.
     817     */
    716818    return apply_filters( 'bp_get_requested_url', $bp->canonical_stack['requested_url'] );
    717819}
  • trunk/src/bp-core/bp-core-filters.php

    r9471 r9664  
    9595        $pages[] = $bp->pages->forums->id;
    9696
     97    /**
     98     * Filters specific pages that shouldn't show up on page listings.
     99     *
     100     * @since BuddyPress (1.5.0)
     101     *
     102     * @param array $pages Array of pages to exclude.
     103     */
    97104    return apply_filters( 'bp_core_exclude_pages', $pages );
    98105}
     
    235242 */
    236243function bp_core_email_from_name_filter() {
     244
     245    /**
     246     * Filters the "From" name in outgoing email to the site name.
     247     *
     248     * @since BuddyPress (1.2.0)
     249     *
     250     * @param string $value Value to set the "From" name to.
     251     */
    237252    return apply_filters( 'bp_core_email_from_name_filter', bp_get_option( 'blogname', 'WordPress' ) );
    238253}
     
    301316    }
    302317
    303     // Allow plugins to allow or disallow redirects, as desired
     318    /**
     319     * Filters whether or not to redirect.
     320     *
     321     * Allows plugins to have finer grained control of redirect upon login.
     322     *
     323     * @since BuddyPress (1.6.0)
     324     *
     325    * @param bool    $value           Whether or not to redirect.
     326     * @param string  $redirect_to     Sanitized URL to be redirected to.
     327     * @param string  $redirect_to_raw Unsanitized URL to be redirected to.
     328     * @param WP_User $user            The WP_User object corresponding to a
     329     *                                 successfully logged in user.
     330     */
    304331    $maybe_redirect = apply_filters( 'bp_core_login_redirect', false, $redirect_to, $redirect_to_raw, $user );
    305332    if ( false !== $maybe_redirect ) {
     
    318345    }
    319346
     347    /**
     348     * Filters the URL to redirect users to upon successful login.
     349     *
     350     * @since BuddyPress (1.9.0)
     351     *
     352     * @param string $value URL to redirect to.
     353     */
    320354    return apply_filters( 'bp_core_login_redirect_to', bp_get_root_domain() );
    321355}
     
    415449    $subject = bp_get_email_subject( array( 'text' => sprintf( __( 'Activate %s', 'buddypress' ), 'http://' . $domain . $path ) ) );
    416450
    417     // Email filters
     451    /**
     452     * Filters the email that the notification is going to upon successful registration with blog.
     453     *
     454     * @since BuddyPress (1.2.0)
     455     *
     456     * @param string $user_email The user's email address.
     457     * @param string $domain     The new blog domain.
     458     * @param string $path       The new blog path.
     459     * @param string $title      The site title.
     460     * @param string $user       The user's login name.
     461     * @param string $user_email The user's email address.
     462     * @param string $key        The activation key created in wpmu_signup_blog().
     463     * @param array  $meta       Array of meta values for the created site.
     464     */
    418465    $to      = apply_filters( 'bp_core_activation_signup_blog_notification_to',   $user_email, $domain, $path, $title, $user, $user_email, $key, $meta );
     466
     467    /**
     468     * Filters the subject that the notification uses upon successful registration with blog.
     469     *
     470     * @since BuddyPress (1.2.0)
     471     *
     472     * @param string $subject    The subject to use.
     473     * @param string $domain     The new blog domain.
     474     * @param string $path       The new blog path.
     475     * @param string $title      The site title.
     476     * @param string $user       The user's login name.
     477     * @param string $user_email The user's email address.
     478     * @param string $key        The activation key created in wpmu_signup_blog().
     479     * @param array  $meta       Array of meta values for the created site.
     480     */
    419481    $subject = apply_filters( 'bp_core_activation_signup_blog_notification_subject', $subject, $domain, $path, $title, $user, $user_email, $key, $meta );
     482
     483    /**
     484     * Filters the message that the notification uses upon successful registration with blog.
     485     *
     486     * @since BuddyPress (1.2.0)
     487     *
     488     * @param string $message    The message to use.
     489     * @param string $domain     The new blog domain.
     490     * @param string $path       The new blog path.
     491     * @param string $title      The site title.
     492     * @param string $user       The user's login name.
     493     * @param string $user_email The user's email address.
     494     * @param string $key        The activation key created in wpmu_signup_blog().
     495     * @param array  $meta       Array of meta values for the created site.
     496     */
    420497    $message = apply_filters( 'bp_core_activation_signup_blog_notification_message', $message, $domain, $path, $title, $user, $user_email, $key, $meta );
    421498
     
    426503    $admin_email = bp_get_option( 'admin_email' );
    427504
     505    /**
     506     * Fires after the sending of the notification to new users for successful registration with blog.
     507     *
     508     * @since BuddyPress (1.5.0)
     509     *
     510     * @param string $admin_email Admin Email address for the site.
     511     * @param string $subject     Subject used in the notification email.
     512     * @param string $message     Message used in the notification email.
     513     * @param string domain       The new blog domain.
     514     * @param string $path        The new blog path.
     515     * @param string $title       The site title.
     516     * @param string $user        The user's login name.
     517     * @param string $user_email  The user's email address.
     518     * @param string $key         The activation key created in wpmu_signup_blog().
     519     * @param array  $meta        Array of meta values for the created site.
     520     */
    428521    do_action( 'bp_core_sent_blog_signup_email', $admin_email, $subject, $message, $domain, $path, $title, $user, $user_email, $key, $meta );
    429522
     
    480573    $subject = bp_get_email_subject( array( 'text' => __( 'Activate Your Account', 'buddypress' ) ) );
    481574
    482     // Email filters
     575    /**
     576     * Filters the email that the notification is going to upon successful registration without blog.
     577     *
     578     * @since BuddyPress (1.2.0)
     579     *
     580     * @param string $user_email The user's email address.
     581     * @param string $user       The user's login name.
     582     * @param string $user_email The user's email address.
     583     * @param string $key        The activation key created in wpmu_signup_blog().
     584     * @param array  $meta       Array of meta values for the created site.
     585     */
    483586    $to      = apply_filters( 'bp_core_activation_signup_user_notification_to',   $user_email, $user, $user_email, $key, $meta );
     587
     588    /**
     589     * Filters the subject that the notification uses upon successful registration without blog.
     590     *
     591     * @since BuddyPress (1.2.0)
     592     *
     593     * @param string $subject    The subject to use.
     594     * @param string $user       The user's login name.
     595     * @param string $user_email The user's email address.
     596     * @param string $key        The activation key created in wpmu_signup_blog().
     597     * @param array  $meta       Array of meta values for the created site.
     598     */
    484599    $subject = apply_filters( 'bp_core_activation_signup_user_notification_subject', $subject, $user, $user_email, $key, $meta );
     600
     601    /**
     602     * Filters the message that the notification uses upon successful registration without blog.
     603     *
     604     * @since BuddyPress (1.2.0)
     605     *
     606     * @param string $message    The message to use.
     607     * @param string $user       The user's login name.
     608     * @param string $user_email The user's email address.
     609     * @param string $key        The activation key created in wpmu_signup_blog().
     610     * @param array  $meta       Array of meta values for the created site.
     611     */
    485612    $message = apply_filters( 'bp_core_activation_signup_user_notification_message', $message, $user, $user_email, $key, $meta );
    486613
     
    491618    $admin_email = bp_get_option( 'admin_email' );
    492619
     620    /**
     621     * Fires after the sending of the notification to new users for successful registration without blog.
     622     *
     623     * @since BuddyPress (1.5.0)
     624     *
     625     * @param string $admin_email Admin Email address for the site.
     626     * @param string $subject     Subject used in the notification email.
     627     * @param string $message     Message used in the notification email.
     628     * @param string $user        The user's login name.
     629     * @param string $user_email  The user's email address.
     630     * @param string $key         The activation key created in wpmu_signup_blog().
     631     * @param array  $meta        Array of meta values for the created site. Default empty array.
     632     */
    493633    do_action( 'bp_core_sent_user_signup_email', $admin_email, $subject, $message, $user, $user_email, $key, $meta );
    494634
     
    624764    $title = preg_replace( '|<span>[0-9]+</span>|', '', $title );
    625765
     766    /**
     767     * Filters the page title for BuddyPress pages.
     768     *
     769     * @since BuddyPress (1.5.0)
     770     *
     771     * @param string $value       Determined title for the current BuddyPress page.
     772     * @param string $sep         Separator used for the BuddyPress page title.
     773     * @param string $seplocation Location to place the separator value.
     774     */
    626775    return apply_filters( 'bp_modify_page_title', $title . ' ' . $sep . ' ', $title, $sep, $seplocation );
    627776}
  • trunk/src/bp-core/classes/class-bp-core-notification.php

    r9486 r9664  
    1616 *
    1717 * @package BuddyPress Core
    18  * @deprecated since BuddyPress (1.9)
     18 * @deprecated since BuddyPress (1.9.0)
    1919 */
    2020class BP_Core_Notification {
Note: See TracChangeset for help on using the changeset viewer.