diff --git a/tests/MemberTest.php b/tests/MemberTest.php
index 9438cf297c..dcec874227 100644
--- a/tests/MemberTest.php
+++ b/tests/MemberTest.php
@@ -160,7 +160,7 @@ public function testGetMSPURL()
*/
public function testGetElizabethIIURL()
{
- $MEMBER = new MEMBER(array('person_id' => 1));
+ $MEMBER = new MEMBER(array('person_id' => 13935));
$this->assertEquals('/royal/elizabeth_the_second', $MEMBER->url());
}
diff --git a/tests/_fixtures/member.xml b/tests/_fixtures/member.xml
index b18684b9fd..5113a76201 100644
--- a/tests/_fixtures/member.xml
+++ b/tests/_fixtures/member.xml
@@ -63,7 +63,7 @@
9999-12-31
accession
still_in_office
- 1
+ 13935
2013-08-07 11:02:49
@@ -361,7 +361,7 @@
the Second, by the Grace of God, of the United Kingdom of Great Britain and Northern Ireland and of Her other Realms and Territories Queen, Head of the Commonwealth, Defender of the Faith
1952-02-06
9999-12-31
- 1
+ 13935
Queen
diff --git a/www/docs/mp/index.php b/www/docs/mp/index.php
index c6ff3946ac..deafd4457f 100644
--- a/www/docs/mp/index.php
+++ b/www/docs/mp/index.php
@@ -522,7 +522,7 @@ function get_person_by_postcode($pc) {
function get_person_by_name($name, $const='') {
$MEMBER = new MySociety\TheyWorkForYou\Member(array('name' => $name, 'constituency' => $const));
// Edge case, only attempt further detection if this isn't the Queen.
- if ($name !== 'elizabeth the second' || $const) {
+ if (($name !== 'elizabeth the second' && $name !== 'prince charles') || $const) {
twfy_debug ('MP', 'Redirecting for MP found by name/constituency');
member_redirect($MEMBER);
}
@@ -649,8 +649,12 @@ function person_summary_description ($MEMBER) {
if (in_array(HOUSE_TYPE_ROYAL, $MEMBER->houses())) {
# Royal short-circuit
- return 'Acceded on ' . $entered_house[HOUSE_TYPE_ROYAL]['date_pretty']
- . '
Coronated on 2 June 1953';
+ if (substr($entered_house[HOUSE_TYPE_ROYAL]['date'], 0, 4) == 1952) {
+ return 'Acceded on ' . $entered_house[HOUSE_TYPE_ROYAL]['date_pretty']
+ . '
Coronated on 2 June 1953';
+ } else {
+ return '';
+ }
}
$desc = '';
foreach ($MEMBER->houses() as $house) {
diff --git a/www/includes/easyparliament/member.php b/www/includes/easyparliament/member.php
index 2496edebc4..5cba011ca6 100644
--- a/www/includes/easyparliament/member.php
+++ b/www/includes/easyparliament/member.php
@@ -330,6 +330,13 @@ public function name_to_person_id($name, $const='') {
OR (given_name=:given_name AND family_name=:middle_and_last_names)
OR (title=:given_name AND given_name=:middle_name AND family_name=:family_name)
)";
+ } elseif ($this_page == 'royal') {
+ twfy_debug ('MP', $name);
+ if (stripos($name, 'elizabeth') !== false) {
+ $q .= "AND person_id=13935";
+ } elseif (stripos($name, 'charles') !== false) {
+ $q .= "AND person_id=26065";
+ }
}
$q = $this->db->query($q, $params);
diff --git a/www/includes/utility.php b/www/includes/utility.php
index 33be263928..40f9296335 100644
--- a/www/includes/utility.php
+++ b/www/includes/utility.php
@@ -907,9 +907,12 @@ function entities_to_numbers($string) {
function make_member_url($name, $const = '', $house = HOUSE_TYPE_COMMONS, $pid = null) {
// Case for Elizabeth II
- if ($house == HOUSE_TYPE_ROYAL)
- {
- return 'elizabeth_the_second';
+ if ($house == HOUSE_TYPE_ROYAL) {
+ if (stripos($name, 'elizabeth') !== false) {
+ return 'elizabeth_the_second';
+ } elseif (stripos($name, 'charles') !== false) {
+ return 'prince_charles';
+ }
}
$s = array(' ', '&', 'ô', 'Ö', 'ö', 'â', 'í', 'á', 'ú', 'é', 'ó', 'Ó');