I have a field that I added using the Builders - Profile Fields builder. This field is called Professional Suffix. When displaying the users name, I want to have a comma entered after the last name and before the professional suffix - but only if a professional suffix exists. If there is no professional suffix, then leave the name as is. I have attached screenshots. caredesign.net |
I have wanted to do something similar with spaces in user's names. On my site I am not using the First Name + Last Name; spaces are not allowed and when I tried adding them it broke things. My algorithm for this was to have a "special character" that would be converted to a space when the name is displayed, internally the name would not contain a space. This would be the same for you so if you can add a comma on, I can replace the "special character" with a space at display time.
I just have not had the time to go poking into the code that sends the name to the page. In your case you want to retrieve the Last Name, and then use php's strings function to append a comma to the end of the Last Name before it is sent out to the browser; and you only want it done if the suffix exists. The only question is, is there a way to do this so that it can be done site wide without changing a lot of code in a lot of different places.
Geeks, making the world a better place |
Actually, what about this? Is it possible when you store the suffix you store ", M.D." as the string? The members enters the suffix, "M.D." and then before you store it in the database it stores ", M.D." and then you just display that beside of the Last Name? Would that cause issues? Have you tested that? Geeks, making the world a better place |
you lost me on that last post GG. Looking at tthe screenshots I posted, 2 of the members actually typed ", M.D." - in which this works fine. But, who is going to know to do that.
In looking at what you wrote, I am gathering that you are saying that a member would type in "M.D." and I would add code that would add the ", ". So, since I am using the standard dolphin forms creation method, I would need to figure that out. Just thinking about this, though. I needed to change the display of a field called Website so that it would be a clickable link. I am thinking I can do something similar. I will have to find the code change and see what I can come up with.
caredesign.net |
you lost me on that last post GG. Looking at tthe screenshots I posted, 2 of the members actually typed ", M.D." - in which this works fine. But, who is going to know to do that.
In looking at what you wrote, I am gathering that you are saying that a member would type in "M.D." and I would add code that would add the ", ". So, since I am using the standard dolphin forms creation method, I would need to figure that out. Just thinking about this, though. I needed to change the display of a field called Website so that it would be a clickable link. I am thinking I can do something similar. I will have to find the code change and see what I can come up with.
Good question, I know you can use regexp on the form builder; that was what I was thinking of but you might not be able to do anything else. Which would mean the form processor.
Dean helped me out with clickable links on the Profile Page. See: http://www.boonex.com/forums/topic/Turn-Email-Address-in-Profile-to-Clickable-Mailto.htm
Geeks, making the world a better place |
I have one that is for website urls - instead of using the sites module. I am guessing that I can probably make a variable for ProfessionalSuffix, and add the ", " to it. caredesign.net |
OK, I figured out how to do it. I will post what I have and I am sure you can edit it to fit your needs GG.
in inc/classes/BxDolMemberInfo.php around line 76:
case 'sys_first_name_last_name': if ($aData['ProfessionalSuffix']) { $sProfessionalSuffix = ', ' . $aData['ProfessionalSuffix']; } else { $sProfessionalSuffix = ''; } return $aData['FirstName'] || $aData['LastName'] ? $aData['ProfessionalPrefix'] . ' ' . $aData['FirstName'] . ' ' . $aData['LastName'] . '' . $sProfessionalSuffix : $aData['NickName'];
EDIT - I forgot to add the screenshot
caredesign.net |
OK, I figured out how to do it. I will post what I have and I am sure you can edit it to fit your needs GG.
in inc/classes/BxDolMemberInfo.php around line 76:
case 'sys_first_name_last_name': if ($aData['ProfessionalSuffix']) { $sProfessionalSuffix = ', ' . $aData['ProfessionalSuffix']; } else { $sProfessionalSuffix = ''; } return $aData['FirstName'] || $aData['LastName'] ? $aData['ProfessionalPrefix'] . ' ' . $aData['FirstName'] . ' ' . $aData['LastName'] . '' . $sProfessionalSuffix : $aData['NickName'];
Thanks, I am going to try out something on my test site.
Geeks, making the world a better place |