Skip to:
Content
Pages
Categories
Search
Top
Bottom

Javascript on Custom Tab in Profile

  • @plet9090

    Participant

    I want to add this Google Maps API javascript code to the map tab on my website for each user, but don’t know how to add it. I have a map on my homepage at http://www.tothenationsworldwide.com . Using the register and enqueue functions in my functions.php file and adding the code on the homepage. I don’t know how to do this in my bp-custom.php file though. If I register and enqueue my script there, how do I add the script code to it? Here is the code I have in my bp-custom.php for the map and my map sub tab:
    <?php
    // hacks and mods will go here
    //add maintab
    function profile_new_nav_item() {

    global $bp;

    bp_core_new_nav_item(
    array(
    ‘name’ => ‘Map’,
    ‘slug’ => ‘map_tab’,
    ‘position’ => ’30’,
    ‘default_subnav_slug’ => ‘map_tab’, // We add this submenu item below
    ‘screen_function’ => ‘view_manage_tab_main’
    )
    );
    }

    add_action( ‘bp_setup_nav’, ‘profile_new_nav_item’, 10 );

    function view_manage_tab_main() {
    add_action( ‘bp_template_content’, ‘bp_template_content_main_function’ );
    bp_core_load_template( ‘template_content’ );
    }

    function bp_template_content_main_function() {
    if ( ! is_user_logged_in() ) {
    wp_login_form( array( ‘echo’ => true ) );
    }
    }

    //add sub tab01
    function profile_new_subnav_item() {
    global $bp;

    bp_core_new_subnav_item( array(
    ‘name’ => ‘My Map’,
    ‘slug’ => ‘mymap_tab’,
    ‘parent_url’ => $bp->displayed_user->domain . $bp->bp_nav[ ‘map_tab’ ][ ‘slug’ ] . ‘/’,
    ‘parent_slug’ => $bp->bp_nav[ ‘map_tab’ ][ ‘slug’ ],
    ‘position’ => 10,
    ‘screen_function’ => ‘view_manage_sub_tab_main’
    ) );
    }
    add_action( ‘bp_setup_nav’, ‘profile_new_subnav_item’, 10 );

    function view_manage_sub_tab_main() {
    add_action( ‘bp_template_content’, ‘bp_map’ );
    bp_core_load_template( ‘template_content’ );
    }

    function bp_map() {
    if ( is_user_logged_in() ) {
    //Add shortcode to display content in sub tab

    } else {
    wp_login_form( array( ‘echo’ => true ) );
    }
    }
    ?>

  • The topic ‘Javascript on Custom Tab in Profile’ is closed to new replies.
Skip to toolbar