Search code examples
phpwordpressbuddypress

how to set a function's value in array in Wordpress?


I am working in wordpress and using buddypress theme. In my php file i want to set value of a buddy press functions into an array parameter like following

PLUGIN_METHOD( array( 'Para1' => 'Value1', 'Para2' => bp_activity_user_link()));

But i am unable to set value of function's into array.

Please suggest me right way.

Thanks in advance!


Solution

  • That function echos the result and returns void, so it won't get passed to the array. Use this function:

    bp_get_activity_user_link();


    Ok, last try :). It's possible your version of BP doesn't have that function. You can try this:

    ob_start();
    bp_activity_user_link();
    $link_out = ob_get_contents();
    ob_end_clean();
    PLUGIN_METHOD( array( 'Para1' => 'Value1', 'Para2' => $link_out));