First Names

From TNG_Wiki
Jump to: navigation, search
First Names
Summary Adds a set of pages to TNG that displays first names, (AKA forenames or given names)
Mod Updated {{{mod_last_update}}}
Download link TNG 10.1 First Names Mod
from Roger Moffat's site
TNG 10.1.0
TNG 11.0

TNG 10.0 First Names Mod

from Roger Moffat's site
TNG 10.0

from TNG Community Forum for
TNG 9.0

Config file
from Steven's site for
TNG 8.0

First Names
TNG 7.0
Download stats
Author(s) Steven Willingale
Homepage First Names
Mod Support TNG Community Forums
Contact Developer
Latest Mod for TNG V9 for TNG V10 for TNG V10.1 and TNG V11
Min TNG V 7.0.0
Max TNG V 11.x.x
Files modified
forename.php, forename100.php, forename-all.php, forename-oneletter.php, forenames.php, forenames100.php, forenames-all.php, forenames-oneletter.php, forenametable.php, forenamestable.php (all new files), text.php (edit), cust_text.php (edit), search.php (edit), searchlib.php (edit) and since TNG 10.1 firstnames-extra.php
Related Mods
First Names Extra - not required for TNG 10.1
First Names Extra Languages - adds extra languages Dutch, French, German and Spanish
For TNG 9 You will now need to add links to the new forname.php and/or forenames.php files in your topmenu.php file and/or add links to the dropdown menus.

The Mod for TNG 10 adds these menu items, including for the "First Names Extra" Mod mentioned as a Related Mod above here. You should also install this so that the menu will work.

Since TNG 10.1 First Names Extra is included in the First Names Mod.


This modification adds a set of pages to TNG that displays first names, (aka forenames, given names), in a similar manner to the Surnames pages provided with TNG.

A fully TNG V9 compatable version was released in Feb 2013, this installs via mod manager but you will still need to manually add links to the forename files as detailed below.

The forename files list just a persons first forename ie the names John, John Robert, John William all appear listed just under John. This shows in the Find menu as First Names

The Forenames files list ALL of a persons forenames so the names John, John Robert and John William will all appear listed separately. This shows in the Find menu as First & Middle Names

The firstnames-extra file lists ALL of the names that are NOT used as a First Name - i.e. the names that are ONLY Middle Names. This shows in the Find menu as Middle Names.


This mod was developed by Steven Willingale

Mod was revised by Roger Moffat for added features and TNG 10 compatibility, and revised for TNG 10.1 compatibility.

Known Issues

Requires manual linking of files described below


  1. Download the appropriate zip file as shown in the summary in the upper right corner of the page.
  2. Extract the config file and the "forenames" folder from the downloaded zip file into the mods folder.
  3. Follow the normal automated installation for Mod Manager, as shown in the example Mod Manager - Installing Config Files to install the mod.
  4. Create links to the new files as described below. (Note: the Mod for TNG 10 will install the needed menu items in to the "Find" drop down menu).

Custom Text Additions

TNG 8 & TNG 9

Note that config file only includes the English & Dutch language changes, so if you support additional languages you will need to add these lines to each of your language cust_text.php files with appropriate translations of course.

TNG 10

Note that the config file only includes the English language additions. If you support additional languages on your site you will need to edit the config file and find the block of lines as shown here

        case "surnames":
        case "places":
        case "forename":
        case "forenames":


//Forename(s) addon
$text['allforenames'] = "All First Names";
$text['allforenamess'] = "All First and Middle Names";
$text['firstbeginswith'] = "Forenames containing first name beginning with ";
$text['foreallbeginningwith'] = "All First Names beginning with ";
$text['forenamelist'] = "First Names List";
$text['forenameslist'] = "First and Middle Names List";
$text['forenamesstarting'] = "Show First and Middle Names starting with";
$text['forenamestarting'] = "Show First Names starting with";
$text['fxnamenote'] = "The list produced by clicking on a name may return more records than the number indicates if the name forms part of other names (e.g. 'Eli' is part of 'Elizabeth' and 'Amelia').";
$text['mainforenamepage'] = "Main First Names Page";
$text['mainforenamespage'] = "Main First and Middle Names Page";
$text['mnuforename'] = "First Names";
$text['mnuforenames'] = "First & Middle Names";
$text['mnuxforenames'] = "Middle Names";
$text['namesttip'] ="Lists First and Middle Names of everyone in the database.";
$text['namettip'] ="Lists First Names that can occur at any position in a person's First and Middle Names but must always be used as a First Name by someone in the database.";
$text['noforename'] = "[No Firstname]";
$text['showallfirstmidnames'] = "Show all First and Middle Names";
$text['showallforenames'] = "Show all First Names";
$text['showmatchingfirstmidnames'] = "click on a First and Middle Name to show matching records";
$text['showmatchingforenames'] = "click on a First Name to show matching records";
$text['top30fmn'] = "Top xxx First and Middle Names";
$text['top30fn'] = "Top xxx First Names";
$text['totalfnames'] = "total individuals where name is first forename";
$text['xfforenames'] = "Middle Names (First and Middle Names not also used as a First Name)";

and then

  1. duplicate that block of text for each additional language you support
  2. change the "languages/English/" in 2 different places on the %target:.... lines to (for example) "languages/German-UTF8/"
  3. provide translation of the phrases between the " " marks in the block of text targeted for the cust_text.php file for your supported additional languages. NOTE do NOT translate the two "case "forename": case "forenames":" lines!!
  4. install the Mod

Revision History

Version Date Contents
V7.0.1 Initial Release
V8.1.0 Rough TNG8 version, although it does not have the new TNG8 layout or the new TNG8 histograms
V. 10 February 2013 Fully TNG 9.x compatible version released
V. 15 February 2013 Bug fixes and Dutch translation
V. 17 February 2013 More Bug fixes
V. 12 February 2014 Some additional features and TNG 10 compatibility provided by Roger Moffat
V. 20 February 2014 Added a the css needed to get the icons to display on the Find drop down menu
V. 16 February 2015 Revised PHP for TNG 10.1 use of mysqli_ in place of mysql_ and now includes firstnames-extra.php to list out names that are only used as middle names
V. 24 July 2015 A fix to prevent use of the forename(s)-oneletter.php files to attempt to load maliciously crafted URLs as Darrin did to the surnames-oneletter.php file.
V. 17 November 2015 Modified all of the files to now be "mobile friendly" - the lists of names now use 5 columns on computer display and 2 columns on Mobile display following the same logic as core TNG does on for example surnames pages.
V. 20 November 2015 Corrects some coding errors for selecting, counting and sorting results.
V. 20 November 2015 Fixes the situation were searching for First Name = "Julie" also returned Juliet and Juliette. Now the searches for First Name match the first word of the first name.
V. 20 November 2015 Fixes the same issue as noted in for the "Middle Names" page - so Elliot generates a different listing only for "Elliot" and doesn't include "Elliott".
V. 20 November 2015 Corrects an issue with the list of all First and Middle names where clicking on a name didn't return only that name. Thanks Michael Papousek for the heads up and the code fix.

Linking this mod to your site

TNG 8 & TNG 9

The cfg file contains the new and amended pages needed, but does not create any links to these new pages. You will need to add a link manually in your topmenu.php file. You only need to link to the forename.php and forenames.php files. A quick summary of the steps to do this as follows:

1 Create a copy of topmenu.php and keep it safe in case things go wrong.

2 Open topmenu.php in notepad or your web page editing software.

3 Add the following line of code of topmenu.php (there will be a number of similar lines of code already in topmenu.php, so you should be able to work out where to add this new line)

echo "<li><a href=\"{$cms['tngpath']}forename.php\" class=\"lightlink\">{$text['forenamelist']}</a></li>\n";

4 Save the changes to topmenu.php

5 FTP the amended topmenu.php to your webserver, overwriting the exisiting file.

6 If things go wrong, replace with the backup you kept in step 1

7 Repeat steps to add a link to the forenames.php file

Or you can try creating a new menu and adding this link to it, such as described in the Site Menu Mod article

Coding Links in Pages also gives some tips for adding links to pages

TNG 10

The version for TNG 10 adds 3 items to the TNG Find drop down menu that appears on all TNG pages except usually the index.php page. If you wish to have links on your index.php page, see the section above for suggestions on how to do this.

TNG 10.1

The version for TNG 10.1 now includes firstnames-extra.php.


TNG version: 7.0
You can click on the [Expand] link on the right to view the TNG V7 changes or [Collapse] to hide them again.

This modification is detailed in the TNG Community Forums and on the developers website.

The zip file detailed in the above links contains the new pages and installation instructions.

Two sets of files are provided, depending on how you want forenames to display:

1st set:

  • forenames.php
  • forenames-all.php
  • forenames100.php
  • forenames-onletter.php

these will list all a persons forenames, taking the following names as an example:

John Smith
John Frederick Brown
John Robert Jones

the names will be listed as 'John', 'John Frederick' and 'John Robert' respectively.

2nd set:

  • forename.php
  • forename-all.php
  • forename100.php
  • forename-onletter.php

these 4 files take just the first forename, so:

John Smith
John Frederick Brown
John Robert Jones

would all be listed under 'John'

Sites Using This Mod

This mod is used on the developers website. Compare forename and fornames.


1) Copy either or both sets of files to your TNG folder, usually

2) As we now need to make changes to 2 TNG core files, backup the text.php & search.php files BEFORE makeing the following amendments!!

3) In text.php ( insert the following text at line around 411, (ie immediatly after break;)

//added by steven for the 'firstnames' pages
    case "firstname":
    case "places";
        $text['firstnamesstarting'] = "Show firstnames starting with";
        $text['showtop'] = "Show top";
        $text['showallfirstnames'] = "Show all firstnames";
        $text['sortedalpha'] = "sorted alphabetically";
        $text['byoccurrence'] = "ordered by occurrence";
        $text['firstchars'] = "First characters";
        $text['top'] = "Top";
        $text['mainfirstnamepage'] = "Main firstname page";
        $text['allfirstnames'] = "All firstnames";
        $text['showmatchingfirstnames'] = "Click on a firstname to show matching records.";
        $text['backtotop'] = "Back to top";
        $text['beginswith'] = "Begins with";
        $text['allfirstbeginningwith'] = "All firstnames beginning with";
        $text['numoccurrences'] = "number of total localities in parentheses";
        $text['placesstarting'] = "Show largest localities starting with";

        $text['showmatchingplaces'] = "Click on a place to show smaller localities. Click on the search icon to show matching individuals.";
       $text['totalnames'] = "total individuals";
        $text['showallplaces'] = "Show all largest localities";
        $text['totalplaces'] = "total places";
        $text['mainplacepage'] = "Main places page";
        $text['allplaces'] = "All Largest Localities";
        $text['placescont'] = "Show all places containing";
        //added in 7.0.0
        $text['top30'] = "Top 30 firstnames";
        $text['top30places'] = "Top 30 largest localities";

Then at approx line 596 after

$text['nosurname'] = "[no surname]";

add the line

$text['nofirstname'] = "[no firstname]";  //firstnames pages

Then at approx line 660 after

$text['surnamelist'] = "Surname List";

add the line

$text['firstnamelist'] = "Firstname List";  //firstname pages

4) Edit search.php (

Find the following section of code (usually starting at line 254)

if( $myfirstname || $fnqualify == "exists" || $fnqualify == "dnexist" ) {
    buildCriteria( "p.firstname", "myfirstname", "fnqualify", $fnqualify, $myfirstname, $text[firstname] );

and replace that whole section with

if( $myfirstname || $fnqualify == "exists" || $fnqualify == "dnexist" ) {
    if( $myfirstname == $text[nofirstname] )
        addtoQuery( "firstname", "myfirstname", "firstname = \"\"", "fnqualify", $text[equals], $text[equals], $myfirstname );
    else {
        buildCriteria( "p.firstname", "myfirstname", "fnqualify", $fnqualify, $myfirstname, $text[firstname] );

5) You will now need to add links to the new forname.php and/or forenames.php files in your topmenu.php file and/or add links to the dropdown menus.

Please see the following for more details:

Site Menu Mod
Templates - Getting Started


TNG version: 8.0

Steven has released a version for TNG8 with a CFG file for install via Mod Manager, however the page layout still looks like TNG7, ie it does not have the histograms etc, but in all other respects works with the latest version of TNG.

You will now need to add links to the new forname.php and/or forenames.php files in your topmenu.php file and/or add links to the dropdown menus.

Please see the following for more details:

Site Menu Mod
Templates - Getting Started

Sites using this mod

If you download and install this mod, please add your TNG site to the table below:

URL User Note Mod-Version TNG-Version User-language
Steven's Genealogy Steven Willingale Mod developer 9.1.1 EN
Chamberlain and Eidenbenz Genealogy Graham Chamberlain 11.0.0 EN,DE,FR,NL,ES
Jerry Milo Johnson Ancestry Project Jerry Milo Johnson 9.0.2 EN
Grogan mob Margaret Turner 10.1 10.1.1 EN
Turner mob Margaret Turner 10.1 10.1.1 EN
Roger's Online Genealogy Roger Moffat Mod Modifier 10.1.3 EN
Brady Family Tree in Western Australia Darryl Brady Public site 10.1.1 EN, DE
Genealogy of the Weir and Drain Families Beverley Stimpson Public Site 11.1.2 EN