Remove No Surnames Mod

From TNG_Wiki
Jump to navigation Jump to search
Remove No Surnames Mod
Summary Removes the no surname count from the Top 100 Surnames in TNG 7.1.1 and above and in surnames and top surnames in TNG 7.1.0
Validation {{{mod_validation}}}
Mod Updated {{{mod_last_update}}}
Download link remove_no_surnames_v2.0.zip for TNG 7.1.1 and above
remove_no_surnames_v1.0.zip for TNG 7.1.0 and below
Download stats {{{download_stats}}}
Author(s) Steve Voght
Config file by Ken Roy
Homepage Remove No Surnames Mod (This page)
Mod Support TNG Community Forums
Contact Developer {{{mod_contact}}}
Latest Mod 2.0
Min TNG V 7.0.0
Max TNG V 7.1.2
Files modified
surnames100.php
surnames.php (for TNG 7.1.0 and below only)
Related Mods
None
Notes
TNG 7.1.1 removed the no surname count from the Surnames page. V2.0 of this mod applies to TNG 7.1.1 and above only.


Purpose of the mod

The original modification provided removed the [no surname] button and counts from the Surnames page (surnames.php) and the Top 100 Surnames page (surnames100.php). The version of that mod only applies to TNG 7.1.0 and below.

The current version of the mod only removes the [no surname] counts from the Top 100 Surnames page (surnames100.php)

Developer

Mod developer is Steve Voght, who provided the code changes on the User2 list on 5 Jun 2009, and who then helped Ken Roy construct the needed changes for surnames100.php.

Config file created by Ken Roy.

Advantages

This mod, which eliminates [no surnames] that represent persons who have no information entered in their surname field, provides the following advantages:

  • Shows the true top 30 surnames on the surnames.php page
  • Shows the true top 100 surnames on the surnames100.php page

Limitations

The following limitations only apply to V1.0 of the mod:

  • Users will no longer be able to easily browse a public list of individuals who have no surname entered from the Surnames or Top 100 Surnames.
  • The [no surnames] will only be available on the Surnames All page.

The [no surnames] button remains on both the Surnames and Top 100 Surnames pages.

Revision History

Version Date Contents
V2.0 Dec 17, 2009 Updated config file to remove the modification to surnames.php which was incorporated into TNG 7.1.1
V1.0 July 23, 2009 Initial release of mod and config file

Requirements

  • A working TNG installation. The automated installation release was initially tested at TNG Version 7.1.0. Manual install was also tested at the TNG 7.1 level.
  • A backup of your TNG
    • surnames100.php files.
    • surnames.php (only for V1.0 of the mod)
  • An installed current version of the Mod Manager.

Automated Install

  1. Download the remove_no_surnames_v2.0.zip for TNG 7.1.1 and above
  2. Download the remove_no_surnames_v1.0.zip for TNG 7.1.0 and below only
  3. Unzip the downloaded config file into your admin/mod_folder
  4. Follow the normal automated installation for Mod Manager, as shown in the example Mod Manager - Installing Config Files to install the appropriate config file.

Manual Install

No longer recommended and may not be current.

This mod applies to the surnames.php and surnames100.php modules.

surnames.php

Note that the changes in surnames.php are shown in reverse order so the line numbers will still apply while you are making the updates.

1 - replace code from line 108-118 in TNG 7.0.2 through TNG 7.1 (module not changed in TNG 7.0.3)

	$col = -1;
	while( $surname = mysql_fetch_assoc( $result ) ) {
		$surname2 = urlencode($surname[lastname]);
		if(($count - 1) % 10 == 0)
			$col++;
		if( $surname[lastname] == "" )
			$linkstr3col[$col] .= "<tr><td class=\"fieldnameback fieldname\" align=\"right\">$count.</td><td class=\"databack\"><a href=\"$search_url" . "mylastname=$nosurname&lnqualify=equals&mybool=AND$treestr\">$text[nosurname]</a> ($surname[lncount])</td></tr>\n";
		else
			$linkstr3col[$col] .= "<tr><td class=\"fieldnameback fieldname\" align=\"right\">$count.</td><td class=\"databack\"><a href=\"$search_url" . "mylastname=$surname2&lnqualify=equals&mybool=AND$treestr\">$surname[lowername]</a> ($surname[lncount])</td></tr>";
		$count++;
	}

with following code

	$col = 0;
	while( ($surname = mysql_fetch_assoc( $result )) && ($count < 31) ) {
		$surname2 = urlencode($surname[lastname]);
		if( $surname[lastname] != "" ) {
			$linkstr3col[$col] .= "<tr><td class=\"fieldnameback fieldname\" align=\"right\">$count.</td><td class=\"databack\"><a href=\"$search_url" . "mylastname=$surname2&lnqualify=equals&mybool=AND$treestr\">$surname[lowername]</a> ($surname[lncount])</td></tr>";
		if($count % 10 == 0)
			$col++;
			$count++;
		}
	}

2 - replace code in line 104 in TNG 7.0.2 through TNG 7.1 (module not changed in TNG 7.0.3)

$query = "SELECT ucase( $binary $surnamestr ) as lastname, $surnamestr as lowername, count( ucase($binary lastname ) ) as lncount FROM $people_table $wherestr GROUP BY lowername ORDER by lncount DESC LIMIT 30"; 

with following code

$query = "SELECT ucase( $binary $surnamestr ) as lastname, $surnamestr as lowername, count( ucase($binary lastname ) ) as lncount FROM $people_table $wherestr GROUP BY lowername ORDER by lncount DESC LIMIT 31";  // increased to 31 to skip no surname


3 - replace code from line 85-99 in TNG 7.0.2 through TNG 7.1 (module not changed in TNG 7.0.3)

	$col = -1;
	while( $surname = mysql_fetch_assoc( $result ) ) {
		if(($namectr -1) % 8 == 0) {
			$col++;
		}
		if( $surname[firstchar] == "" )
			$linkstr2col[$col] .= "<p style=\"padding:2px;margin:8px\"><a href=\"$search_url" . "mylastname=$nosurname&lnqualify=equals&mybool=AND$treestr\" class=\"snlink\" title=\"$text[nosurname]\">[ ]</a> ($surname[lncount])</p>\n";
		else {
			//$urlfirstchar = urlencode($surname[firstchar]);
			$urlfirstchar = $surname[firstchar];
			//if($charset == "UTF-8") $surname[firstchar] = utf8_encode($surname[firstchar]);
			$linkstr2col[$col] .= "<p style=\"padding:2px;margin:8px;\"><a href=\"$surnames_oneletter_url" . "firstchar=$urlfirstchar$treestr\" class=\"snlink\" title=\"$text[surnamesstarting]: $surname[firstchar]\">$surname[firstchar]</a> ($surname[lncount])</p>\n";
		}
		$namectr++;
	}

with following code

	$col = 0;
	while( $surname = mysql_fetch_assoc( $result ) ) {
		if( $surname[firstchar] != "" ) {
			//$urlfirstchar = urlencode($surname[firstchar]);
			$urlfirstchar = $surname[firstchar];
			//if($charset == "UTF-8") $surname[firstchar] =
			utf8_encode($surname[firstchar]);
			$linkstr2col[$col] .= "<p style=\"padding:2px;margin:8px;\"><a href=\"$surnames_oneletter_url" . "firstchar=$urlfirstchar$treestr\" class=\"snlink\" title=\"$text[surnamesstarting]: $surname[firstchar]\">$surname[firstchar]</a> ($surname[lncount])</p>\n";
		if($namectr % 8 == 0) {
			$col++;
		}
		$namectr++;
		}
	}

4 - replace code in line 69 in TNG 7.0.2 through TNG 7.1 (module not changed in TNG 7.0.3)

			$linkstr .= "<a href=\"$search_url" . "mylastname=$nosurname&lnqualify=equals&mybool=AND$treestr\" class=\"snlink\">$text[nosurname]</a>";

with following code

			{ }

surnames100.php

Note that the changes in surnames100.php are shown in reverse order so the line numbers will still apply while you are making the updates.

1 - replace code from lines 80-92

	while( $surname = mysql_fetch_assoc( $result ) ) {
		$surname2 = urlencode( $surname[lastname] );
		$name = $surname[lastname] ? "<a href=\"$search_url" . "mylastname=$surname2&lnqualify=equals&mybool=AND$treestr\">$surname[lowername]</a>" : "<a href=\"$search_url" . "mylastname=$nosurname&lnqualify=equals&mybool=AND$treestr\">$text[nosurname]</a>";
		echo "$counter. $name ($surname[lncount])<br/>\n";
		$counter++;
		$num_in_col_ctr++;
		if( $num_in_col_ctr == $num_in_col ) {
			echo "</span></td>\n<td>  </td>\n<td valign=\"top\"><span class=\"normal\">";
			$num_in_col_ctr = 0;
		}

with following code

	while( ($surname = mysql_fetch_assoc( $result )) && ($counter < $endat) ) {
		if ($surname[lastname] != "") { // if surname-not-blank
		$surname2 = urlencode( $surname[lastname] );
		$name = $surname[lastname] ? "<a href=\"$search_url" . "mylastname=$surname2&lnqualify=equals&mybool=AND$treestr\">$surname[lowername]</a>" : "<a href=\"$search_url" . "mylastname=$nosurname&lnqualify=equals&mybool=AND$treestr\">$text[nosurname]</a>";
		echo "$counter. $name ($surname[lncount])<br/>\n";
		$counter++;
		$num_in_col_ctr++;
		if( $num_in_col_ctr == $num_in_col ) {
			echo "</span></td>\n<td>  </td>\n<td valign=\"top\"><span class=\"normal\">";
			$num_in_col_ctr = 0;
		}
		} // end if surname-not-blank

2 - replace code in line 70

$topnum = mysql_num_rows($result);

with following code

$topnumbr = mysql_num_rows($result);
$endat = ($topnumbr == $topnum) ? ($topnumbr + 1) : $topnumbr;

3 - replace code in line 67

$query = "SELECT ucase( $binary $surnamestr ) as lastname, $surnamestr as lowername, count( ucase($binary lastname) ) as lncount FROM $people_table $wherestr GROUP BY lowername ORDER by lncount DESC LIMIT $topnum";

with following code

$query = "SELECT ucase( $binary $surnamestr ) as lastname, $surnamestr as lowername, count( ucase($binary lastname) ) as lncount FROM $people_table $wherestr GROUP BY lowername ORDER by lncount DESC LIMIT $topnumbr";

4 - after line 65

$topnum = $topnum ? $topnum : 100;

add following lines

$topnumbr = $topnum + 1; // increased by 1 to enable skipping No Surname

Visualization of this mod

The image on the right shows the Top 100 counts, which includes the [No Surname] count when the mod is not installed.

Top100 surnames without mod.jpg

The image on the right shows the Top 100 counts without the [No Surname] count when the mod is installed.

Top100 surnames mod.jpg

In the event of a problem

  • Try using the Mod Manager Remove capability
  • Or copy your backup surnames100.php file to your TNG directory (and surnames.php on TNG 7.1.0 and below)
  • All should now be well.

Sites using this mod

Please add TNG site that you have found that utilize this modification