global $mainframe;
JFactory::getLanguage()->load('com_user');
$db = JFactory::getDBO();
$db->setQuery("Select * From #__facileforms_records Where name = ".$db->Quote($this->formrow->name)." And paypal_tx_id <> ''");
$list = $db->loadObjectList();
$listSize = count($list); 

for($i = 0; $i < $listSize;$i++){
$db->setQuery("Select * From #__users Where id = ".$db->Quote($list[$i]->user_id)." And block = 1");
$userResult = $db->loadObjectList();
        if(count($userResult) == 1){
          $db->setQuery("Update #__users Set block = 0 Where id = ".$db->Quote($userResult[0]->id)."");
          $db->query();

		$usersConfig 	= &JComponentHelper::getParams( 'com_users' );
					$sitename 		= $mainframe->getCfg( 'sitename' );
					$useractivation = $usersConfig->get( 'useractivation' );
					$mailfrom 		= $mainframe->getCfg( 'mailfrom' );
					$fromname 		= $mainframe->getCfg( 'fromname' );
					$siteURL		= JURI::base();

					$subject 	= sprintf ( JText::_( 'Account details for' ), $userResult[0]->name, $sitename);
					$subject 	= html_entity_decode($subject, ENT_QUOTES);

					
					$message = sprintf ( JText::_( 'SEND_MSG' ), $userResult[0]->name, $sitename, $siteURL);
					

					$message = html_entity_decode($message, ENT_QUOTES);

					//get all super administrator
					$query = 'SELECT name, email, sendEmail' .
							' FROM #__users' .
							' WHERE LOWER( usertype ) = "super administrator"';
					$db->setQuery( $query );
					$rows = $db->loadObjectList();

					// Send email to user
					if ( ! $mailfrom  || ! $fromname ) {
						$fromname = $rows[0]->name;
						$mailfrom = $rows[0]->email;
					}

					JUtility::sendMail($mailfrom, $fromname, $userResult[0]->email, $subject, $message);

					// Send notification to all administrators
					$subject2 = sprintf ( JText::_( 'Account details for' ), $name, $sitename);
					$subject2 = html_entity_decode($subject2, ENT_QUOTES);

					// get superadministrators id
					foreach ( $rows as $row )
					{
						if ($row->sendEmail)
						{
							$message2 = sprintf ( JText::_( 'SEND_MSG_ADMIN' ), $row->name, $sitename, $userResult[0]->name, $userResult[0]->email, $userResult[0]->username);
							$message2 = html_entity_decode($message2, ENT_QUOTES);
							JUtility::sendMail($mailfrom, $fromname, $row->email, $subject2, $message2);
						}
					}
    }
}