• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

timber / timber / 20695674007

04 Jan 2026 04:14PM UTC coverage: 89.681% (+1.5%) from 88.211%
20695674007

push

travis-ci

nlemoine
test: Fix ancestors post tests

4615 of 5146 relevant lines covered (89.68%)

63.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.95
/src/Integration/CoAuthorsPlus/CoAuthorsPlusUser.php
1
<?php
2

3
namespace Timber\Integration\CoAuthorsPlus;
4

5
use stdClass;
6
use Timber\User;
7

8
class CoAuthorsPlusUser extends User
9
{
10
    /**
11
     * This user's avatar thumbnail
12
     *
13
     * @var string
14
     */
15
    protected $thumbnail;
16

17
    public static function from_guest_author(stdClass $coauthor)
×
18
    {
19
        $user = new static();
×
20
        $user->init($coauthor);
×
21

22
        return $user;
×
23
    }
24

25
    /**
26
     * @internal
27
     * @param false|object $coauthor co-author object
28
     */
29
    protected function init($coauthor = false)
5✔
30
    {
31
        /**
32
         * @var stdClass $coauthor
33
         */
34
        parent::init($coauthor);
5✔
35

36
        $this->id = $this->ID = (int) $coauthor->ID;
5✔
37
        $this->first_name = $coauthor->first_name;
5✔
38
        $this->last_name = $coauthor->last_name;
5✔
39
        $this->user_nicename = $coauthor->user_nicename;
5✔
40
        $this->description = $coauthor->description;
5✔
41
        $this->display_name = $coauthor->display_name;
5✔
42
        $this->_link = \get_author_posts_url(null, $coauthor->user_nicename);
5✔
43
    }
44

45
    /**
46
     * Get the user's avatar or Gravatar URL.
47
     *
48
     * @param array $args optional array arg to `get_avatar_url()`
49
     * @return string
50
     */
51
    public function avatar($args = null)
1✔
52
    {
53
        $prefer_gravatar = \apply_filters(
1✔
54
            'timber/co_authors_plus/prefer_gravatar',
1✔
55
            false
1✔
56
        );
1✔
57
        if ($prefer_gravatar) {
1✔
58
            return \get_avatar_url($this->user_email, $args);
1✔
59
        } else {
60
            // 96 is the default wordpress avatar size
61
            return \get_the_post_thumbnail_url($this->id, 96);
1✔
62
        }
63
    }
64
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc