My User Links Add-on

From TNG Wiki
Jump to: navigation, search

Purpose of the Add-on

This add-on script makes basic navigation more user friendly and personalised for your users.

It will produce a group of links that provide your users with convenient links to their personal pages.

  • The My Page link will take your logged-in users to their personal page
  • The My Family link will take your logged-in users to their family chart
  • The My Ancestors link will take your logged-in users to their vertical ancestors chart

Compatibility

  • This add-on is most suitable with TNG 11 (in regard to the My Family and My Ancestry Buttons)
  • It can be used with TNG 10 providing the Family Chart Mod (by Chris Moss) has been installed
  • For TNG versions previous to these, it is recommended that you upgrade

The personalised links are dependent on your users being identified in the Tree and Person ID fields during registration.

Alternatives

  • You may like to also consider the Open My Page mod by Erik Hoppe.
  • For code to install personalised links into the top header of TNG 11 Template 13 or 14. refer to this post.
  • For code to install personalised links into the top header of Template 15. refer to this post].
  • For code to install the personalised links as clickable buttons, refer to this post.
Your Image Caption

Installation

To install and use these TNG Add-ons, you need to copy this coding to files within your server.

Custom Configuration

The PHP text coding is not variable (language switching) but you can re-code these to variable text if you wish and add the relevant variables to your language files as necessary.

Alternativly, you can re-name the links within the code itself.

Considerations

With the My Ancestry link pointing to the vertical chart, you may like to set initial number of ancestor generations to maximum to give your users a full(er) initial view of their ancestry.

Admin>> Set Up>> Chart Settings>> Pedigree>> Initial Generations>> (Match field with Max Generations entry)>> Save

If you decide to do this, it would also pay to set the vertical chart as your default ancestor chart otherwise your users may have to wait an eternity for the other ancestor charts to load when clicking on the ancestor tabs if it isn’t the default.

Admin>> Set Up>> Chart Settings>> Pedigree>> Initial Display>> (Select Vertical)>> Save

You may also like to install the Verticalchart Photos mod which adds photos to these charts.

You may instead choose to point the My Ancestry link to another chart by changing the Personalised Ancestry Chart link script from""verticalchart.php?personID=" to "pedigree.php?.php?personID="

Authors

This plugin was inspired by and much of the script is based on the My Page Mod by Erik Hoppe. The script has been further developed by Merv Priestley.

In the event of a problem

The Script

The PHP coding will go into a PHP page - most typically a suitable section within your your template index.php file (Home Page), but can incorporated into any PHP page you determine helpful to your users.

For TNG 10, you will need to add the Family Chart Mod to your site and then change the Personalised Family Chart link script from"familychart.php?personID=" to "family.php?personID="

For versions, previous to TNG 10, it is recommended that you upgrade.

Persistent Personal Links

This particular code provide persistent links that display whether a person is logged in or NOT. If if a person is NOT logged in, the links will take them to the website log-in page. The only problem with this method is that, because the system won't know who the user is until after log-in, the user will always be taken back to the previous page after login before having to click on a personal link again to take them to the page of their choice.

<!–Start Personalised MY PAGE Link
Edit link name as required (default MY PAGE)–>
<a href="<?php if ( $_SESSION['mypersonID'] != "" && $currentuser && $_SESSION['mygedcom'] != "") {
$xerxxTarget = $cms['tngpath'] . "getperson.php?personID=" . $_SESSION['mypersonID'] ."&amp;tree=" . $_SESSION['mygedcom'];
echo "{$cms['tngpath']}$xerxxTarget";}
else  echo "{$cms['tngpath']}login.php"; ?>
">&#128100; My Page</a></span></a>
<!–End Personalised MY PAGE Link–>
</br>
<!–Start Personalised Family Chart Link
Edit link name as required (default MY FAMILY)–>
<a href="<?php if ( $_SESSION['mypersonID'] != "" && $currentuser && $_SESSION['mygedcom'] != "") {
$xerxxTarget = $cms['tngpath'] . "familychart.php?personID=" . $_SESSION['mypersonID'] ."&amp;tree=" . $_SESSION['mygedcom'];
echo "{$cms['tngpath']}$xerxxTarget";}
else  echo "{$cms['tngpath']}login.php"; ?>
">&#128100; My Family</a></span></a>
<!–End Personalised Family Chart Link–>
</br>
<!–Start Personalised Ancestor Chart Link
Edit ancestor chart type and link name as required (default verticalchart.php & MY ANCESTRY)–>
<a href="<?php if ( $_SESSION['mypersonID'] != "" && $currentuser && $_SESSION['mygedcom'] != "") {
$xerxxTarget = $cms['tngpath'] . "verticalchart.php?personID=" . $_SESSION['mypersonID'] ."&amp;tree=" . $_SESSION['mygedcom'];
echo "{$cms['tngpath']}$xerxxTarget";}
else  echo "{$cms['tngpath']}login.php"; ?>
">&#128100; My Ancestry</b></a></span></a>
<!–End Personalised Ancestor Chart Link–>

Essential and Personal Links

This particular code provide your users with convenient links to your websites essential pages or their personal pages depending on the user’s current login/out status

  • Logged Out – links to the Login, Registration and Contact Us pages
  • Logged In – links to their personal Person Page, Family Chart and Vertical Ancestors Chart

(You may use the personal links sections of the coding only, if you so choose).

<!–Start Personalised MY PAGE link
Edit link name as required (default MY PAGE)–>
<?php if ($currentuser && $_SESSION['mypersonID'] != "" && $currentuser && $_SESSION['mygedcom'] != "") {
$xerxxTarget = $cms['tngpath'] . "getperson.php?personID=" . $_SESSION['mypersonID'] ."&amp;tree=" . $_SESSION['mygedcom'];
echo "<a href=\"{$cms['tngpath']}$xerxxTarget\">&#128100; My Page</a>";
echo '</div>'; } ?>
<!–End Personalised MY PAGE link–>
<br>
<!–Start Personalised Family Chart Link
Edit link name as required (default MY FAMILY)–>
<?php if ($currentuser && $_SESSION['mypersonID'] != "" && $currentuser && $_SESSION['mygedcom'] != "") {
$xerxxTarget = $cms['tngpath'] . "family.php?personID=" . $_SESSION['mypersonID'] ."&amp;tree=" . $_SESSION['mygedcom'];
echo "<a href=\"{$cms['tngpath']}$xerxxTarget\">&#128100; My Family</a>";
echo '</div>'; } ?>
<!–End Personalised Family Chart link>
<br>
<!–Start Personalised Ancestor Chart link
Edit ancestor chart type and link name as required (default verticalchart.php & MY ANCESTRY)–>
<?php if ($currentuser && $_SESSION['mypersonID'] != "" && $currentuser && $_SESSION['mygedcom'] != "") {
$xerxxTarget = $cms['tngpath'] . "verticalchart.php?personID=" . $_SESSION['mypersonID'] ."&amp;tree=" . $_SESSION['mygedcom'];
echo "<a href=\"{$cms['tngpath']}$xerxxTarget\">&#128100; My Ancestry</a>";
echo '</div>'; } ?>
<!–End Personalised Ancestor Chart link–>

<!–Start Log In link–>
<?php if( $currentuser) {    echo "";}
else {  
echo"</p>";
echo "<a href=\"login.php\">&#128274; Login</a>";
echo '</div>'; } ?>
<!–End Log In link–>
<br>
<!–Start Register link–>
<?php if( $currentuser) {    echo "";}
else {    
echo "<a href=\"newacctform.php\">&#9998; Register</a>";
echo '</div>'; } ?>
<!–End Register link–>
<br>
<!–Start Contact Us link–>
<?php if( $currentuser) {    echo "";}
else {    
echo "<a href=\"suggest.php\">&#x2709; Contact Us</a>";
echo '</div>'; } ?>
<!–End Contact Us link–>

Sites using this add-on

If you use this add-on, please add your TNG site to the table below:

*TNG Experience
  • Newbie - <1yr with TNG and/or capable of very little
  • Intermediate - Btwn 1 to 5 years with TNG and/or capable of some things
  • Advanced - Advanced coding ability/capable of many things
  • Expert - Expert coding ability/capable of most things
URL User Note TNG Version Template *TNG Experience
An Aotearoa Genealogy Website Merv Priestley Add-on Developer 10.1.1 8 (Customised) Advanced
Clan MacLellan Ancestral Trees Clan Maclellan Site Administrator 11.1.1 14 (Customized) Newbie