Generating custom URL before post is published

I think the post needs to be inserted first. This is a sample function that updates the post slug after it’s been inserted.

// Update post slug
$my_post['ID'] = $pid;
$my_post_name="post_name" . "-" . $pid;
$my_post['post_name'] .= $my_post_name;

// Update the post into the database
wp_update_post( $my_post )

It’s combining the post_name with post ID to create the URL. You also may want to look at http://codex.wordpress.org/Function_Reference/register_post_type which goes over the options for setting slugs. I’m not sure if you want to allow your members to be able to set their own permalink or if you want that disabled and to have it generated in the background.