I use wordpress with the buddypress plugin. I am making a plugin in which I have a button.
function bpbc_add_custom_buttons() {
global $bp;
$new_contact_button_args = array(
'id' => 'bpbc_new_contact',
'component' => 'members',
'must_be_logged_in' => true,
'block_self' => true,
'link_href' => esc_url( $bp->loggedin_user->domain . 'contacts/?id=' . $bp->displayed_user->id),
'link_text' => __( 'Add new contact' ),
);
echo bp_get_button( $new_contact_button_args );
}
add_action( 'bp_member_header_actions', 'bpbc_add_custom_buttons' );
This is what this button calls
function contacts_screen() {
add_action( 'bp_template_content', 'contacts_screen_content' );
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
}
function contacts_screen_content() { }
I can't retrieve the argement id that is in my link 'link_href' => esc_url($bp->loggedin_user->domain. 'contacts/?id='. $bp->displayed_user->id)
Thanks for your help
CodePudding user response:
Try:
function contacts_screen_content() {
if ( isset( $_GET['id'] ) ) {
echo 'id: ' . $_GET['id'];
}
}