Hi, David:
Thanks for the reply, I made up one according to your template:
*But I am kinda lost on what to put on the first part?which is the code below
“//put a function here to get whatever name…”
However, what I did is here, is that correct?
What I intent to do:
1. The user will has a single client specific page LINK created (the link will be able to access through a specific short code) once the user name is registered. However the PAGE itself is NOT exist yet, so that why there is 404 page after login, because login-welcome-page is setup as “http://mysite.com/%%current_user_login%%/”.
I need to maintain this address inside the login-welcome-page to let the client portal runs.
2.The code you gave me seem will achieve the purpose but I don’t really get the meaning of the first part. please help thanks again!
Btw the page slug means I need to use page id? or simply the page’s link? my profile page link is simply http://www.abc.com/trial/profile, so I replace all the slug with profile, is that accurate? or should I replace it with page id?
Below is modification:
<?php
add_action('find the right hook','my_login_function');
function my_login_function($user_id){
//put a function here to get whatever name or username or id or whatever you are using as the page title.
$sql = "";
$un = mysql_fetch_array(mysql_query($sql));
$username = $un[''];
//Check to see if there is a page with that title in the system.
$sql = "SELECT ID FROM wp_posts WHERE post_title = '".$username."' AND post_status = 'publish' AND post_type = 'page' LIMIT 1";
$count = mysql_num_rows(mysql_query($sql));
if($count == 1){
//Change the username to a slug like the page
$page_slug = strtolower($profile);
$page_slug = str_replace(' ','-',$profile);
wp_redirect(site_url($profile));
}
else {
wp_redirect(site_url('id="http://mysite.com/trail1/profile/"')); //replace profile with your profile page slug
}
}
?>