File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -898,13 +898,12 @@ public function themeBackground(Request $request)
898
898
//Delete custom background image
899
899
public function removeBackground ()
900
900
{
901
+ $ userId = Auth::user ()->id ;
901
902
902
- $ user_id = Auth::user ()->id ;
903
- $ path = findBackground ($ user_id );
904
- $ path = base_path ('assets/img/background-img/ ' .$ path );
905
-
906
- if (File::exists ($ path )) {
907
- File::delete ($ path );
903
+ // Delete the user's current background image if it exists
904
+ while (findBackground ($ userId ) !== "error.error " ) {
905
+ $ avatarName = "assets/img/background-img/ " . findBackground (Auth::id ());
906
+ unlink (base_path ($ avatarName ));
908
907
}
909
908
910
909
return back ();
@@ -1055,11 +1054,12 @@ public function deleteUser(request $request)
1055
1054
//Delete profile picture
1056
1055
public function delProfilePicture ()
1057
1056
{
1058
- $ user_id = Auth::user ()->id ;
1059
- $ path = base_path (findAvatar ($ user_id ));
1057
+ $ userId = Auth::user ()->id ;
1060
1058
1061
- if (File::exists ($ path )) {
1062
- File::delete ($ path );
1059
+ // Delete the user's current avatar if it exists
1060
+ while (findAvatar ($ userId ) !== "error.error " ) {
1061
+ $ avatarName = findAvatar ($ userId );
1062
+ unlink (base_path ($ avatarName ));
1063
1063
}
1064
1064
1065
1065
return back ();
You can’t perform that action at this time.
0 commit comments