Zodiac signs

Zodiac signs 2.0.1

No permission to download

estranged

Well-known member
It breaks the members page.

TypeError: number_format(): Argument #1 ($num) must be of type float, string given in src/XF/Language.php at line 852
  1. number_format() in src/XF/Language.php at line 852
  2. XF\Language->numberFormat() in src/XF/MemberStat/Birthdays.php at line 18
  3. XF\MemberStat\Birthdays::XF\MemberStat\{closure}() in src/XF/Mvc/Entity/AbstractCollection.php at line 136
  4. XF\Mvc\Entity\AbstractCollection->pluck() in src/XF/MemberStat/Birthdays.php at line 19
  5. XF\MemberStat\Birthdays::getBirthdayUsers() in src/XF/Service/MemberStat/Preparer.php at line 139
  6. XF\Service\MemberStat\Preparer->applyCallback() in src/XF/Service/MemberStat/Preparer.php at line 202
  7. XF\Service\MemberStat\Preparer->getResultsData() in src/XF/Service/MemberStat/Preparer.php at line 102
  8. XF\Service\MemberStat\Preparer->getResults() in src/XF/Entity/MemberStat.php at line 124
  9. XF\Entity\MemberStat->getResults() in src/XF/Pub/Controller/Member.php at line 124
  10. XF\Pub\Controller\Member->actionIndex() in src/XF/Mvc/Dispatcher.php at line 352
  11. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 259
  12. XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 115
  13. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 57
  14. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2345
  15. XF\App->run() in src/XF.php at line 512
  16. XF::runApp() in index.php at line 20
 

gouwepeer.nl

Well-known member
I've modificate the template addons/X0815/ZodiacSigns/XF/Entity/UserProfile.php:
PHP:
<?php

namespace X0815\ZodiacSigns\XF\Entity;

class UserProfile extends XFCP_UserProfile
{
    public function getAge($bypassPrivacy = false)
    {
        $age = parent::getAge($bypassPrivacy);

        if(\X0815\ZodiacSigns\Listener::$_blurber !== false && $this->User->Option->show_zodiac && $this->dob_month && $this->dob_day)
        {
            $zodiac = $this->getZodiacSign($this->dob_day, $this->dob_month);

            if($zodiac !== 'none')
            {
                $zodiacMode = \XF::options()->zodiacModus;

                if($zodiacMode == 'text')
                {
                    $zodiac_data = \XF::phrase('zodiac_' . $zodiac);
                }
                else
                {
                    $zodiac_data = $this->getZodiacIcon($zodiac);
                }

                $templater = $this->app()->templater();
                $zodiacExplain = $templater->filterForAttr($templater, \XF::phrase('zodiac_' . $zodiac . '_explain'), $null);

                $seperator = $age !== false ? $age . ' <span role="presentation" aria-hidden="true">&middot;</span> ' : '';
                return $seperator . "<span class=\"zodiac-sign zodiac-sign--{$zodiac}\" data-xf-init=\"tooltip\" data-content=\"{$zodiacExplain}\"  data-trigger=\"hover focus click\">{$zodiac_data}</span>";
            }
        }

        return $age;
    }

    protected function getZodiacSign(int $day = null, int $month = null): string
    {
        if(($month == 1 && $day > 20) || ($month == 2 && $day < 20))
        {
            return 'aquarius';
        }
        elseif(($month == 2 && $day > 18) || ($month == 3 && $day < 21))
        {
            return 'pisces';
        }
        elseif(($month == 3 && $day > 20) || ($month == 4 && $day < 21))
        {
            return 'aries';
        }
        elseif(($month == 4 && $day > 20) || ($month == 5 && $day < 22))
        {
            return 'taurus';
        }
        elseif(($month == 5 && $day > 21) || ($month == 6 && $day < 22))
        {
            return 'gemini';
        }
        elseif(($month == 6 && $day > 21) || ($month == 7 && $day < 24))
        {
            return 'cancer';
        }
        elseif(($month == 7 && $day > 23) || ($month == 8 && $day < 24))
        {
            return 'leo';
        }
        elseif(($month == 8 && $day > 23) || ($month == 9 && $day < 24))
        {
            return 'virgo';
        }
        elseif(($month == 9 && $day > 23) || ($month == 10 && $day < 24))
        {
            return 'libra';
        }
        elseif(($month == 10 && $day > 23) || ($month == 11 && $day < 23))
        {
            return 'scorpio';
        }
        elseif(($month == 11 && $day > 22) || ($month == 12 && $day < 23))
        {
            return 'sagittarius';
        }
        elseif(($month == 12 && $day > 22) || ($month == 1 && $day < 21))
        {
            return 'capricorn';
        }

        return 'none';
    }

    protected function getZodiacIcon($zodiac)
    {
        switch ($zodiac)
        {
            case 'aquarius':
                return '&#9810';

            case 'pisces':
                return '&#9803';

            case 'aries':
                return '&#9800';

            case 'taurus':
                return '&#9801';

            case 'gemini':
                return '&#9802';

            case 'cancer':
                return '&#9803';

            case 'leo':
                return '&#9804';

            case 'virgo':
                return '&#9805';

            case 'libra':
                return '&#9806';

            case 'scorpio':
                return '&#9807';

            case 'sagittarius':
                return '&#9808';

            case 'capricorn':
                return '&#9800';
        }

        return false;
    }
}
if(false)
{
    class XFCP_UserProfile extends \XF\Entity\UserProfile {}
}
Result:
Schermafdruk van 2022-01-23 14-28-39.png
 
Top