Fixed link to edit own profile inside user dropdown
authorAlexander Ebert <ebert@woltlab.com>
Sat, 20 May 2017 20:05:32 +0000 (22:05 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 20 May 2017 20:05:38 +0000 (22:05 +0200)
The code previously lacked a check for ther profile ownership, causing
administrators to start editing a foreign profile once they click on
"Edit Profile" in their user panel dropdown.

com.woltlab.wcf/templates/user.tpl

index 524dc0669bc6268b9896faff0b69b5700d5a645b..46860e76f3fd7bba35d4d71b05c422a49a0b3afd 100644 (file)
                                });
                                
                                var userProfileEditor = new WCF.User.Profile.Editor({@$user->userID}, {if $editOnInit}true{else}false{/if});
-                               var editLink = elBySel('.interactiveDropdownItemsUserMenu .jsUserPanelEditProfile');
-                               if (editLink) {
-                                       editLink.addEventListener(WCF_CLICK_EVENT, function (event) {
-                                               userProfileEditor._beginEdit(event);
-                                               
-                                               WCF.CloseOverlayHandler.forceExecution();
-                                       });
-                               }
+                               {if $__wcf->getUser()->userID == $user->userID}
+                                       var editLink = elBySel('.interactiveDropdownItemsUserMenu .jsUserPanelEditProfile');
+                                       if (editLink) {
+                                               editLink.addEventListener(WCF_CLICK_EVENT, function (event) {
+                                                       userProfileEditor._beginEdit(event);
+                                                       
+                                                       WCF.CloseOverlayHandler.forceExecution();
+                                               });
+                                       }
+                               {/if}
                        {/if}
                        
                        {if $followingCount > 7}