×

Error

Please login first

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

12 years 3 months ago #191292 by ThePiston
ok, this should do it eh?


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 #191307 by ThePiston
if anyone else interested in creating this function, I changed it to include hyphens so people with hyphenated last names will be correclt fixed. Just add this into your SQL area of phpmyadmin (be sure to change the delimiter at the bottom of that page to a tilde)

CREATE FUNCTION CAP_FIRST (input VARCHAR(255))

RETURNS VARCHAR(255)

DETERMINISTIC

BEGIN
DECLARE len INT;
DECLARE i INT;

SET len = CHAR_LENGTH(input);
SET input = LOWER(input);
SET i = 0;

WHILE (i < len) DO
IF (MID(input,i,1) = ' ' OR i = 0 OR MID(input,i,1) = '-') THEN
IF (i < len) THEN
SET input = CONCAT(
LEFT(input,i),
UPPER(MID(input,i + 1,1)),
RIGHT(input,len - i - 1)
);
END IF;
END IF;
SET i = i + 1;
END WHILE;

RETURN input;
END;

CB 2.3, CBsubs 4.3, PHP 7.1, J! 3.9.X
The following user(s) said Thank You: nant, krileon

Please Log in to join the conversation.

12 years 3 months ago #191312 by krileon
Looks like it, but you may want to also apply it to after registration trigger. Of course thoroughly test before deploying to a live site.


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 - 12 years 3 months ago #191316 by ThePiston
everytime I save the plugin, the system adds an extra ' at the end of the query like this (see last red '):

UPDATE `#__comprofiler` SET `firstname` = CAP_FIRST1(`firstname`) WHERE `id` = '[user_id]';

UPDATE `#__comprofiler` SET `lastname` = CAP_FIRST1(`lastname`) WHERE `id` = '[user_id]';'

is that normal? I delete it and it comes back

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 #191324 by krileon
No that's not normal. Please ensure you're using CB Auto Action 2.4.0 as believe I've fixed this issue already.


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 #191327 by ThePiston
yep, just doonloaded it too. Using CB1.7.1, J1.5.

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

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.259 seconds

Facebook Twitter LinkedIn