[SOLVED] proper name format (first letter capitalized)?

12 years 3 months ago - 11 years 11 months ago #191048 by ThePiston
Is it possible to ensure that a user doesn't use all lower case or all upper case in a field? I'd like to save certain fields with first letter of each word capitalized if possible.

CB 2.3, CBsubs 4.3, PHP 7.1, J! 3.9.X

Please Log in to join the conversation.

12 years 3 months ago #191100 by krileon
You could use CB Auto Action with a query action and uppercase the first letter of the string/column after the registration trigger. This would automate the process. I believe I've posted a query to upper case the first letter and lowercase the rest, but you'll have to search as can't recall the thread.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

12 years 3 months ago #191113 by ThePiston
searched hi and low but found no query.

how about this?

UPDATE #__comprofiler
SET firstname =
CONCAT(UCASE(substr(firstname,1,1)), substr(firstname,2));

CB 2.3, CBsubs 4.3, PHP 7.1, J! 3.9.X

Please Log in to join the conversation.

12 years 3 months ago #191142 by krileon
Confirmed the below works.

First letter uppercase:
UPDATE `#__comprofiler` SET `firstname` = CONCAT( UCASE( substr( `firstname`, 1, 1 ) ), substr( `firstname`, 2 ) ) WHERE `id` = '[user_id]'

First letter uppercase and rest lowercase:
UPDATE `#__comprofiler` SET `firstname` = CONCAT( UCASE( substr( `firstname`, 1, 1 ) ), LCASE( substr( `firstname`, 2 ) ) ) WHERE `id` = '[user_id]'


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: ThePiston

Please Log in to join the conversation.

12 years 3 months ago - 12 years 3 months ago #191281 by ThePiston
I found a nice function to do this here: joezack.com/index.php/2008/10/20/mysql-capitalize-function/

I have tested it and it does work well.

Does this set up look ok? Can I run more than one query in the box so I can also do firstname and lastname with one trigger?


CB 2.3, CBsubs 4.3, PHP 7.1, J! 3.9.X
Attachments:

Please Log in to join the conversation.

12 years 3 months ago #191287 by krileon

Does this set up look ok?

You're missing a trigger. Your query also has unnecessary line breaks; try to keep it 1 line and let it wordwrap if needed.

Can I run more than one query in the box so I can also do firstname and lastname with one trigger?

Yup, end your first query with a ; then add a line break (press enter/return) and add a new query. You can add as many as you like actually.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.228 seconds

Facebook Twitter LinkedIn