Re: Make your own custom BuddyPress page
Nope. For an xtra profile page you’ll need to use something like this:
/**
* Setup update location nav item
* @since 1.0
*/
function sv_xprofile_xtra_nav()
{
global $bp;
$profile_link = $bp->loggedin_user->domain . $bp->profile->slug . '/';
bp_core_new_subnav_item( array( 'name' => __( 'Update Location', 'scuba' ), 'slug' => 'update-location', 'parent_url' => $profile_link, 'parent_slug' => $bp->profile->slug, 'screen_function' => 'sv_screen_update_location', 'position' => 15 ) );
}
add_action( 'xprofile_setup_nav', 'sv_xprofile_xtra_nav' );
/**
* Display location update screen
* @since 1.0
*/
function sv_screen_update_location()
{
if ( !bp_is_home() && !is_site_admin() )
return false;
/* Check to see if any new information has been submitted */
if( isset( $_POST['save'] ) )
{
/* Check the nonce */
check_admin_referer( 'sv_profile_update_location' );
if( $_POST['user_lat'] && ! $_POST['user_long'] || ! $_POST['user_lat'] && $_POST['user_long'] )
{
bp_core_add_message( __( 'You need to provide both a latitude and a longitude.', 'scuba' ), 'error' );
$error = true;
}
if( ! $error )
{
$lat = apply_filters( 'sv_sanitize_user_input', $_POST['user_lat'] );
$long = apply_filters( 'sv_sanitize_user_input', $_POST['user_long'] );
$id = apply_filters( 'sv_sanitize_user_input', $_POST['user_id'] );
$loc = array(
'user_lat' => $lat,
'user_long' => $long
);
update_usermeta( $id, 'user_location', $loc );
bp_core_add_message( __( 'Your location has been updated!', 'buddypress' ) );
do_action( 'sv_successful_location_update' );
}
}
bp_core_load_template( apply_filters( 'sv_xprofile_template_update_location', 'profile/location' ) );
}
Then you obviously need a template file as well in your theme in the profiles folder. I use the above code to let the user pick his geo position on a google map and then I display the users on a flash map on the members directory page.