From TNG_Wiki
Jump to navigation Jump to search
Summary Presents tables of all cousins of an individual or all cousin marriages or in-law marriages in a tree.
Validation The mod is XHTML compliant.Valid-xhtml10.png
Mod Updated 4 March 2023
Download link For
TNG 14.0
For PHP 8/8.1
TNG 13.0
TNG 12.0

TNG 13.0
TNG 12.0
TNG 11.0
TNG 10.1.0
Download stats Downloads
V12/v14 statistics
Author(s) Chris Moss
Homepage Cousins (this page)
Mod Support TNG Community Forums
Contact Developer TNG Community Forums
Latest Mod for TNG 14 for PHP 8/8.1
Min TNG V 10.1.3
Max TNG V 14+
Files modified
relateform.php, relationship.php, cust_text.php for English, French
Related Mods


The Cousins mod provides three modules which all include cousins and appear on the inner menu of the Relationships tab:

  1. Cousins lists all the cousins of an individual up to a predefined limit which is initially 4th cousin.
  2. All cousin marriages provides a list of of those marriages which have occurred between close relatives.
  3. All in-law marriages explores multiple marriages between two families, both siblings and cousins.

Apart from the first, these searches can take quite a long time depending on the size of the tree. Therefore the search itself is restricted to administrators and the basic results are cached in the database so that anyone can retrieve them on a subsequent use (including the administrator). The table can be updated when it is necessary, It is also possible that the searches can be computed on a personal computer and uploaded to the webserver. Caution: The computation uses temporary tables and these are usually not available for servers based on USB memory sticks.

Description of mod


The start of a listing of Queen Victoria's cousins (click to enlarge)

The first display shows for any person in the tree all their cousins, by default from first to fourth, if they have any. The number to display may be set to any number but increasing it to 7, 10 or more will inevitably take more time if at many generations exist in the tree. (Click on the picture on the right to enlarge it.)

The name of the cousin is followed by brief defails of their life. Clicking on the cousin's name will show the relationship between the root person and the cousin including the ancestors through whom they are connected.

All cousin marriages

The start of a listing of cousin marriages of European royalty (click to enlarge)

Occasional examples are found in many family trees of cousins or other close relatives marrying each other. Although marriages between first cousins are illegal in many US states, more distant cousin marriages are permitted and may be more common than people expect. This display collects all the examples in a tree together. The display puts the names of the husband and wife alongside the names of their common ancestors with dates and places of marriage. The list is sorted by the closeness of the relationship and the date of the marriage.

The number in the "Descent" column shows the number of generations from the common ancestor on the husband and wife's side resepectively. First cousins are thus represented as 2:2, second cousins 3:3 etc. The reason for this is that it is possible to go lower. The picture at the right shows examples of nephew-niece marriages (1:2). Brother-sister incest is represented as 1:1 and father daughter incest as 0:1. The example of Louis XIV and Marie-Therese of Spain shows an example of double first-cousin marriage. Where only one of the ancestors is shared, so that it is a half-cousin relationship, a footnote annotation (*) is added in the descent column and only the common ancestor is shown.

The relationship can be explored by clicking on the husband or wife's name which will always show their marriage first followed by their other relationships. Clicking on an ancestor shows instead a descendancy tree in which the cousin marriage will appear twice. This also works where there is only one common ancestor.

Most examples are not as close as these, and involve more distant cousins. So 2:3 (or 3:2) is a first cousin once removed, . They sometimes occur in clusters and to make these easier to spot, when names are repeated an occurrence number is added in square brackets after the name - [2], [3] etc. These are actually links to a filter which will produce a separate report for the person concerned.

All in-law marriages

This records multiple marriages between two families. Sometimes two siblings in one family marry siblings or cousins in another family. This strengthens the ties between the two families more than a single marriage but does not in itself bring any genetic implications. It can include affinal marriages such as a man marrying his dead wife's sister, but most such marriages are not properly described as affinal and indeed there is no common name for this. They usually occur in pairs but sometimes happen in groups of three or more.

In-law marriages in royal tree (click to enlarge)

This display shows all such marriages in a tree in groups ordered by date of marriage. The second line of each group shows the way in which the second marriage relates to the first using the codes "s" for sibling, "c" for cousin, "h" for half-sibling and "p" for same person. Thus one can have "s-s" where two siblings in one family marry siblings in the other family, "s-c" for siblings in one and cousins in the other, "c-c" where cousins in one marry cousins in the other, "h-s" where half-siblings in one marry siblings in the other and so on. If the same person marries two members of another family one can get "p-s", "p-c" etc.

On each line, members of one family are placed first and the other second, so the second line is marked "Sibling/Cousin/Person" and "Spouse" instead of "Husband" and "Wife", because the first person on the second line may be female. Clicking on a person's name will clarify their relation to the person in the same family. The first person on a third line (if there is one) will also relate to the first person.

Examples of all of these are shown in the royal example on the right. A repeated person is also marked with a number in square brackets. Thus Henry VIII is shown three times--not only were Ann Boleyn and Catherine Howard related, but Catherine of Aragon had previously been married to Henry VIII's brother.

Extra Screenshots


The mod is installed in the normal way: unzip it; copy the files to the mods directory on your system, go to the mod manager, select it and press install. However it is strongly recommended that you do this first on a private computer with TNG set up on it because it can take some time to run the initial search, particularly if you have a large tree.

After installation, remember to "Update the TNG Variables" in the WordPress Admin ------> TNG screen if you are using the TNG-WordPress-Plugin

Below are some search results found in several trees. The first two were historic trees dating back at least 1,000 years and including many royalty and nobility. The third is a modern tree but still having a significant number of such relationships. The times are elapsed times on a standard Mac desktop. As you can see, the search time varies significantly not only with the size of the tree but also with the number of hits.

Cousin marriages
Families People Total cousin marriages found Time taken (secs)
3rd cousins 6th cousins 3rd cousins 6th cousins
1,400 3,000 78 106 1.5 2.7
20,000 39,000 798 2,033 14.9 110
4,900 17,000 48 65 4.0 6.2

When the system is installed, the cousin marriages and in-law marriages can only be activated by an administrator. Anyone else will simply get a message asking them to contact an administrator. When an administrator runs it, the basic results will be stored in a new table in the database from which they can then be retrieved by anyone at low cost. (The low cost is basically making sure that the proper visibility rules for living persons are observed.) Subsequently even an administrator will get the same results unless they want to redo the search. The inner menu will at this stage look like this:


Clicking on All Cousin Marriages will retrieve the current stored results. To redo the search, click on the "redo" circular arrow symbol.

The search times for in-law marriages were less severe ranging from 0.5 to 6.5 seconds for the above trees, but this is handled the same way thus reducing the risk from repetitive use. You will find that two tables have been added to the database: tng_cousinmarriages and tng_inlaw marriages. You can use different names if necessary using the options below.

TNG 14 anchors

TNG version: 14.0

Relationship: The Relationship tab has been supplemented by an advanced relationship/connection search, powered by the Connections mod (by Michal Jarocinski).

In TNG v14 and later, the Cousins mod innermenu is anchored in both the Relationship tab/form and in the Connections search form.

Relationship tab anchor 600px
Connections form anchor showed on two separate lines on a laptop screen 600px

Options available

There are a large number of options and most of these use a commons settings file (cousins_inc.php). $maxcousins and $generations will affect the maximum time for search if there is sufficient 'width' in the tree to exercise them.

Option Purpose Default value
$cousins include cousins module 1
$cousinmarriages include cousin marriages module 1
$inlaws include in-law marriages module 1
$relationships max relationships to show in relationships display 4
$maxcousins max cousins number in cousins module 4
$generations max generations for cousin marriages (=cousins+1) 4
$updateoption allows online updates for cousin marriages and inlaw marriages 1
$cousin_marriages_table table name in database tng_cousin_marriages
$inlaw_marriages_table table name in database tng_inlaw_marriages
Options for cousin_marriages only
$print_time provide detailed timings for the search 0
$showmarriages show marriage place and date, which takes 4 extra columns 1
$allcousins include non-genetic cousins (e.g. adopted) 1
$birth value of frel and mrel in children table birth


Alan Craxford provided much of the inspiration for these reports with constant feedback. Ken Roy provided the French translation and many useful comments.

TNG User sites using this mod

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

URL User Note Mod-Version/TNG-Version User-language
Family tree of Marcin & Emilia Senderski Marcin Senderski Only home page is public EN, PL
Dusty Bits of the Past Allen Prunty Using Amazon LightSail / Public EN
Moss Family Tree Chris Moss EN, FR
Roots & Relatives Remembered Ron Krzmarzick public & private See Here EN,DE,CS
Craxford Family Genealogy Magazine Alan Craxford public and Wampserver EN
Familjen Johnson Leif Johnson Public / 14.0.3 SE, EN
Our Roy and Boucher Family Ken Roy Beta tested on PHP 8, 8.1, and 8.2 EN, FR
Hooley Family Links Rick Hooley Public/Private See Here EN
Racine d'Alsace J-Louis Valory Public/Private - T17 customised FR
Martius Family Hendrik Martius Half public DE, EN, FR, NL
Ennever Family Barry Ennever 13 Customised T4/ EN
Les Sabourin d'Amérique Michel Sabourin public / private 11.1.2 French
Our Family History Paul Barrett Public/Private site / 11.1.2 EN
The Cole / Tanner Family Tree David Cole Public/Private see here EN, DE, FR, ES, NL
The Road to Ethel Alicia Clemmons Public site / 12.0.1 EN
Our Family History James Brown Public/Private site / 12.1 EN
Our Family Histories Bryan S. Larson Public - T8 customized see here EN
Baza danych Rodziny Jarocińskich Michał Jarociński non-public site, Template 7 / 12.3 PL, EN
Racines Luxo-hennuyères Michel Kirsch Public site (registration) 13.0.3 FR/EN/GE/NL
The Duttons of New England Darrin Dutton Public / Private / 14.0.1 EN
Huygens - Van de Moortel Tom Huygens Public/Private on WordPress / 13.1.2 NL
Osage County Cousins Larry G Banks Public / Private / 14.0 EN
MOTYER Family Genealogy John Mark Motyer Public site See here EN
La Saga BIGEY François BIGEY Public / 14.0 FR
Joseph Oran Holtz Genealogy Pages Jim Holt Private See Here EN
Harnett Sheehan Families Kathy Harnett Sheehan Private/Very helpful mod! / 14.0.2 EN
Stammbaum der Familie Datschetzky Christian Datschetzky Public / 14.0.3 DE, EN

Revision History

Version Date Contents 4 Mar 2023 Updated by Ken Roy to fix PHP Warning: Undefined variable $cousinsfound 2 Feb 2023 Updated by Ken Roy with contributions by Michel Kirsch, Brent Hemphill
  • Add collation and engine string to tables creations (cousins_mariages.php and inlaw_marriages.php)
  • updated Dutch translations provided by Cees Kloosterman
  • updated Danish translations provided by Mogens Fenger
  • updated French translations by Michel Kirsch
  • Fix matching individual to family errors and minor corrections provided by Brent Hemphill
  • Fix old notations $row[index] as {$row['index']} in inlaw_marriages.php, cousins.php and cousin_marriages.php
  • fix issue with $tngconfig['tabs'] being deleted by TNG 14 once you make any changes to General Settings. 27 Dec 2022 Updated by Ken Roy to add Danish language provided by Mogens Fenger 26 Nov 2022 Updated by Ken Roy with help from Michel Kirsch and Ron Krzmarzick to correct previously posted v14.0.0.4c_b11, to include folder cousins_14.0.0.4c_b111 which was cleaned up to drop unused files 25 Nov 2022 Updated by Ken Roy with help from Michel Kirsch and Ron Krzmarzick to show the innermenu for Cousins All cousin marriages All in-law marriages on both the Relationships and Connections search forms 10 Apr 2022 Updated by Michel Kirsch and Ken Roy to eliminate PHP 8 and 8.1 errors and to use TNG v12 cust_text anchors
Tested on TNG 12.3 by Michel and Ron Krzmarzick and on TNG 13.1.1 and 13.1.2 by Ken who also tested with both MySQL 5.7 and MySQL 8 on TNG 13.1.2 beta 3 Sep 2018 corrected another null issue. Also cleaned up the inner menu. Thanks Rick. 11 May 2018 corrected issue when no in-law marriages. Thanks Ernest. 16 Dec 2017 corrected problem for people not using default MySQL table names such as tng_children. 22 Jun 2017 corrected a MySQL error in certain large Cousins queries. Also got the delete_tables link working. Made $text additions conditional so they only are loaded when needed. 22 Jun 2017 restrict text changes to apply only to files in which they are used 22 Jun 2017 handle log file and bookmark and clean up urls 22 Jun 2017 wouldn't install or ignore French version, didn't hide GEDCOM tab appropriately