我試圖找出一種方法來添加如果條件註冊表單。目前登錄的用戶可以訪問註冊表單,這是不正確的。下面是一段代碼。不顯示註冊表單以登錄用戶
請注意,我的CMS是Wordpress。登記表上面
if (is_user_logged_in())
/* MAIN CODE HERE */
else
return "You are already logged in!";
但它只是最終顯示 '如果(is_user ......'
下面的代碼:
我使用嘗試。
<?php
if ('wwm-register.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('<h2>Direct File Access Prohibited</h2>');
function wwm_register_page() {
global $wpdb, $user_ID;
?>
FUNCTION TO DISPLAY PLANS</div>
<?php
return;
exit;
}
if (get_option('wwm_form_validator')) {
?>
FORM VALIDATION SCRIPT
<?php
}
$main_fields=get_option('wwm_main_fields');
$use_plugin_as=get_option('use_plugin_as');
if ($use_plugin_as!=='all') {
if($use_plugin_as=='membership') {
$type='membership';
$main_fields[0][show]='1'; //show username and pass and mail
}elseif($use_plugin_as=='order'){
$type='order';
$main_fields[0][show]='0'; //don't show username and pass and mail
}else{
$type='membership';
}
}
if (isset($_GET['type'])) {
if($_GET['type']=='membership') {
$type='membership';
$main_fields[0][show]='1'; //show username and pass and mail
}elseif($_GET['type']=='order'){
$type='order';
$main_fields[0][show]='0'; //don't show username and pass and mail
}
}
if ($type)
$planlist = $wpdb->get_results("SELECT id,title,price,description FROM ".WWM_PLANS_TABLE." WHERE display='1' AND plantype='".$type."'");
else
$planlist = $wpdb->get_results("SELECT id,title,price,description FROM ".WWM_PLANS_TABLE." WHERE display='1'");
if (isset($_POST['preview'])) $preview=$_POST['preview']; else $preview=0;
if (isset($_POST['username'])) $username=attribute_escape(strip_tags(stripslashes(strtolower(trim($_POST['username'])))));elseif (isset($_GET['username'])) $username=attribute_escape(strip_tags(stripslashes(strtolower(trim($_GET['username'])))));
if (isset($_POST['pass'])) $pass=attribute_escape(strip_tags(stripslashes((trim($_POST['pass'])))));
if (isset($_POST['pass2'])) $pass2=attribute_escape(strip_tags(stripslashes((trim($_POST['pass2'])))));
if (isset($_POST['email'])) $email=attribute_escape(strip_tags(stripslashes((trim($_POST['email'])))));elseif (isset($_GET['email'])) $email=attribute_escape(strip_tags(stripslashes(strtolower(trim($_GET['email'])))));
if (isset($_POST['companyname'])) $companyname=attribute_escape(strip_tags(stripslashes((trim($_POST['companyname'])))));
if (isset($_POST['fname'])) $fname=attribute_escape(strip_tags(stripslashes((trim($_POST['fname'])))));elseif (isset($_GET['fname'])) $fname=attribute_escape(strip_tags(stripslashes(strtolower(trim($_GET['fname'])))));
if (isset($_POST['lname'])) $lname=attribute_escape(strip_tags(stripslashes((trim($_POST['lname'])))));elseif (isset($_GET['lname'])) $lname=attribute_escape(strip_tags(stripslashes(strtolower(trim($_GET['lname'])))));
if (isset($_POST['nname'])) $nname=attribute_escape(strip_tags(stripslashes((trim($_POST['nname'])))));
if (isset($_POST['url'])) $url=attribute_escape(strip_tags(stripslashes((trim($_POST['url'])))));elseif (isset($_GET['url'])) $url=attribute_escape(strip_tags(stripslashes(strtolower(trim($_GET['url'])))));
if (isset($_POST['desc'])) $desc=attribute_escape(strip_tags(stripslashes((trim($_POST['desc'])))));elseif (isset($_GET['desc'])) $desc=attribute_escape(strip_tags(stripslashes(strtolower(trim($_GET['desc'])))));
if (isset($_POST['yahooim'])) $yahooim=attribute_escape(strip_tags(stripslashes((trim($_POST['yahooim'])))));
if (isset($_POST['aolim'])) $aolim=attribute_escape(strip_tags(stripslashes((trim($_POST['aolim'])))));
if (isset($_POST['jabberim'])) $jabberim=attribute_escape(strip_tags(stripslashes((trim($_POST['jabberim'])))));
if (isset($_POST['countryname'])) $countryname=attribute_escape(strip_tags(stripslashes((trim($_POST['countryname'])))));elseif (isset($_GET['countryname'])) $countryname=attribute_escape(strip_tags(stripslashes(strtolower(trim($_GET['countryname'])))));
if (isset($_POST['statename'])) $statename=attribute_escape(strip_tags(stripslashes((trim($_POST['statename'])))));
elseif (isset($_GET['statename'])) $statename=attribute_escape(strip_tags(stripslashes(strtolower(trim($_GET['statename'])))));
if (isset($_POST['cityname'])) $cityname=attribute_escape(strip_tags(stripslashes((trim($_POST['cityname'])))));
elseif (isset($_GET['cityname'])) $cityname=attribute_escape(strip_tags(stripslashes(strtolower(trim($_GET['cityname'])))));
if (isset($_POST['adrs'])) $adrs=attribute_escape(strip_tags(stripslashes((trim($_POST['adrs'])))));
elseif (isset($_GET['adrs'])) $adrs=attribute_escape(strip_tags(stripslashes(strtolower(trim($_GET['adrs'])))));
if (isset($_POST['adrs2'])) $adrs2=attribute_escape(strip_tags(stripslashes((trim($_POST['adrs2'])))));
elseif (isset($_GET['adrs2'])) $adrs2=attribute_escape(strip_tags(stripslashes(strtolower(trim($_GET['adrs2'])))));
if (isset($_POST['zipcode'])) $zipcode=attribute_escape(strip_tags(stripslashes((trim($_POST['zipcode'])))));
elseif (isset($_GET['zipcode'])) $zipcode=attribute_escape(strip_tags(stripslashes(strtolower(trim($_GET['zipcode'])))));
if (isset($_POST['telephone'])) $telephone=attribute_escape(strip_tags(stripslashes((trim($_POST['telephone'])))));
elseif (isset($_GET['telephone'])) $telephone=attribute_escape(strip_tags(stripslashes(strtolower(trim($_GET['telephone'])))));
if (isset($_POST['birthday'])) $birthday=attribute_escape(strip_tags(stripslashes((trim($_POST['birthday'])))));
if (isset($_POST['birthmonth'])) $birthmonth=attribute_escape(strip_tags(stripslashes((trim($_POST['birthmonth'])))));
if (isset($_POST['birthyear'])) $birthyear=attribute_escape(strip_tags(stripslashes((trim($_POST['birthyear'])))));
if (isset($_POST['gender'])) $gender=attribute_escape(strip_tags(stripslashes((trim($_POST['gender'])))));
if (isset($_POST['terms'])) $terms=attribute_escape(strip_tags(stripslashes((trim($_POST['terms'])))));
if (isset($_POST['avatar'])) $avatar=attribute_escape(strip_tags(stripslashes((trim($_POST['avatar'])))));
if (isset($_POST['plan'])) $plan=attribute_escape(strip_tags(stripslashes((trim($_POST['plan'])))));elseif (isset($_GET['plan'])) $plan=attribute_escape(strip_tags(stripslashes(strtolower(trim($_GET['plan'])))));
if (isset($_POST['captcha'])) $captcha=attribute_escape(strip_tags(stripslashes((trim($_POST['captcha'])))));
if (isset($_POST['promocode'])) $promocode=attribute_escape(strip_tags(stripslashes((trim($_POST['promocode'])))));elseif (isset($_GET['promocode'])) $promocode=attribute_escape(strip_tags(stripslashes(strtolower(trim($_GET['promocode'])))));
if (isset($_POST['payment_method'])) $payment_method=attribute_escape(strip_tags(stripslashes((trim($_POST['payment_method'])))));elseif (isset($_GET['payment_method'])) $payment_method=attribute_escape(strip_tags(stripslashes(strtolower(trim($_GET['payment_method'])))));
if (isset($_POST['blog_title'])) $blog_title=attribute_escape(strip_tags(stripslashes((trim($_POST['blog_title'])))));elseif (isset($_GET['blog_title'])) $blog_title=attribute_escape(strip_tags(stripslashes(strtolower(trim($_GET['blog_title'])))));
if (isset($_POST['blog_domain'])) $blog_domain=attribute_escape(strip_tags(stripslashes((trim($_POST['blog_domain'])))));elseif (isset($_GET['blog_domain'])) $blog_domain=attribute_escape(strip_tags(stripslashes(strtolower(trim($_GET['blog_domain'])))));
$last_id=wwm_get_fields_last_id('registration');
for ($i=1;$i<=$last_id;$i++){
$list=$wpdb->get_row("SELECT label,regex,req FROM ".WWM_FIELDS_TABLE." WHERE id={$i};");
if ($list) {
if (isset($_POST['custom-'.$i])) $custom_value[$i]=attribute_escape(stripslashes(strip_tags(trim($_POST['custom-'.$i]))));
elseif (isset($_GET['custom-'.$i])) $custom_value[$i]=attribute_escape(strip_tags(stripslashes(trim($_GET['custom-'.$i])))); $custom_regex[$i]=$list->regex;
$custom_req[$i]=$list->req;
$custom_label[$i]=$list->label;
$custom[$i][label]=$list->label;
$custom[$i][value]=$custom_value[$i];
if (isset($_POST['file-'.$i])) {
$file_custom_fields[]=$_POST['file-'.$i];
}
}
}
if (!get_option('wwm_users_can_register')) {
echo '<div class="wwm-errormessage" >'.__('Registration has been disabled.','wwm').'</div>';
$hidden=true;
}elseif((isset($_GET['action']))){
$hidden=true;
if (isset($_GET['method']) && 'twoco'==$_GET['method'])
include('include/payment_2co.php');
else
include('include/payment.php');
}elseif ((isset($_GET['mail'])) && (isset($_GET['activate_key']))) {
$hidden=true;
$user_data = get_user_by_email($_GET['mail']);
if ((get_usermeta($user_data->ID,'activate_key')==$_GET['activate_key']) && (get_usermeta($user_data->ID,'status')=='incomplete')){
update_usermeta($user_data->ID,'status','0');
delete_usermeta($user_data->ID,'activate_key');
$thanksmsg=__('Your account has been successfully activated.','wwm') . ' <a href="'.wp_login_url().'"> '.__('Log In').'</a>';
if (get_option('free_members_welcome_mail')) {
$to=$_GET['mail'];
$username=$user_data->user_login;
$fname=$user_data->first_name;
$lname=$user_data->last_name;
$expiredate=get_usermeta($user_data->ID,'expire');
$plan=get_usermeta($user_data->ID,'plan_id');
$planinfo=get_plan_info($plan);
$plantitle=$planinfo->title;
$blogname=get_option('blogname');
$subject='Welcome to '.$blogname.'!';
$body=get_option('free_members_welcome_mail_body');
$tags=array('{plantitle}','{expiredate}','{firstname}','{lastname}','{username}','{password}','{planid}');
$replace=array($plantitle,$expiredate,$fname,$lname,$username,$pass,$plan);
$body=str_replace($tags,$replace,$body);
$body.='<p>';
wwm_mail_actions('html'); //set actions
if (!wp_mail($to, $subject, $body, $header))
$msg= __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') ;
} //free members welcome
echo '<div class="wwm-thanksmessage">'.$thanksmsg.'</div>';
}elseif($user_data->ID && get_usermeta($user_data->ID,'status')!=='incomplete'){
$errormsg=__('We think you did it before!','wwm');
echo '<div class="wwm-errormessage" >'.$errormsg.'</div>';
}elseif((!$user_data->ID) ||get_usermeta($user_data->ID,'activate_key')!==$_GET['activate_key']){
$errormsg=__('Your activation key is not valid for the plan!','wwm');
echo '<div class="wwm-errormessage" >'.$errormsg.'</div>';
}
}
elseif ((isset($_POST['submit'])) || (isset($_POST['submit-upload']))) {
if (!wp_verify_nonce($_POST['wwm_form_noncename'], plugin_basename(__FILE__)))
return "Invalid nonce. Try agian.";
require_once(ABSPATH.'/wp-includes/registration.php');
//require_once(ABSPATH.'/wp-includes/pluggable.php');
if (isset($_POST['submit-upload'])) { //avatar
$override['test_form']=false;
$allowed=array(jpg,jpeg,jpe,gif,png);
$result=wwm_handle_upload($_FILES['avatarfile'],$override,100,$allowed); //100Kb means max upload size for avatars!
if (!$result['error']) {
require_once(ABSPATH.'/wp-admin/includes/image.php');
$site=get_option(siteurl);
$path=ABSPATH.'/wp-content/avatar/';
$urlpath=$site."/wp-content/avatar/";
if (!is_dir($path)) {
mkdir($path);//chmod($path,777);
}
$avatar_size=get_option('wwm_avatar_width');
$avatar=wwm_image_resize($result['file'],$avatar_size, $avatar_size, $crop=false, $suffix=$username.'avatar', $dest_path= $path, $jpeg_quality=75) ;
if (basename($avatar))
$avatar=$urlpath.basename($avatar);
else
$uploaderror.=$main_fields[20][name].': '.__('Image is very little.','wwm').'.<br/>';
}else{
$uploaderror.=$main_fields[20][name].': '.$result['error'].'.<br/>';
}
}
if ($file_custom_fields) {
foreach($file_custom_fields as $field_id) {
$override['test_form']=false;
$allowed=unserialize($wpdb->get_var($wpdb->prepare("SELECT options FROM ".WWM_FIELDS_TABLE." WHERE id=%s;",$field_id)));
$max_upload_size=get_site_option('fileupload_maxk', 1500);
$result=wwm_handle_upload($_FILES['custom-'.$field_id ],$override,$max_upload_size,$allowed);
if (!$result['error']) {
$custom_value[$field_id]=$result['url'];
}else{
if (!$_FILES['custom-'.$field_id ][error]=='4') { //error[4] means empty file
$msgerror.=$custom_label[$field_id].': '.$result['error'].'.<br/>';
$custom_value[$field_id]='error';
}
}
}
}
for ($i=1;$i<=$last_id;$i++){
if (((empty($custom_value[$i])) || ($custom_value[$i]==__('-Select-','wwm'))) && ($custom_req[$i]))
$msgerror.= sprintf(__('Please enter %s.', 'wwm'), $custom_label[$i])."<br/>";
}
if (($planlist) && (strlen($plan)<1)) $msgerror.=__('Please choose a plan.','wwm').'<br/>';
if ($main_fields[0][show]) {
if ((strlen($username)>20) || (strlen($username)<4)) $msgerror.=__('Please enter a username(at least 4 characters).','wwm').'<br/>';
if (username_exists($username)) $msgerror.=sprintf(__('%s already exists.', 'wwm'), $username)."<br/>";
if (!validate_username($username)) $msgerror.=sprintf(__('%s is not allowed.', 'wwm'), $username)."<br/>";
if ((strlen($pass)>30) || (strlen($pass)<6)) $msgerror.=__('Please enter a password(at least 6 characters).', 'wwm')."<br/>";
if ((empty($pass2)) || (strlen($pass2)>30) || ($pass!==$pass2)) $msgerror.=__('Please re-type password to confirm.', 'wwm')."<br/>";
}
if (($main_fields[1][show]) || ($main_fields[0][show])) {
if (($main_fields[1][req]) && (strlen($email)<6)) $msgerror.=__('Please enter a correct email address.', 'wwm')."<br/>";
if (($main_fields[1][req]) && (email_exists($email)) && ($type!=='order')) $msgerror.=__('That email already exists.', 'wwm')."<br/>";
if ((!wwm_validate_email($email)) && (!strlen($email)<6)) $msgerror.=__('Please enter a correct email address.', 'wwm')."<br/>";
}
if (($main_fields[2][req]) && (strlen($fname)<1)) $msgerror.=sprintf(__('Please enter %s.', 'wwm'), $main_fields[2][name])."<br/>";
if (($main_fields[3][req]) && (strlen($lname)<1)) $msgerror.=sprintf(__('Please enter %s.', 'wwm'), $main_fields[3][name])."<br/>";
if ((($main_fields[6][req]) && (strlen($url)<10)) || ((strlen($url)>1) &&
(!ereg('^(http|https|ftp)\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\-\._\?\,\'/\\\+&%\$#\=~])*$',$url))))
$msgerror.=__('Please enter a correct URL.', 'wwm')."<br/>";
if (($main_fields[4][req]) && (strlen($nname)<5)) $msgerror.=sprintf(__('Please enter %s.', 'wwm'), $main_fields[4][name])."<br/>";
if (($main_fields[18][req]) && (strlen($desc)<5)) $msgerror.=sprintf(__('Please enter %s.', 'wwm'), $main_fields[18][name])."<br/>";
if (($main_fields[7][req]) && (strlen($yahooim)<5)) $msgerror.=sprintf(__('Please enter %s.', 'wwm'), $main_fields[7][name])."<br/>";
if (($main_fields[8][req]) && (strlen($aolim)<5)) $msgerror.=sprintf(__('Please enter %s.', 'wwm'), $main_fields[8][name])."<br/>";
if (($main_fields[9][req]) && (strlen($jabberim)<5)) $msgerror.=sprintf(__('Please enter %s.', 'wwm'), $main_fields[9][name])."<br/>";
if (($main_fields[5][req]) && (strlen($companyname)<2)) $msgerror.=sprintf(__('Please enter %s.', 'wwm'), $main_fields[5][name])."<br/>";
if (($main_fields[12][req]) && (strlen($countryname)<1)) $msgerror.=__('Please choose your country.', 'wwm')."<br/>";
if (($main_fields[13][req]) && (strlen($statename)<1)) $msgerror.=sprintf(__('Please enter %s.', 'wwm'), $main_fields[13][name])."<br/>";
if (($main_fields[14][req]) && (strlen($cityname)<1)) $msgerror.=sprintf(__('Please enter %s.', 'wwm'), $main_fields[14][name])."<br/>";
if (($main_fields[15][req]) && (strlen($adrs)<1)) $msgerror.=sprintf(__('Please enter %s.', 'wwm'), $main_fields[15][name])."<br/>";
if (($main_fields[16][req]) && (strlen($zipcode)<1) ) $msgerror.=sprintf(__('Please enter %s.', 'wwm'), $main_fields[16][name])."<br/>";
if (($main_fields[17][req]) && (strlen($telephone)<1)) $msgerror.=sprintf(__('Please enter %s.', 'wwm'), $main_fields[17][name])."<br/>";
if ((($main_fields[10][req]) && (strlen($birthday)<1)) || (($main_fields[10][req]) && (strlen($birthmonth)<1)) || (($main_fields[10][req]) && (strlen($birthyear)<1))) $msgerror.=__('Please choose your birthdate.', 'wwm')."<br/>";
if (($main_fields[11][req]) && (strlen($gender)<1)) $msgerror.=__('Please choose your gender.', 'wwm')."<br/>";
if (($main_fields[19][show]) && (strlen($terms)<1) && ((!get_option('wwm_show_preview'))||($preview) && (get_option('wwm_show_preview')))) $msgerror.=sprintf(__('Please accept %s.', 'wwm'), $main_fields[19][name])."<br/>";
if (($main_fields[20][req]) && (strlen($avatar)<1)) $msgerror.=sprintf(__('Please upload a photo as %s.', 'wwm'), $main_fields[20][name])."<br/>";
if (($main_fields[22][req]) && (strlen($promocode)<1)) $msgerror.=sprintf(__('Please enter %s.', 'wwm'), $main_fields[22][name])."<br/>";
//if (($main_fields[100][show]) && (strlen($blog_domain)<4)) $msgerror.=sprintf(__('Please enter %s.', 'wwm'), $main_fields[100][name]) . ' '.__('(at least 4 characters)','wwm')." <br/>";
//if (($main_fields[100][show]) && (strlen($blog_title)<4)) $msgerror.=sprintf(__('Please enter %s.', 'wwm'), $main_fields[101][name]). ' '.__('(at least 4 characters)','wwm')." <br/>";
if (!get_option('wwm_users_can_register')) $msgerror.=__('Registration has been disabled.', 'wwm')."<br/>";
if (($main_fields[21][show]) && ((!get_option('wwm_show_preview'))||($preview) && (get_option('wwm_show_preview')))) {
$type=get_option('wwm_cap_type');
if ($type == 'simple'){
if (!class_exists(tam_captcha)) include('captcha/captcha.php');
$tam_captcha=new tam_captcha;
$check=$tam_captcha->check(attribute_escape($_POST['captcha-id']), $captcha);
$tam_captcha->remove(attribute_escape($_POST['captcha-id']));
if(!$check){
$msgerror.=sprintf(__('Please enter a correct %s.', 'wwm'), $main_fields[21][name])."<br/>";
}
} else if ($type == 'recap'){
require_once('captcha/recaptchalib.php');
$privatekey = get_option('wwm_recap_private');
$recap = rp_recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$recap->is_valid) {
$msgerror.=sprintf(__('Please enter a correct %s.', 'wwm'), $main_fields[21][name])."<br/>";
}
}
} //end if requires
} //end first if
if ($_POST['submit']) {
if ($planlist) {
$theplan = $wpdb->get_row($wpdb->prepare("SELECT title,price,duration,plantype FROM ".WWM_PLANS_TABLE." WHERE display='1' AND id=%s",$plan));
$planprice=$theplan->price;
$plantitle=$theplan->title;
$planduration=$theplan->duration;
$plantype=$theplan->plantype;
}
if ((strstr(basename($_SERVER['SCRIPT_FILENAME']),'admin.php')) && (is_admin())){
$planprice=0;
$admin=true; //free for backend page
}
if ($promocode) {
$promocode=strtolower($promocode);
$codes=get_option('wwm_discount_code');
$valid=false;
if ($codes) {
for ($id=1;$id<=MAX_DISCOUNT_NUM;$id++) {
if ($codes[$id][code]==$promocode) {
if (($codes[$id][plans][0]) && ($codes[$id][plans][0]!==',')) {
foreach($codes[$id][plans] as $codeid=>$codeplan) {
if($codeplan==$plan) {
$planprice=$planprice*((100-$codes[$id][percent])*(1/100));
$valid=true;
}
}
}else{
$valid=true;
$planprice=$planprice*((100-$codes[$id][percent])*(1/100));
}
}
}
}
if (!$valid)
$msgerror.=sprintf(__('%s is not valid.', 'wwm'), $main_fields[22][name])."<br/>";
}
}
if (empty($msgerror) && ($_POST['submit'])) {
$user_login = $username;
$user_email = $email;
$user_pass = $pass;
$user_nicename=$nname;
$user_url=$url;
$display_name=$user_nicename;
$first_name=$fname;
$last_name=$lname;
$description=$desc;
//$role=''; leave to default userrole
//$rich_editing=true;
$yim=$yahooim;
$aim=$aolim;
$jabber=$jabberim;
if ( ($planprice<=0)&& ($type!='order') && ($plantype!='order')) {
$userdata = compact('user_login', 'user_email', 'user_pass','user_nicename','user_url','display_name','first_name','last_name','description','yim','aim','jabber');
$id=wp_insert_user($userdata);
update_usermeta($id,'company',$companyname);
update_usermeta($id,'country',$countryname);
update_usermeta($id,'state',$statename);
update_usermeta($id,'city',$cityname);
update_usermeta($id,'address',$adrs);
update_usermeta($id,'address2',$adrs2);
update_usermeta($id,'zip',$zipcode);
update_usermeta($id,'phone',$telephone);
if (($birthyear)&&($birthmonth)&&($birthday)) $birthdate=$birthyear.'-'.$birthmonth.'-'.$birthday.' 00:00:00';
update_usermeta($id,'birthday',$birthdate);
update_usermeta($id,'gender',$gender);
update_usermeta($id,'last_ip', $_SERVER['REMOTE_ADDR']);
update_usermeta($id,'status','');
update_usermeta($id,'plan_id',$plan);
update_usermeta($id,'avatar',$avatar);
update_usermeta($id,'promocode',$promocode);
if ($planduration)
$expiredate = date("Y-m-d H:i:s",strtotime('+'.$planduration.'day')); else $expiredate=0;
update_usermeta($id,'expire',$expiredate);
for ($i=1;$i<=$last_id;$i++) {
if (($custom_label[$i]) && ($custom_value[$i]))
update_usermeta($id,'customfield_'.$i,$custom_value[$i]);
}
do_action('wwm_free_member_registered',$id);
發送電子郵件
wwm_mail_actions('html'); //set actions
if (!wp_mail($to, $subject, $body, $header))
$msg= __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') ;
} //end verify mail
$thanksmsg=__('Thank you for your registration.','wwm')."<br/>";
/* NOTIFY ON註冊會員* /} } } 其他{//否則,如果有錯誤
if (($msgerror)&&(isset($_POST['submit']))) echo '<div class="wwm-errormessage" >'.$msgerror.'</div>';
if ($uploaderror) echo '<div class="wwm-errormessage" >'.$uploaderror.'</div>';
if (!$hidden) {
do_action('wwm_register_header');
?>
<div class="wwm_register_page">
/登記表/
<?php
}//end if
}//end of hidden
}
?>
有點看起來很可怕,有很多重複的代碼 – ianace 2011-04-25 08:55:44
我建議把所有'if(isset($ _ POST')放在'foreach()'中簡化一下,有點傷害我的眼睛看重複的代碼 – ianace 2011-04-25 09:03:47
Thanks ianace。 。需要清理代碼相當多..不是一個能幹的PHP程序員..只是一個初學者 – Sledge81 2011-04-25 09:13:45