Discuz x2 Personal Data sorting problem resolution, adding custom fields, modifying column names, and introducing

Source: Internet
Author: User

First write articles, hope and people to provide convenient at the same time, do not fraught, their own research, we do not understand only change the document can be, if found wrong place please reply or directly notify me, thank you, originally want to discuz forum on the hair, do not understand the version of the rules also do not have time to see the version of the rules, afraid of (i) Personal data item sorting problem solving method

First explain the situation, yesterday in doing the website's personal data item found backstage can be set sort of (figure a) the larger the number down, but the user page (Figure 2) is always the same, such as the newly added field to let him rank first, in the internet for a long time did not search (perhaps I will not search) to see the majority of days Understand the point,

(Fig. 2) (Figure 2 Modified effect) The principle of personal data sequencing: The data items under each tab (the baby data) are stored in the database in the form of a serial number after the array, so it is no longer possible to sort (sorting is also handled alphabetically in the array, which is also inconvenient), Looking at the file include/spacecp/spacecp_profile.php file, we observed that it first gets each of the large subordinate items in the form of an array, and then gets the HTML code for each of the small items (that is, the text box, the drop-down box). After we get the small item, we sort the order of each small item in the array according to the principle background setting, and then get the HTML code. Step: Open the spacecp_profile.php file below approximately 423 lines (search for the following code can also) $htmls = $settings = Array (); Add the following code://Two Development <<< Profile Modification page Options sorting problem solving$noorder = Array (' Idcardtype ', ' idcard ', ' zipcode ', ' sightml ', ' customstatus ', ' timeoffset ');$jiaoji = Array_intersect ($noorder, $allowitems);//calculates the intersection of two arrays, without calculating the personal signature and time zone does not appearif (empty ($jiaoji)) {$query = Db::query (' SELECT fieldid from '. Db::table (' common_member_profile_setting '). " WHERE FieldID in (". Dimplode ($allowitems).") ORDER by Displayorder ASC "); $allowitems =array ();//Empty The array of the original small items to sort the new arraywhile ($value = Db::fetch ($query)) {$allowitems [$value [' fieldid ']] = $value [' FieldID '];}} //Two-time development >>>*/Calculate the intersection problem $jiaoji because, but do not calculate, the personal signature and the area does not seem to show, the intersection of other elements I do not know is the above understand, anyway, I realized the effect, you see where the need to modify it. (ii) Add N more Custom fieldsOriginally Discu x2 Self-defined only 8, such as I am not happy today, the mind is more perverted, want to add dozens of how to do, in the data table
    • Pre_common_member_profile
    • Pre_common_member_profile_setting
    • In both tables add FIELD9 to FIELDN as for N to a few look at you then the mood is more perverted, you can, right must see the following (iii)
(c) Modification of the column name and column introductionDiscux system comes with the column and column introduction is not to be modified, we add the addition of FIELDN is not to be modified, to modify the words can be changed in the database one by one, this is more troublesome, modify the method: Open Source/admincp/admincp_ members.php Search: $field [' customable '] = Preg_match ('/^field[1-8]$/i ', $fieldid); Just modify our newly added field custom field to modify the column name and description method ([ 1-8] Change to \d+) $field [' customable '] = Preg_match ('/^field\d+$/i ', $fieldid); Modify all fields of the system; $field [' customable '] = Preg_match ('/.*/I ', $fieldid); This can be very convenient to modify the column name and introduced O (∩_∩) o~ (System of the original education section can be modified)

Discuz x2 Personal Data sorting problem resolution, adding custom fields, modifying column names, and introducing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.