• Welcome to Simple Machines Community Forum. Please login or sign up.
October 26, 2021, 03:05:09 AM

News:

SMF 2.0.18 has been released! Please update. Read more.


Profile Fields - Names truncated in the Themes table

Started by Randem, February 15, 2014, 02:17:26 AM

Previous topic - Next topic

Randem

I just started using Custom Profile Fields and every name over 6 characters is truncated in the Themes table (variable column) after the system prefixes the name with "cust_". This is happening even though the variable field in the Themes table is defined as varchar (255). The system will also add a zero after truncation if the name is duplicated after truncation.  ???

cust_zip - Originally defined as "zip"
cust_zip0 - Originally defined as "zip+4" or "zip_4"

cust_deceas - Originally defined as "deceased"
cust_deceas0 - Originally defined as "deceased_date"

The reason this is a problem is I am porting information from another system into SMF and it would help if the names did not change from the original names entered. :(

What is the reason for the truncation to 6 characters??? How can I overcome this issue?

I am using SMF 2.0.7. Have not tested SMF 2.0.6...
https://randemsystems.com/support/       -   Discusware to SMF Converter / BotBanish Support
https://blaxtonjames.com                         - Money, Knowledge And Power; Why You Are Missing All Three
https://joystickgangsta.com                      - An Experience You Can't Refuse
https://botbanish.com                                 - The Ultimate BOT Defender for SMF, OpenCart, WordPress  & Websites

Always ignore those who attempt to tell you what to think and believe those who will allow you think for yourself

Randem

Did some more research and found that the custom_fields table has a column named "col_name" which is defined as varchar(12). Is there a reason that this field is so small (legacy). What are the ramifications of changing this field length to a bigger number say 30-50?
https://randemsystems.com/support/       -   Discusware to SMF Converter / BotBanish Support
https://blaxtonjames.com                         - Money, Knowledge And Power; Why You Are Missing All Three
https://joystickgangsta.com                      - An Experience You Can't Refuse
https://botbanish.com                                 - The Ultimate BOT Defender for SMF, OpenCart, WordPress  & Websites

Always ignore those who attempt to tell you what to think and believe those who will allow you think for yourself

margarett

It's not a bug, it's a feature :P Why, I don't know...

It has 2 places to being changed: the "custom_fields" table where the field is defined, and the "themes" table where the actual member values are stored.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Randem

Yeah  8), I changed the field length and no Joy. There has to be something in the code that truncates the field... Looking for it now...

Odd thing is that it is varchar(255) in Themes...
https://randemsystems.com/support/       -   Discusware to SMF Converter / BotBanish Support
https://blaxtonjames.com                         - Money, Knowledge And Power; Why You Are Missing All Three
https://joystickgangsta.com                      - An Experience You Can't Refuse
https://botbanish.com                                 - The Ultimate BOT Defender for SMF, OpenCart, WordPress  & Websites

Always ignore those who attempt to tell you what to think and believe those who will allow you think for yourself

Randem

Found the change area in ManageSettings.php line 1705. Changed

$colname = $smcFunc['substr'](strtr($_POST['field_name'], array(' ' => '')), 0, 6);

to

$colname = $smcFunc['substr'](strtr($_POST['field_name'], array(' ' => '')), 0, 50);

and changed the table "custom_fields" field name "col_name" to varchar(50). Ths allowed the full name to be entered into the column.

Thanks for the verification.
https://randemsystems.com/support/       -   Discusware to SMF Converter / BotBanish Support
https://blaxtonjames.com                         - Money, Knowledge And Power; Why You Are Missing All Three
https://joystickgangsta.com                      - An Experience You Can't Refuse
https://botbanish.com                                 - The Ultimate BOT Defender for SMF, OpenCart, WordPress  & Websites

Always ignore those who attempt to tell you what to think and believe those who will allow you think for yourself

margarett

Quote from: Randem on February 15, 2014, 04:40:31 AM
Odd thing is that it is varchar(255) in Themes...
That's because the column is generic, it stores values from several other fields
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Randem

Yes I know... The point I was attempting t make was that the definitions went from minimal (12) to overkill (255) for field lengths. I don't remember when the last time a 12 character field name was used. I believe it was in the 80's in COBOL... ::) (8 character filename and a 3 character extension)  :o
https://randemsystems.com/support/       -   Discusware to SMF Converter / BotBanish Support
https://blaxtonjames.com                         - Money, Knowledge And Power; Why You Are Missing All Three
https://joystickgangsta.com                      - An Experience You Can't Refuse
https://botbanish.com                                 - The Ultimate BOT Defender for SMF, OpenCart, WordPress  & Websites

Always ignore those who attempt to tell you what to think and believe those who will allow you think for yourself

Oldiesmann

To be honest I've never understood why SMF picks the "name" for that field anyway. It seems like it would make more sense to allow the user to pick that (while still adding "cust_" to the beginning to prevent conflicts), especially for site integration purposes. Maybe this is something we can change for 2.1.
Michael Eshom
Cincy Space - now open!

Randem

Actually SMF does allow the user to pick the name but then SMF proceeds to bastardize the name for no apparent reason. Legacy name conventions have not been really used for about 20 years now. No reason for 8.3 naming conventions...

SMF's intention was to eliminate duplicate field names...
https://randemsystems.com/support/       -   Discusware to SMF Converter / BotBanish Support
https://blaxtonjames.com                         - Money, Knowledge And Power; Why You Are Missing All Three
https://joystickgangsta.com                      - An Experience You Can't Refuse
https://botbanish.com                                 - The Ultimate BOT Defender for SMF, OpenCart, WordPress  & Websites

Always ignore those who attempt to tell you what to think and believe those who will allow you think for yourself

Advertisement: