Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hooking into bp_get_options_nav


  • Roland Fauster
    Participant

    @rfauster

    Hi

    Is it possible to hook into the bp_get_options_nav() function and add another class parameter to the link in the button?

    I am trying to redirect links from Buddypress into an Ajax Window and using bp_custom.php lets me change the links really easily thanx to the filters

    add_filter( 'bp_get_activity_content', 'add_ajax_class2', 1 );	// Apply AjaxLink to Activity Content
    add_filter( 'bp_get_add_friend_button', 'add_ajax_class2', 1 ); // Apply AjaxLink to Friendbutton in Profile
    add_filter( 'bp_get_send_message_button', 'add_ajax_class2', 1 ); // Apply AjaxLink to SendMessage Button in Profile

    function class_replace_or_add($link)
    {
    $count = preg_match('/class=\"([^\"]*)\"/i', $link[0]);
    if($count > 0)
    {
    echo "test1";
    $content = preg_replace('/class=\"([^\"]*)\"/i','class="AjaxDivBox_Link"', $link);
    }
    else
    {
    $content = preg_replace('/<a href="([^\"]*)\"/i','<a href="$1" class="AjaxDivBox_Link"', $link);
    }

    return $content[0];
    }

    function add_ajax_class2($content)
    {
    $content = preg_replace_callback('/<a href="([^\"]*)"(?:[^>]*)>/i','class_replace_or_add',$content);
    return $content;
    }

    The existing buttons (like add friend etc) work like a charm but wherever I use bp_get_options_nav() to display the navigation, I can’t make any modifications.

    Is there a way to do this without changing Core Files?

    roland

  • The topic ‘Hooking into bp_get_options_nav’ is closed to new replies.
Skip to toolbar