Advanced User Upgrade [Deleted]

Cédric, you can point out exactly where the comma is missing.

Thanks.
I'm not sure, but try this:
Code:
<?php

class Insy_UserUpgrade_Installer
{
    public static function install($installedAddon)
    {
        $db = XenForo_Application::get('db');
        $version = is_array($installedAddon) ? $installedAddon['version_id'] : 0;

        switch ($version)
        {
            case 1:
                $db->query('
                    ALTER TABLE xf_user_upgrade
                    ADD paypal_item_name varchar(255) NOT NULL;
                ');
                break;
            default:
                $db->query('
                ALTER TABLE xf_user_upgrade
                  ADD paypal_account varchar(255) NOT NULL,
                  ADD paypal_item_name varchar(255) NOT NULL;
                ');
        }
    }

    public static function uninstall($installedAddon)
    {
        $db = XenForo_Application::get('db');

        $db->query('
            ALTER TABLE xf_user_upgrade
            DROP COLUMN paypal_account,
            DROP COLUMN paypal_item_name;
        ');
    }
}
 
Thanks Cédric, this has worked correctly to install and uninstall the version 1.0.1.

Thanks also to Insy.
 
You forgot a coma at then end of the first ADD
Thank you for your help. I had not been able to identify this problem during development as these queries work as are with MySQL 5.5, I was able to reproduce the problem by installing the 5.1 but you were fastest than me to give a solution :)

I updated the ZIP with your fix.
 
Thank you for your help. I had not been able to identify this problem during development as these queries work as are with MySQL 5.5, I was able to reproduce the problem by installing the 5.1 but you were fastest than me to give a solution :)

I updated the ZIP with your fix.
"My fix" is a big word ^^ The way you extend the paypal class is really interesting. Well done! I've just a question: I saw you've chosen to override the controller save function, do you think it's possible to extend its datawriter instead? It's what I've done here, but I'm not sure it can work with what you want to do.
 
"My fix" is a big word ^^ The way you extend the paypal class is really interesting. Well done! I've just a question: I saw you've chosen to override the controller save function, do you think it's possible to extend its datawriter instead? It's what I've done here, but I'm not sure it can work with what you want to do.
Thanks. I had to to extend the controller because XenForo saves only the fields mentionned in $input ($dw->bulkSet($input)).
As you can see, the DataWriter is already extended.
 
Thanks. I had to to extend the controller because XenForo saves only the fields mentionned in $input ($dw->bulkSet($input)).
As you can see, the DataWriter is already extended.
I mean to extend the "protected function _preSave()", but I'm not sure it's possible to get datas from the form here.
 
I'll try that, thx :)
Me too :) It would be nice on public controller to avoid to access twice or more to the database. For the admin controller, you can just extend the function and do another request to get data from the form and save it with a new datawriter & a new model. It shouldn't be a problem. But better check with php experts such as Ragtek ;)
 
Me too :) It would be nice on public controller to avoid to access twice or more to the database. For the admin controller, you can just extend the function and do another request to get data from the form and save it with a new datawriter & a new model. It shouldn't be a problem. But better check with php experts such as Ragtek ;)
I've updated the zip. I have not published a new version because this is only a small optimization.
I used the link you gave me to remove the listener load_controller and use _preSave() ;)
 
How do I uninstall? I got this error when trying to uninstall.

Server Error

Mysqli prepare error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DROP COLUMN paypal_item_name' at line 3
  1. Zend_Db_Statement_Mysqli->_prepare() in Zend/Db/Statement.php at line 115
  2. Zend_Db_Statement->__construct() in Zend/Db/Adapter/Mysqli.php at line 381
  3. Zend_Db_Adapter_Mysqli->prepare() in Zend/Db/Adapter/Abstract.php at line 478
  4. Zend_Db_Adapter_Abstract->query() in Insy/UserUpgrade/Installer.php at line 35
  5. Insy_UserUpgrade_Installer::uninstall()
  6. call_user_func() in XenForo/DataWriter/AddOn.php at line 193
  7. XenForo_DataWriter_AddOn->_postDelete() in AddOnInstaller/DataWriter/AddOn.php at line 10
  8. AddOnInstaller_DataWriter_AddOn->_postDelete() in Bookmarks/DataWriter/AddOn.php at line 34
  9. Bookmarks_DataWriter_AddOn->_postDelete() in XenForo/DataWriter.php at line 1738
  10. XenForo_DataWriter->delete() in XenForo/ControllerAdmin/AddOn.php at line 116
  11. XenForo_ControllerAdmin_AddOn->actionDelete() in XenForo/FrontController.php at line 310
  12. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
  13. XenForo_FrontController->run() in /home/user/public_html/admin.php at line 13
 
I have installed this but it seems it may be broken on our end, anyone else using this at the moment? We receive this when trying to edit a user upgrade or adding a new upgrade.

pp.webp
 
IT seems there is a conflict some where between this add-on and Naatan's Advanced User Upgrades

I disabled the Advanced User Upgrades then I was able to enter the Paypal emails like expected then re-enabled Advanced User Upgrades after that. Not sure if everything actually works at the moment but will test it further.
 
Top Bottom