出生地增加第三级县市和第四级乡镇 for discuz!x 1.5

修改两个文件:
source/include/spacecp/space_profile.php
source/function/function_profile.php

升级两条SQL:

ALTER TABLE `pre_common_member_profile` ADD `birthdist` VARCHAR( 255 ) NOT NULL AFTER `birthcity` ;

ALTER TABLE `pre_common_member_profile` ADD `birthcommunity` VARCHAR( 255 ) NOT NULL AFTER `birthdist` ;


修改方法:
一、打开space_profile.php文件,
查找:

	if($setarr) {
		DB::update('common_member_profile', $setarr, array('uid'=>$_G['uid']));
	}

上面加:

	//start	
	if(isset($_POST['birthdist'])) {
		$setarr['birthdist'] = trim($_POST['birthdist']);
	}
	if(isset($_POST['birthcommunity'])) {
		$setarr['birthcommunity'] = trim($_POST['birthcommunity']);
	}	
	//end

二、打开function_profile.php文件:
1.查找:

if($field['unchangeable'] && !empty($space[$fieldid])) {
			return ''.$space['birthprovince'].'-'.$space['birthcity'].'';
		}
		$values = array(0, 0);
		$elems = array('birthprovince', 'birthcity');
		if(!empty($space['birthprovince'])) {
			$html = profile_show('birthcity', $space);
			$html .= '  '.lang('spacecp', 'profile_edit').'';
			$html .= '

'; } else { $html = '

'.showdistrict($values, $elems, 'birthdistrictbox').'

'; }

替换为:

if($field['unchangeable'] && !empty($space[$fieldid])) {
			return ''.$space['birthprovince'].'-'.$space['birthcity'].'';
		}
		$values = array(0,0,0,0);
		$elems = array('birthprovince', 'birthcity', 'birthdist', 'birthcommunity');
		if(!empty($space['birthprovince'])) {
			$html = profile_show('birthcity', $space);
			$html .= '  '.lang('spacecp', 'profile_edit').'';
			$html .= '

'; } else { $html = '

'.showdistrict($values, $elems, 'birthdistrictbox').'

'; }

2.查找:

return $space['birthprovince'].' '.$space['birthcity'];

替换为:

		return $space['birthprovince']
				.(!empty($space['birthcity']) ? ' '.$space['birthcity'] : '')
				.(!empty($space['birthdist']) ? ' '.$space['birthdist'] : '')
				.(!empty($space['birthcommunity']) ? ' '.$space['birthcommunity'] : '');

Leave a Reply