1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed Delete saved user identifiy data on identify service delete

Discussion in 'Resolved Bug Reports' started by ragtek, Jul 27, 2011.

  1. ragtek

    ragtek Guest

    As you see in this thread: http://xenforo.com/community/thread...messenger-id-to-be-visible-in-profiles.18319/ the stored user data aren't deleted, if you delete a identify service.

    If you delete a identify service, the user will have a ugly:
    identity_service_name_yahoo: xxx on his profile

    as you see in dw, you're only deleting the phrases:
    PHP:
        /**
        * Post-delete handling.
        */
        
    protected function _postDelete()
        {
            
    $this->_deleteMasterPhrase($this->_getNamePhraseName($this->get('identity_service_id')));
            
    $this->_deleteMasterPhrase($this->_getHintPhraseName($this->get('identity_service_id')));
        }
     

    Attached Files:

    erich37 likes this.
  2. ragtek

    ragtek Guest

    I've tried to add this to the dm:

    PHP:
    protected function _postDelete()
        {
            
    $this->_deleteMasterPhrase($this->_getNamePhraseName($this->get('identity_service_id')));
            
    $this->_deleteMasterPhrase($this->_getHintPhraseName($this->get('identity_service_id')));
     
            
    $db $this->_db;

            
    $id $db->quote($this->get('identity_service_id'));
            
    $db->delete('xf_user_identity''identity_service_id = ' $id);
        }
    but that's not enough, because the identity data are also saved serialized in the xf_user_profile :(
     
  3. ragtek

    ragtek Guest

    I couldn't go out of the office without a bugfix for this:d

    so, if anybody is interested in this and want to fix it, before kier & mike fix it in the core:
    file: XenForo_DataWriter_IdentityService
    PHP:
            protected function _postDelete()

            {
                
    $this->_deleteMasterPhrase($this->_getNamePhraseName($this->get('identity_service_id')));
                
    $this->_deleteMasterPhrase($this->_getHintPhraseName($this->get('identity_service_id')));


                
    $db $this->_db;

                
    $id $db->quote($this->get('identity_service_id'));

                
    $where "identity_service_id = " $id;

                
    $users $db->fetchAll("select user_id from xf_user_identity where " $where);
               

                foreach (
    $users AS $user){
                    
    /** @var $dw XenForo_DataWriter_User */
                    
    $dw XenForo_DataWriter::create('XenForo_DataWriter_User');
                    
    $dw->setExistingData($user);
                    
    $dw->setIdentity($this->get('identity_service_id'), '');
                    
    $dw->save();
                }
                
    $db->delete('xf_user_identity'$where);
                
            }
     
  4. erich37

    erich37 Well-Known Member

  5. Mike

    Mike XenForo Developer Staff Member

    The structure changes of 1.1 basically moot this issue entirely. :)
     
    erich37 likes this.

Share This Page