مرجع پارسی MyBB

نسخه‌ی کامل: پیشفرض کردن گزینه اول فیلد مشخصات [حل شد]
شما درحال مشاهده‌ی نسخه‌ی متنی این صفحه می‌باشید. مشاهده‌ی نسخه‌ی کامل با قالب‌بندی مناسب.
صفحه‌ها: 1 2 3
با سلام
دوستان چیکار منیم گزینه اول فیلد مشخصات به صورت پیشفرض برای همه انتخاب شده باشه بعد خودشون خواستن تغییر بدن

یعنی الان ما فیلد ایجاد کردیم یکی عضو شد به صورت پیشفرض گزینه اول فیلد مشخصات براش انتخاب شده

مثلا گذاشتیم سن را وارد کنید
مخفیانه
11
12
13
14

این مخفیانه الان باید انتخاب شده باشه چیکار کنیم؟
یکی از بزرگواران لطف کنه پاسخ مارو بده سپاسگزار میشم
خیلی لنگه این مشکل هستیم.
up Confused Confused
کسی نیست با هزینه انجام بده این کارو؟
باید دفالت لیست باکس رو روی مورد اول بذارید.(تو ویژال بیسیک که اینطوری بود Big Grin )
نمیدونم کجا و چطور اما هرجا باشه خارج از فایل ممبر نباید باشه.
و فکر هم کنم که به صورت select..case باشه.
باز دم شما گرم ی جواب دادید
یه تست خودتون بکنید ممنون میشم (به شدت برای سایت ما مهم هستش) والا تو سایت مادر زیاد اینچنین موارد دیدیم ولی سر درنیاوردیم.
این قسمت کد member.php کسی سر در میاره ؟

این موضوع هم انجام دادیم باز نشد ک نشد!
http://community.mybb.com/thread-89093.html


کد php:
        // Custom profile fields baby!
        
$altbg "trow1";
        
$query $db->simple_select("profilefields""*""editable=1", array('order_by' => 'disporder'));
        while(
$profilefield $db->fetch_array($query))
        {
            
$profilefield['type'] = htmlspecialchars_uni($profilefield['type']);
            
$thing explode("\n"$profilefield['type'], "2");
            
$type trim($thing[0]);
            
$options $thing[1];
            
$select '';
            
$field "fid{$profilefield['fid']}";
            if(
$errors)
            {
                
$userfield $mybb->input['profile_fields'][$field];
            }
            else
            {
                
$userfield '';
            }
            if(
$type == "multiselect")
            {
                if(
$errors)
                {
                    
$useropts $userfield;
                }
                else
                {
                    
$useropts explode("\n"$userfield);
                }
                if(
is_array($useropts))
                {        
                    foreach(
$useropts as $key => $val)
                    {
                        
$seloptions[$val] = $val;
                    }
                }
                
$expoptions explode("\n"$options);
                if(
is_array($expoptions)) 
                {
                    foreach(
$expoptions as $key => $val)
                    {
                        
$val trim($val);
                        
$val str_replace("\n""\\n"$val);

                        
$sel "";
                        if(
$val == $seloptions[$val])
                        {
                            
$sel "selected=\"selected\"";
                        }
                        
$select .= "<option value=\"$val\" $sel>$val</option>\n";
                    }
                    if(!
$profilefield['length'])
                    {
                        
$profilefield['length'] = 3;
                    }
                    
$code "<select name=\"profile_fields[$field][]\" id=\"{$field}\" size=\"{$profilefield['length']}\" multiple=\"multiple\">$select</select>";
                }
            }
            elseif(
$type == "select")
            {
                
$expoptions explode("\n"$options);
                if(
is_array($expoptions))
                {
                    foreach(
$expoptions as $key => $val)
                    {
                        
$val trim($val);
                        
$val str_replace("\n""\\n"$val);
                        
$sel "";
                        if(
$val == $userfield)
                        {
                            
$sel "selected=\"selected\"";
                        }
                        
$select .= "<option value=\"$val\" $sel>$val</option>";
                    }
                    if(!
$profilefield['length'])
                    {
                        
$profilefield['length'] = 1;
                    }
                    
$code "<select name=\"profile_fields[$field]\" id=\"{$field}\" size=\"{$profilefield['length']}\">$select</select>";
                }
            }
            elseif(
$type == "radio")
            {
                
$expoptions explode("\n"$options);
                if(
is_array($expoptions))
                {
                    foreach(
$expoptions as $key => $val)
                    {
                        
$checked "";
                        if(
$val == $userfield)
                        {
                            
$checked "checked=\"checked\"";
                        }
                        
$code .= "<input type=\"radio\" class=\"radio\" name=\"profile_fields[$field]\" id=\"{$field}{$key}\" value=\"$val\" $checked /> <span class=\"smalltext\">$val</span><br />";
                    }
                }
            }
            elseif(
$type == "checkbox")
            {
                if(
$errors)
                {
                    
$useropts $userfield;
                }
                else
                {
                    
$useropts explode("\n"$userfield);
                }
                if(
is_array($useropts))
                {
                    foreach(
$useropts as $key => $val)
                    {
                        
$seloptions[$val] = $val;
                    }
                }
                
$expoptions explode("\n"$options);
                if(
is_array($expoptions)) 
                {
                    foreach(
$expoptions as $key => $val)
                    {
                        
$checked "";
                        if(
$val == $seloptions[$val])
                        {
                            
$checked "checked=\"checked\"";
                        }
                        
$code .= "<input type=\"checkbox\" class=\"checkbox\" name=\"profile_fields[$field][]\" id=\"{$field}{$key}\" value=\"$val\" $checked /> <span class=\"smalltext\">$val</span><br />";
                    }
                }
            }
            elseif(
$type == "textarea")
            {
                
$value htmlspecialchars_uni($userfield);
                
$code "<textarea name=\"profile_fields[$field]\" id=\"{$field}\" rows=\"6\" cols=\"30\" style=\"width: 95%\">$value</textarea>";
            }
            else
            {
                
$value htmlspecialchars_uni($userfield);
                
$maxlength "";
                if(
$profilefield['maxlength'] > 0)
                {
                    
$maxlength " maxlength=\"{$profilefield['maxlength']}\"";
                }
                
$code "<input type=\"text\" name=\"profile_fields[$field]\" id=\"{$field}\" class=\"textbox\" size=\"{$profilefield['length']}\"{$maxlength} value=\"$value\" />";
            }
            if(
$profilefield['required'] == 1)
            {
                
// JS validator extra
                
if($type == "checkbox" || $type == "radio")
                {
                    
$id "{$field}0";
                }
                else
                {
                    
$id "fid{$profilefield['fid']}";
                }
                
$validator_extra .= "\tregValidator.register('{$id}', 'notEmpty', {failure_message:'{$lang->js_validator_not_empty}'});\n";
                
                eval(
"\$requiredfields .= \"".$templates->get("member_register_customfield")."\";");
            }
            
$code '';
            
$select '';
            
$val '';
            
$options '';
            
$expoptions '';
            
$useropts '';
            
$seloptions '';
        }
        if(
$requiredfields)
        {
            eval(
"\$requiredfields = \"".$templates->get("member_register_requiredfields")."\";");
        }
        if(!
$fromreg)
        {
            
$allownoticescheck "checked=\"checked\"";
            
$hideemailcheck '';
            
$emailnotifycheck '';
            
$receivepmscheck "checked=\"checked\"";
            
$pmnoticecheck " checked=\"checked\"";
            
$emailpmnotifycheck '';
            
$invisiblecheck '';
            if(
$mybb->settings['dstcorrection'] == 1)
            {
                
$enabledstcheck "checked=\"checked\"";
            }
            
        } 
کد:
elseif($type == "select")
           {
               $expoptions = explode("\n", $options);
               if(is_array($expoptions))
               {
                   foreach($expoptions as $key => $val)
                   {
                       $val = trim($val);
                       $val = str_replace("\n", "\\n", $val);
                       $sel = "";
                       if($val == $userfield)
                       {
                           $sel = "selected=\"selected\"";
                       }
                       $select .= "<option value=\"$val\" $sel>$val</option>";
                   }
                   if(!$profilefield['length'])
                   {
                       $profilefield['length'] = 1;
                   }
                   $code = "<select name=\"profile_fields[$field]\" id=\"{$field}\" size=\"{$profilefield['length']}\">$select</select>";
               }
           }

مربوط به این قسمته.

این پستش هم گفته که عمل کرده http://community.mybb.com/thread-89093-p...#pid650687
رفتم خونه رو لوکالم تست میکنم بازم.
گفته قبل از کد
کد:
foreach($expoptions as $key => $val)

این رو اضافه کن:
کد:
$select .= "<option value=\"\"></option>";
عرض کردیم بزرگوار انجام دادیم ولی تغییری حاص نشد بروی لوکال باز عضو میشیم گزینه اول فیلد خالیست و انتخاب نشده!
یکی از دوستان پلاگین نویس اگر میتونه با هزینه برامون انجام بده اعلام کنه
خیلی این قسمت برای سایت ما مهم هستش

http://mybbhacks.zingaburga.com/showthre...271&page=1
این نمیدونیم درچه مورد هستش ، صفحه 5 هم یک ایرانی armin3000 دقیقا سوال مارو پرسیده ولی جوابش نفهمیدیم چی دادن!!
چقدر پلاگین های خوب داره این سایت همه اختصاصی و فکر کنم همه رایگان
صفحه‌ها: 1 2 3