Skip to content

Commit

Permalink
Updated against webtrees v2.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
miqrogroove committed May 11, 2022
1 parent b8acdc4 commit d68f08c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Family Tree Home Page
Make your family tree appear on the front page for all site users.

This is a custom module for [webtrees v2.0](https://github.com/fisharebest/webtrees).
This is a custom module for [webtrees v2.1](https://github.com/fisharebest/webtrees).

Whenever someone visits your front page or signs in from the front page, they should land back on the front page again instead of seeing "My Page".

Expand Down
9 changes: 5 additions & 4 deletions TreeHomePage.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
Family Tree Home Page
Copyright (C) 2020 by Robert Chapin
Copyright (C) 2022 by Robert Chapin
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -22,6 +22,7 @@

use Fisharebest\Webtrees\Http\RequestHandlers\CreateTreePage;
use Fisharebest\Webtrees\Http\RequestHandlers\LoginPage;
use Fisharebest\Webtrees\Http\RequestHandlers\ManageTrees;
use Fisharebest\Webtrees\Http\RequestHandlers\TreePage;

// Most of the code below this line should mirror Fisharebest\Webtrees\Http\RequestHandlers\HomePage
Expand All @@ -32,6 +33,7 @@
use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\Tree;
use Fisharebest\Webtrees\User;
use Fisharebest\Webtrees\Validator;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
Expand All @@ -46,8 +48,7 @@ class TreeHomePage implements RequestHandlerInterface
{
use ViewResponseTrait;

/** @var TreeService */
private $tree_service;
private TreeService $tree_service;

/**
* HomePage constructor.
Expand All @@ -68,7 +69,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
{
$default = Site::getPreference('DEFAULT_GEDCOM');
$tree = $this->tree_service->all()->get($default) ?? $this->tree_service->all()->first();
$user = $request->getAttribute('user');
$user = Validator::attributes($request)->user();

if ($tree instanceof Tree) {
if ($tree->getPreference('imported') === '1') {
Expand Down
4 changes: 2 additions & 2 deletions module.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
Family Tree Home Page
Copyright (C) 2020 by Robert Chapin
Copyright (C) 2022 by Robert Chapin
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -108,7 +108,7 @@ public function customModuleAuthorName(): string
*/
public function customModuleVersion(): string
{
return '1.0.01';
return '1.0.02';
}

/**
Expand Down

0 comments on commit d68f08c

Please sign in to comment.