... | ... |
@@ -1,17 +1,17 @@ |
1 | 1 |
<?xml version="1.0" ?><xliff version="1.1"> |
2 | 2 |
<file datatype="php" original="src/Resources/contao/languages/en/tl_member.php" source-language="en" target-language="de"> |
3 | 3 |
<body> |
4 |
+ <trans-unit id="tl_member_settings.avatar_legend"> |
|
5 |
+ <source>Extended member settings</source> |
|
6 |
+ <target>Erweiterte Mitgliedseinstellungen</target> |
|
7 |
+ </trans-unit> |
|
4 | 8 |
<trans-unit id="tl_member_settings.defaultAvatar.0"> |
5 |
- <source>Default profile pricutre</source> |
|
9 |
+ <source>Default avatar</source> |
|
6 | 10 |
<target>Standard-Profilbild</target> |
7 | 11 |
</trans-unit> |
8 | 12 |
<trans-unit id="tl_member_settings.defaultAvatar.1"> |
9 |
- <source>The default profile picture is displayed for members who have not set their own profile picture.</source> |
|
10 |
- <target>Das Standard-Profilbild wird bei Mitgliedern angezeigt, die keinen eigens Profilbild gesetzt haben.</target> |
|
11 |
- </trans-unit> |
|
12 |
- <trans-unit id="tl_member_settings.avatar_legend"> |
|
13 |
- <source>Profile picture</source> |
|
14 |
- <target>Profilbild</target> |
|
13 |
+ <source>The default avatar is displayed for members who have not uploaded their own profile picture.</source> |
|
14 |
+ <target>Das Standard-Profilbild wird bei Mitgliedern angezeigt, welches kein eigenes Profilbild hochgeladen haben.</target> |
|
15 | 15 |
</trans-unit> |
16 | 16 |
</body> |
17 | 17 |
</file> |
... | ... |
@@ -16,6 +16,7 @@ declare(strict_types=1); |
16 | 16 |
namespace Oveleon\ContaoMemberExtensionBundle; |
17 | 17 |
|
18 | 18 |
use Contao\BackendTemplate; |
19 |
+use Contao\Config; |
|
19 | 20 |
use Contao\FilesModel; |
20 | 21 |
use Contao\FrontendUser; |
21 | 22 |
use Contao\MemberModel; |
... | ... |
@@ -95,25 +96,31 @@ class ModuleAvatar extends Module |
95 | 96 |
|
96 | 97 |
$projectDir = System::getContainer()->getParameter('kernel.project_dir'); |
97 | 98 |
|
99 |
+ // Check for avatar |
|
100 |
+ if(!!$objMember->avatar) |
|
101 |
+ { |
|
102 |
+ $objFile = FilesModel::findByUuid($objMember->avatar); |
|
103 |
+ } |
|
104 |
+ // Check for standard avatar from member configuration |
|
105 |
+ else if(!!Config::get('defaultAvatar')) |
|
106 |
+ { |
|
107 |
+ $objFile = FilesModel::findByUuid(Config::get('defaultAvatar')); |
|
108 |
+ } |
|
109 |
+ else |
|
110 |
+ { |
|
111 |
+ $objTemplate->singleSRC = self::$strDefaultPath; |
|
112 |
+ } |
|
98 | 113 |
|
99 |
- if (!$this->User->avatar) |
|
114 |
+ // If file does not exist use default image |
|
115 |
+ if ($objFile === null || !is_file($projectDir . '/' . $objFile->path)) |
|
100 | 116 |
{ |
101 | 117 |
$objTemplate->singleSRC = self::$strDefaultPath; |
102 | 118 |
} |
103 | 119 |
else |
104 | 120 |
{ |
105 |
- $objFile = FilesModel::findByUuid($this->User->avatar); |
|
106 |
- |
|
107 |
- if ($objFile === null || !is_file($projectDir . '/' . $objFile->path)) |
|
108 |
- { |
|
109 |
- $objTemplate->singleSRC = self::$strDefaultPath; |
|
110 |
- } |
|
111 |
- else |
|
112 |
- { |
|
113 |
- $objTemplate->noAvatar = false; |
|
114 |
- $this->singleSRC = $objFile->path; |
|
115 |
- $this->addImageToTemplate($this->Template, $this->arrData); |
|
116 |
- } |
|
121 |
+ $objTemplate->noAvatar = false; |
|
122 |
+ $this->singleSRC = $objFile->path; |
|
123 |
+ $this->addImageToTemplate($this->Template, $this->arrData); |
|
117 | 124 |
} |
118 | 125 |
} |
119 | 126 |
} |