Personalized Login Mod
|Personalized Login Mod|
|Summary||Portrays the relationship of the visited individual to the logged in registered visitor|
|Download link||Varies based on template used for TNG V7 only|
See Relationship Display Mod for TNG V8
Bryan S. Larson created the config file and added some other edits
|Homepage||Personalized Login Mod|
|Mod Support||TNG Community Forums|
|Min TNG V||7.0.0|
|Max TNG V||7.1.3|
Purpose of the Mod
This mod has three primary functions:
- This mod allows TNG to recognize logged in visitors who are also included in the site database and provide them with messages describing their relationship when they view other individuals to whom they are related.
- This mod shows a welcome message with the user's real name (for templates that use a welcome message).
- This mod changes the access log to show the real name of logged in users.
Note that with TNG V8, the User record contains a column for the treeID and personID. So in reworking this mod, it should no longer be necessary to include the modifications for step 2 and 3 above.
This mod was developed by Gerald Leehan and utilizes the ‘relationship.php’ code of Darrin’s original TNG.
Mod Manager functionality as well as a few other edits were developed by Bryan S. Larson.
The new version
- Works on sites with multiple trees.
- Uses more readable message structure in which the person whose page is being visited is always the subject and the registered visitor is always the object.
- The new version uses the file know5.php. The old file, know4.php, is no longer being maintained.
|v1.2||16 November 2009||Original know4.php posted back to wiki.|
|v1.2||25 October 2009||bug fixes for template 4. Fixes for other templates to come.|
|v1.1||15 October 2009||original Mod Manager config file
- A working TNG installation.
- The administrator must enter the personID (and tree name if it is a multiple tree site) of each registered user (who is in the database and has a personID) into the description field in the user page in the Administration section. (See image at bottom of page for example.)
- A default tree must be selected, even if you only have one tree. (under Setup>>Configuration>>General Settings>>Site Design and Definition)
- If you have a large database and you do not limit your "Max Generations" significantly, you may experience substantial delays and substantial utilization of server system resources. One of the developers had getperson.php temporarily disabled by his host after bogging down the server to the extent that other sites on the same server were affected. This was resolved by limiting the "Max Generations" (Setup >> Configuration >> Chart Settings >> Relationship Chart) to 6. Each additional generation exponentially increases the computing power required to calculate relationships. If your database is small (i.e. less than 30,000 individuals), you should not have any issues.
- know5.php issues:
- When looking at the ancestors of the spouse of the logged-in person, grandparents are given the wrong relationship. For example, if A is logged in and looking at the individual page of the grandfather (C) of his/her spouse (B), the relationship statement is shown as follows: C is the husband of the grandmother of A rather than C is the grandfather of the spouse of A. This error applies to subsequent generations as well.
- Custom text variables for languages other than English are missing in some parts of the file rendering tranlations difficult.
- The above issues may be remedied by installing the old know4.php file (link above) and changing the following line in getperson.php (after mod is installed) from @include($cms[tngpath] . "know5.php"); to @include($cms[tngpath] . "know4.php");
- putting the PersonID in the Description field changes the sort in the Admin User report list
- This mod conflicts with Brian McFadyen's Customized Logs Mod
- You must have a working installation of Brian McFadyen's Mod Manager.
- Download the appropriate .zip file below
- After downloading the files, unzip the files.
- Copy the know5.php file to your root directory and the configuration file into the admin/mod_folder, then follow the normal automated installation for Mod Manager mods.
For the full installation (all 3 components), select the file that matches the template you use.
NOT ALL TEMPLATES HAVE BEEN TESTED YET. If you would like to test a template and report on its functionality, please contact Bryan S. Larson
- Template 4 Updated 25 Oct 2009
Individual component installation (do not use if you selected a full installation above)
- Relation to user
- Personalized Access Log
- User realname welcome (to be added later - this will be template specific)
The personalizes the user’s interaction with your site:
- He gets a personalized greeting that links him to his own information on the site.
- He gets personalized messages when he visits people to whom he is related without needing to manually employ the Relationship tab.
- The tool can also be invoked on custom pages to do such things as highlight his relationship to people on a Featured Individuals or Famous Folks page. The mod does repurpose the description field in the user table, so it is necessary to use the ‘user name’ field where the descripion field was used to provide an alternate familiar name for the user.
- A version of this mod called Relationship Reference Message Mod is described elsewhere on this site. It can be used to present a message depicting the relationship of the person on the page being viewed to another 'reference person' identified by the administrator for the tree being viewed. It is then possible for people viewing John Doe on a tree featuring Alexander Hamilton to see a message like "John Doe is the fourth greatgrandnephew once removed of Alexander Hamilton."
TNG modules Involved
This mod modifies the following TNG files:
- index.php or
- getperson.php, know5.php,
and introduces a new script, Know5.php
No longer recommended and may not be current.
Download and unzip the attached script and place it in the same directory that contains your getperson.php script
http://tng.lythgoes.net/wiki/images/2/2c/Know5.zip File updated 15 October 2009.
Next Edit getperson.php to include the know4.php script. i.e. edit getperson.php and find the line:
echo tng_DrawHeading( $photostr, $namestr, getYears( $row ) );
Insert the line:
@include($cms[tngpath] . "know5.php");
directly below it.
You also should edit your index.php script –
Comment out the line:
echo "<p><>strong>$text[welcome], $currentuserdesc.</strong></p>\n";
and insert the line:
$snippedID=$currentuserdesc; $snippedID=substr($currentuserdesc,0,strpos($currentuserdesc,"-")); echo "<a href=\"getperson.php?personID=$snippedID&tree=$defaulttree\"><p><strong>$text[welcome], $currentuser</strong></p></a>";
directly below it.
This will do two things for you,
- First, it will change the message Welcome XXX to display the user name rather than the user description as XXX. This should only be a problem for folks who like to display things like "Welcome You Ugly Witch" when their mother-in-law logs in. For most folks, the Welcome user name message is just fine.
- Second, the welcome message is now a hot link to the user's own getperson page if the user is registered and logged in and is represented in the database. Users who are logged in and have something other than a valid person id in their currentuserdescription field (for example, hometown library, CIA, FBI, KGB, etc.) will see nothing.
Third, you need to add these statements to your customtext.php file in your language folder.
//the following added to facilitate personalized login mod aka know5.php $text[times] ="times"; $text[first] ="first"; $text[second] ="second"; $text[third] ="third"; $text[th] =" th"; $text[the_fatherinlaw_of] ="the father-in-law of"; $text[the_motherinlaw_of] ="the mother-in-law of"; $text[the_parent_of_the_spouse_of] ="the parent of the spouse of"; $text[the_father_of] ="the father of"; $text[the_mother_of] ="the mother of"; $text[the_parent_of] ="the parent of"; $text[clickforrelationship] ="Click_to_see_relationship_chart"; $text[clickforviewerrelationship] ="Click_to_see_relationship_chart"; $text[referenceperson] = "This Person is the Reference for relationships shown on other pages";
if( $currentuser ) $string .= xmlcharacters(" ($text[user]: $currentuserdesc)");
and change it to:
if( $currentuser ) $string .= xmlcharacters(" ($text[user]: $currentuser)");
Alternatively, if you prefer to see the real name in the log (rather than the Username) change it to
if( $currentuser ) $string .= xmlcharacters(" ($text[user]: $realname)");
Remember, the access log on most sites is visible to all visitors, and some users may object to displaying their real names.
Ok, now you're done, Go back to your Snapple and the let your users enjoy themselves.
My site operates at TNG version 6.2 and is highly customized, but I see no reason why the code should not work on version 7.0.
All of this code has obviously been cobbled out of the relationship.php script with appologies and thanks to its author.
Visualization of this mod
|Front Page Welcome Link|
|Individual Info Page|
Linked Relationship Chart
|Relationship chart linked from Message|
PersonID in Description field
|Enter personID in Description Field|
TNG User sites using this mod
- Please add TNG site that you have found that utilize this modification…However, since this mod only presents messages to registered users who are present in the database of the visited, you will probably notice nothing unless you are registered there… therefore, see the mod on my site by doing the following:
- You can see the mod in a action at NorthwesternPa.net- Log in as newton and use apple as your password (Isaac never learned about strong passwords). Then search for Margaret Poyntz. Her relationship to the user (Newton) should be described in a hyperlink immediately below her name. Clicking on the hyperlink will display a relationship chart connecting the individual (Margaret) to the user (Newton).
A site dedicated to the folks whose relatives settled in the townships and boroughs that roughly now comprise the Northwestern School District of Erie County, Pennsylvania.
To test out this feature, use username/password: guest/guest
Roger's Online Genealogy
I've modified this a bit to hard code in the person who the relationship is to - each page gives the relationship to me - the site owner.