We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

How To Remove Delete Profile | Forum

Topic location: Forum home » Support » General Questions
Ken
Ken Jul 25 '15
Is there a way to hide or remove the 'delete profile' option from ow 1.7.5? Anyone, please?
ross Team
ross Jul 26 '15
Apply these styles in the Edit Theme section/CSS

span.unregister_profile_button .ow_ic_delete{

display: none!important;

}

John
John Aug 12 '15
Is it different from previous versions of OW? hmm... not sure

Go to this file:

ow_system_plugins/base/views/controllers/edit_index.html


Edit this line:

{if !$isAdmin } {decorator name="button" class="unregister_profile_button ow_ic_delete ow_red ow_negative" langLabel='base+delete_profile'} {/if}

If you want to remove the button for everyone including yourself (admin), then simply delete the whole code line.

BUT..

If you want to remove the delete button on user profile edit but allow yourself as Admin to see that button when you edit users' profiles, DO NOT DELETE THE WHOLE CODE LINE.. simply remove the "!" from {if !$isAdmin } . That means the button will not appear to your users on their 'profile edit page'... but will always appear to you as admin. Even in your own profile edit.

Be careful not to click it unnecessarily as there may be no warning before the action.

Good luck


Taissa Team
Taissa Aug 13 '15
Ken, we recommend not to modify the core files because when you update your site - all the changes you've made will be lost.
Ken
Ken Aug 13 '15
Thanks @Taissa, John, Ross... I appreciate your input.
dave Leader
dave Jan 13 '18
Remember folks that all this does is remove the button option.  They can still delete their profile if they type in the url manually. 


example.com/profile/delete


in order to stop them from deleting their account you can either find a plugin to do so or you will need to edit the core php file to modify the process when they type that link.  When you edit the core and there is an update it will take away your changes. 



dave Leader
dave Jan 13 '18
So if you want to modify the core you just need to modify the php file if you want to leave the button. So even if you leave the button or they type it in manually, if they are not admin it will just take them back to the edit page and skip the delete process. 


ow_system_plugins/base/controllers/delete_user.php


You have to wrap the currrent process in an if statment to check if admin or not.  


Here is the whole edited code starting at line 57 (replacing the old code) all the way down to the end of the page


       if ( OW::getRequest()->isPost() && !(OW::getRequest()->isAjax()) )        

      {                       

    

               //added by dave no delete mod            

               if( OW::getUser()->isAdmin() )            

               {                                       


                    if ( isset( $_POST['delete_user_button'] ) )               

                   {                

                      OW::getUser()->logout();
                       BOL_UserService::getInstance()->deleteUser($userId, true);
                       $this->redirect( OW::getRouter()->urlForRoute('base_index') ); 

                     } 


               }else{ 


                           //take them right back to the edit page  

                          $this->redirect( OW::getRouter()->urlForRoute('base_edit') ); 


                         }//close else if admin delete mod    

               
                         if ( isset( $_POST['cansel_button'] ) )            

                         {                


                             $this->redirect( OW::getRouter()->urlForRoute('base_edit') );  

                           }        

                   }  

          }

}


The Forum post is edited by dave Jan 13 '18
kalvindarwan
kalvindarwan Dec 21 '23
Among the services that you can bet on us to offer, we have windshield repair and replacement, side window replacement, and power window repair. Auto Glass Repair of Sacramento
James Walter
James Walter Jan 2
So whatever problem you’re having, we can fix it with some of the fastest turnaround in the business. Yuba City Mobile Truck Repair