Jump to content
TNG Community

addon: Link FamilySearch from Person View

Recommended Posts


Edit: find latest update at the end of this thread.



if someone is interested, I just created the following code to have a link to FamilySearch-Search on any Person's page.

It's quick and dirty, as I don't know PHP at all.

If you want to make an addon out of it, please do so :)

diff --git a/getperson.php b/getperson.php
index 11c4126..1abc8b1 100644
--- a/getperson.php
+++ b/getperson.php
@@ -154,6 +154,21 @@ echo tng_DrawHeading( $photostr, $namestr, getYears( $row ) );
                setEvent( array( "text"=>$text['born'], "fact"=>$stdex['BIRT'], "date"=>$row['birthdate'], "place"=>$row['birthplace'], "event"=>"BIRT", "entity"=>$personID, "type"=>"I" ), $row['birthdatetr'] );
                setEvent( array( "text"=>$text['christened'], "fact"=>$stdex['CHR'], "date"=>$row['altbirthdate'], "place"=>$row['altbirthplace'], "event"=>"CHR", "entity"=>$personID, "type"=>"I" ), $row['altbirthdatetr'] );
+       // JPT search Familysearch
+       $searchparam="https://familysearch.org/search/record/results";
+       $searchparam.="?count=20";
+       $searchparam.="&query=";
+        if( $row['firstname']  ) $searchparam.="%2Bgivenname%3A".     $row['firstname']."~";
+        if( $row['lastname']   ) $searchparam.="%20%2Bsurname%3A".    $row['lastname']."~";
+        if( $row['birthplace'] ) $searchparam.="%20%2Bbirth_place%3A".$row['birthplace']."~";
+//  TODO      if( ) $searchparam.="%20%2Bbirth_year%3A".$row['birthdatetr']."-".$row['birthdatetr']."~";
+        if( $spouserow['firstname'] ) $searchparam.="%20%2Bspouse_givenname%3A".$spouserow['firstname']."~";
+        if( $spouserow['lastname']  ) $searchparam.="%20%2Bspouse_surname%3A".  $spouserow['lastname']."~";
+        setEvent( array( "text"=>"Search", "fact"=>"<a href=$searchparam target=\"_blank\">Familysearch</a>"));
        if ( $row['sex'] == "M" ) {
                $sex = $text['male']; $spouse = "wife"; $self = "husband"; $spouseorder = "husborder";


Share this post

Link to post
Share on other sites

Update: added Genealogy Metasearch

How do I convert an input type:submit / button into a link?

        // JPT Genealogy.net Metasearch
        $genealogynet ="<form action=\"http://meta.genealogy.net/search/index\" method=\"post\" name=\"partner\" id=\"partner\">";
        $genealogynet.="    <input name=\"lastname\" value=\"".$row['lastname']."\" id=\"lastname\" type=\"hidden\" >";   
        $genealogynet.="    <input name=\"placename\" value=\"".$row['birthplace']."\" id=\"placename\" type=\"hidden\" >";
        $genealogynet.="    <!--<input name=\"search\" value=\"Start search\" id=\"search\" type=\"submit\">-->";
        $genealogynet.="    <button class=\"jpt-link\" name=\"search\" id=\"search\" type = \"submit\" >Genealogy.net Metasearch</button>";
        $genealogynet.="    <input name=\"partner1\" checked=\"checked\" id=\"partner1\" type=\"hidden\">"; // GEDBAS
        $genealogynet.="    <input name=\"partner2\" checked=\"checked\" id=\"partner2\" type=\"hidden\">"; // Datenbank Historischer Adressbücher
        $genealogynet.="    <input name=\"partner3\" checked=\"checked\" id=\"partner3\" type=\"hidden\">"; // FOKO  
        $genealogynet.="    <input name=\"partner4\" checked=\"checked\" id=\"partner4\" type=\"hidden\">"; // Forschungsdatenbanken der Vereine
        $genealogynet.="    <input name=\"partner6\" checked=\"checked\" id=\"partner6\" type=\"hidden\">"; // Online Ortsfamilienbücher
        $genealogynet.="    <input name=\"partner8\" checked=\"checked\" id=\"partner8\" type=\"hidden\">"; // Volkszahlregister Schleswig Holstein (AGGSH e. V.)
        $genealogynet.="    <input name=\"partner9\" checked=\"checked\" id=\"partner9\" type=\"hidden\">"; // Grabsteine
        $genealogynet.="    <input name=\"partner11\" checked=\"checked\" id=\"partner11\" type=\"hidden\">"; // Verlustlisten 1. Weltkrieg
        $genealogynet.="    <input name=\"partner12\" checked=\"checked\" id=\"partner12\" type=\"hidden\">"; // Grabsteine Ostfriesland (Upstalsboom-Gesellschaft e. V.)
        $genealogynet.="    <input name=\"partner13\" checked=\"checked\" id=\"partner13\" type=\"hidden\">"; // Sterbebilder (Bayerischer Landesverein für Familienkunde e.V.)
        $genealogynet.="    <input name=\"partner15\" checked=\"checked\" id=\"partner15\" type=\"hidden\">"; // Bremer Passagierlisten (passagierlisten.de)
        $genealogynet.="    <input name=\"partner16\" checked=\"checked\" id=\"partner16\" type=\"hidden\">"; // Auswanderer aus dem Großherzogtum Oldenburg (Oldenburgische Gesellschaft für Familienkunde e.V.)

//        setEvent( array( "text"=>"Search", "fact"=>"<a href= \"$familysearch\" target=\"_blank\">Familysearch</a>"));
        setEvent( array( "text"=>"Search", "fact"=>"<a href=$searchparam target=\"_blank\">Familysearch</a> $genealogynet"));



Share this post

Link to post
Share on other sites

Updated Familysearch Link.

insert at line 158 in getperson.php

this code inputs Name, birthplace and Spouse's name into the FamilySearch search engine. This combination proved to be very useful.

You have to manually enter a birth date range or similar to narrow the results. I would have done that to, but have a look at the age function in globallib.php: date calculation sucks. Darren could you please create separate functions that calculate a rough date?

        // JPT Familysearch search
        $familysearch="<a href=\"https://familysearch.org/search/record/results";

        if( $row['firstname']  ) $familysearch.="%2Bgivenname%3A%22".trim($row['firstname'])."%22~";
        if( $row['lastname']   ) $familysearch.="%20%2Bsurname%3A%22".trim($row['lastname'])."%22~";
        if( $row['birthplace'] ) $familysearch.="%20%2Bbirth_place%3A".trim(substr($row['birthplace'],0,strpos($row['birthplace']," ")))."~";
//      if( ) $familysearch.="%20%2Bbirth_year%3A".$row['birthdatetr']."-".$row['birthdatetr']."~";

        // JPT fetch first spouse        
        $marriages = getSpouseFamilyFullUnion($tree, $personID);
        if ( $marriagerow =  tng_fetch_assoc( $marriages ) ) {
            $spouse = $marriagerow['husband'] == $personID ? wife : husband;
            if( $marriagerow[$spouse] ) {
                $spouseresult = getPersonData($tree, $marriagerow[$spouse]);
                $spouserow =  tng_fetch_assoc( $spouseresult );

                if( $spouserow['firstname'] ) $familysearch.="%20%2Bspouse_givenname%3A%22".trim($spouserow['firstname'])."%22~";
                if( $spouserow['lastname']  ) $familysearch.="%20%2Bspouse_surname%3A%22".trim($spouserow['lastname' ])."%22~";
        $familysearch.="\" target=\"_blank\">Familysearch</a>";
        setEvent( array( "text"=>"Search", "fact"=>"$familysearch"), null);


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