Jump to content
TNG Community
RickM

Ability to show a persons First Name ONLY on the Individuals Page

Recommended Posts

RickM

Hi there,

I'm working on TNGv13.0 on a local server at the mo.

I would like to have the ability to show a persons firstname ONLY at various places on the individuals page (I think generated by getperson.php.. I am not a coder and don't seem to be able to find where the getPerson function (I think it is a function) is to work out how to get the firstname ONLY.

Is a kindly person able to help me out either by providing some code that I can insert into getperson.php to generate a way to show the firstname at various places OR by pointing me in the right direction so I can try to figure it out..

Many Thanks in Advance..

Share this post


Link to post
Share on other sites
Ken Roy

Admin > Setup > General Settings > Names provides the options for how to display names in TNG.  Show First Name Only is not one of the options.

Edited  - Note that the Names > Name Order:  option is for the whole TNG Site, not just the Individual or getperson.php page

Share this post


Link to post
Share on other sites
RickM

Thanks Ken,

I am hoping to be able to add the first name to specific points on the getperson page. In one instance I would like to show it in the events list heading next to the Events Map.. Example Kirstys' Life Events

 

Share this post


Link to post
Share on other sites
Philip Roy

Rick, I’m away from home this week but willing to look at it next week. Can you name all the places on the page you want this and I’ll have a play.

Phil

Share this post


Link to post
Share on other sites
RickM

Phil

You would be a gentleman & scholar!!

Really only in one spot at the moment, that of in the "events list heading" (I have an extra table row in the event list table) next to the Events Map. I am toying with adding to the likes of the various media tables that load depending on what media is attached to the person.. That might be too much though..

I was going to ask Michel author of Show Age at Marriage Mod if he could add the first names in there as well. (Maybe too much already, but maybe an option??) 

This is a snip of what my Event Map looks like. You can see the Events List Heading "Their Life Events". Either add Firstname in there or as part of the Heading EVENT MAP

JHF-EventMap.jpg

If I can be of any help <Smile>..

Many Thanks..

Share this post


Link to post
Share on other sites
Philip Roy

Famous last words, but I think that should be easy...but disclaimer, I’m not a coder, just an admirer/user of other’s coding. It just needs to pull the first name from the database followed by “‘s Life Events” in that table row you added. I’ll look at it next week unless someone beats me to it. Hard to FTP etc on an iPad 😉

Share this post


Link to post
Share on other sites
RickM

Hey Phil,

 

No rush and like you I am no coder but can plagiarise.. I wondered about having to query the database (hmmmmmmm def not good at that one) I will have a peek myself, but I am currently working on getting other media type tables to have the labels across the top of the table such as the Event Map..

Next time I am down that way I must make time to meet you (if you would be ok with that <smile>). That may be late Nov or Christmas/New Year.

Enjoy the weekend..

Share this post


Link to post
Share on other sites
Philip Roy

OK, I think I have bitten off more than I can chew on this one...but I did get it running on a test site.

getperson.php

Line 602 is....

$persontext .= "<td class=\"databack\"><div style=\"height:{$mapheight};\" id=\"mapevents\"><table cellpadding=\"4\" class=\"whiteback\">\n";
		

AFTER that, add....

$persontext .= ($row['firstname']);
$persontext .= "'s Life Events";

I literally stole that code from elsewhere and it works for me...although it pulls all first names. I also haven't bothered about styling as (a) to each their own and (b) everyone has different templates.

Let me know how you get on....but if you need more help, I don't think I'll be able to do much more.

Phil

Share this post


Link to post
Share on other sites
RickM

Hi Phil

Hey really sorry.. I totally missed this post, and have only just found it.. Really weird that I have missed it.. But there you go..

That was pretty damned smart work (unyet tried) and maybe now another really smart person might be able to help better moving forward..

I will have a play about and see what comes of it..

Very much appreciate your effort..

Thank YOU!

 

Share this post


Link to post
Share on other sites
RickM

Phil,

I took your suggestion and added it to my site, with a few changes due to the way I have made other changes within getperson.php.. I have also improved upon it by adding the ability to use the persons 'Nickname' IF they have one..

        $personname = "";
            if ($row['nickname']) {
                $personname = $row['nickname'];
            }
            else
                $personname = $row['firstname'];

It works here at alineofmalkins John Henry Falloon this is with my modifications written in getperson.php TNG V 12.3

Doing it for a virgin install of TNG v13 would probably be

      if ($row['nickname']) {
                $persontext .= $row['nickname'];
            }
            else {
                $persontext .= $row['firstname'];
			}
	$persontext .= "'.s Life Events";

I Think!! 😁 and should work for TNG V 12.3 as well.

 

Many THANKS for figuring that out for me Phil.. I hope you can use it too!! Let me know if you would like to use some of my other changes.. I am currently doing them up in a mod or two for TNG v13.0 for my 'Private Use'. I will be looking to truncate the firstname to just the first name so instead of 'John Henry's' is will be 'John's' because some folk have REALLY long names..

FOLK SHOULD NOTE: If you are going to try this code change out, in each case these changes may affect Mods already installed so making changes are at your risk..

Mods I am pretty sure are NOT affected (I have them installed on both TNG v12.3 and TNG v13.0)

Show Age at Marriage

Ancestor Map

Cemetery Burials Table

Fixed Family Tab

Lat-Long NSEW

OpenStreetMap

Show Nicknames

and

Tables of Descendants

Cheers @Philip Roy

Share this post


Link to post
Share on other sites
Philip Roy

Nice! Looks good and the nickname logic makes it even more useful !

Phil

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×