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

timber / timber / 5690593717

pending completion
5690593717

Pull #1617

github

web-flow
Merge f587ceffa into b563d274e
Pull Request #1617: 2.x

4433 of 4433 new or added lines in 57 files covered. (100.0%)

3931 of 4433 relevant lines covered (88.68%)

58.28 hits per line

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

83.33
/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)
30
    {
31
        /**
32
         * @var stdClass $coauthor
33
         */
34
        parent::init($coauthor);
42✔
35

36
        $this->id = $this->ID = (int) $coauthor->ID;
42✔
37
        $this->first_name = $coauthor->first_name;
42✔
38
        $this->last_name = $coauthor->last_name;
42✔
39
        $this->user_nicename = $coauthor->user_nicename;
42✔
40
        $this->description = $coauthor->description;
42✔
41
        $this->display_name = $coauthor->display_name;
42✔
42
        $this->_link = \get_author_posts_url(null, $coauthor->user_nicename);
42✔
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)
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