BP_Nouveau::localize_scripts()

Load localizations for topic script.

Description

These localizations require information that may not be loaded even by init.

Source

File: bp-templates/bp-nouveau/buddypress-functions.php

591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
public function localize_scripts() {
    $params = array(
        'ajaxurl'             => bp_core_ajax_url(),
        'only_admin_notice'   => __( 'As you are the only organizer of this group, you cannot leave it. You can either delete the group or promote another member to be an organizer first and then leave the group.', 'buddyboss' ),
        'is_friend_confirm'   => __( 'Are you sure you want to remove your connection with this member?', 'buddyboss' ),
        'confirm'             => __( 'Are you sure?', 'buddyboss' ),
        'confirm_delete_set'  => __( 'Are you sure you want to delete this set? This cannot be undone.', 'buddyboss' ),
        'show_x_comments'     => __( 'View previous comments', 'buddyboss' ),
        'unsaved_changes'     => __( 'Your profile has unsaved changes. If you leave the page, the changes will be lost.', 'buddyboss' ),
        'object_nav_parent'   => '#buddypress',
    );
 
    // If the Object/Item nav are in the sidebar
    if ( bp_nouveau_is_object_nav_in_sidebar() ) {
        $params['object_nav_parent'] = '.buddypress_object_nav';
    }
 
    /**
     * Filters the supported BuddyPress Nouveau components.
     *
     * @since BuddyPress 3.0.0
     *
     * @param array $value Array of supported components.
     */
    $supported_objects = (array) apply_filters( 'bp_nouveau_supported_components', bp_core_get_packaged_component_ids() );
    $object_nonces     = array();
 
    foreach ( $supported_objects as $key_object => $object ) {
        if ( ! bp_is_active( $object ) || 'forums' === $object ) {
            unset( $supported_objects[ $key_object ] );
            continue;
        }
 
        if ( 'groups' === $object ) {
            $supported_objects = array_merge( $supported_objects, array( 'group_members', 'group_requests', 'group_subgroups' ) );
        }
 
        $object_nonces[ $object ] = wp_create_nonce( 'bp_nouveau_' . $object );
    }
 
    // Add components & nonces
    $params['objects'] = $supported_objects;
    $params['nonces']  = $object_nonces;
 
    // Used to transport the settings inside the Ajax requests
    if ( is_customize_preview() ) {
        $params['customizer_settings'] = bp_nouveau_get_temporary_setting( 'any' );
    }
 
    /**
     * Filters core JavaScript strings for internationalization before AJAX usage.
     *
     * @since BuddyPress 3.0.0
     *
     * @param array $params Array of key/value pairs for AJAX usage.
     */
    wp_localize_script( 'bp-nouveau', 'BP_Nouveau', apply_filters( 'bp_core_get_js_strings', $params ) );
}

Changelog

Changelog
Version Description
BuddyPress 3.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.