• Resolved kfeuerherm

    (@kfeuerherm)


    I have a multisite installation at wludh.ca/2019 which I am using in a classroom setting. Each student has a site and there are also group sites.

    For testing, I am using wludh.ca/2019/feuerherm

    I have tried several times to link the site to Zotero. I do an add account, provide the API userID and the private key I set up at Zotero.org, get success, set the defaults, get success, but when I end up on the accounts page, there is nothing there?

    I am hosted at Hostgator, where apparently cURL and fsockopen() are enabled by default, etc.

    I have used Zotpress successfully at locost.feuerherm.ca, also part of a multisite installion (though I admit I have not updated the plug-in there recently). I see the items under Browse there, but even if I try that userID and private key (different from the above), nothing happens on the site I’m trying to configure.

    I’m at a loss as to what to try next? happy to send you whatever information is required.

    ADDENDUM: when I try the same thing on the control site (super-admin site), it fills in the ‘default site’ info. It didn’t on the subordinate site I am trying to configure. Zotpress is network activated, btw.

    ADDENDUM 2: I tried it without network activation, but activating on the local site instead. Still no go. I am wondering whether my sign-in (administrator on the local site) needs an extra capability added, perhaps?

    • This topic was modified 5 years, 1 month ago by kfeuerherm. Reason: Control site behaves differently
    • This topic was modified 5 years, 1 month ago by kfeuerherm. Reason: Does not work when activated locally rather than network, either
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Katie

    (@kseaborn)

    Hmm … I’m not sure what could be happening. Unfortunately I can’t provide free support on such matters and my time is very limited right now. Do you have a developer who could look into it?

    Thread Starter kfeuerherm

    (@kfeuerherm)

    A friend of mine may be able to. We’ll try to get together on this soon.

    In the mean time, finding that my personal site has 7.13 while the students’ site has 7.15, I downgraded to 7.13, but that didn’t fix it.

    If I find a solution, I will let you know.

    Plugin Author Katie

    (@kseaborn)

    Good luck! Would be curious to know. And if it’s not a matter of your setup on that site, but perhaps with Zotpress, do let me know.

    Thread Starter kfeuerherm

    (@kfeuerherm)

    Hi Katie,

    I just want to give you an update. I have someone at the university looking at this, but that’s a slow process. However, I’ve found a workaround, it seems, and maybe this can give you some insight into the problem.

    I have a multisite installation. I did have Zotpress network activated, but I undid that this morning in favour of having each site activate the plug-in individually (could be a red herring, but it seems the plug-in code moves to the wpdb when network activated? at least, I could not see it on the server, so I couldn’t try echo statements to monitor things. That failed anyway, but nevermind).

    Here’s what I did:

    Network deactivate Zotpress. Delete Zotpress. Reinstal Zotpress.

    Go to one of my individual sites where I’m administrator (not superadmin). Activate Zotpress there.

    Click on Zotpress in the dashboard, gets me the initial screen to test connections to zotero and wordpress. Success on both counts (as before), then click next.

    Attempt to add an account with API key and private key. System claims success… then goes to next page and the default account menu comes up blank. I know we’ve failed now though I don’t know why (I want to attach a file with images but can’t see how to do that here? so link to my dropbox: https://www.dropbox.com/s/a9vm7yn8lgjqj9j/DH100-Zotero-debug.docx?dl=0). I can proceed to change the citation scheme or whatever, click next, end up with no accounts listed.

    NOW. IF I GO TO dashboard > Zotpress > Options and click Reset…. and then try to add an account again, it succeeds.

    Just to make sure it was not a fluke, I created a dummy testing site and repeated the whole busines. Success again.

    So my guess right now is that (at least in my multisite installation) something is not being initialized properly, but that the reset sorts that out. I’ll see whether I can come up with any ideas as to what, though reminder, I don’t know PHP as such so while I can follow programme flow the rest is less clear to me.

    I’ll keep you posted.

    HTH

    K

    • This reply was modified 5 years ago by kfeuerherm.
    Thread Starter kfeuerherm

    (@kfeuerherm)

    I have now compared the code in admin.install.php with the reset code in admin.php, and noticed that some tables are not dropped, ditto some options.

    I really don’t know what all these things do at this point, but this patch to admin.install.php seems to do the trick for me in the short term. I’d be interested to get your feedback on this.

    <?php
    
    // INSTALL -----------------------------------------------------------------------------------------
    
        function Zotpress_install()
        {
            global $wpdb;
    
            $Zotpress_main_db_version = "5.2";
            $Zotpress_oauth_db_version = "5.0.5";
            $Zotpress_zoteroItemImages_db_version = "5.2.6";
    		$Zotpress_cache_version = "7.1.4";
    
            require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    
    		// REMOVE OLD DATABASES AND CHECKS - since 6.0
          
            // kfeuerherm: added next two lines 15 November 2019
            $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress;");
            $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_oauth;");
          
            $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_zoteroItems;");
            $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_zoteroCollections;");
            $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_zoteroTags;");
            $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_zoteroRelItemColl;");
            $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_zoteroRelItemTags;");
            // kfeuerherm: added next two lines 15 November 2019
            $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_cache ;");
            $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_zoteroItemImages ;");
          
            // kfeuerherm: added next nine lines 15 November 2019
            delete_option( 'Zotpress_cache_version' );
            delete_option( 'Zotpress_DefaultCPT' );
            delete_option( 'Zotpress_DefaultAccount' );
            delete_option( 'Zotpress_DefaultEditor' );
            delete_option( 'Zotpress_DefaultStyle' );
            delete_option( 'Zotpress_StyleList' );
            delete_option( 'Zotpress_update_version' );
            delete_option( 'Zotpress_main_db_version' );
            delete_option( 'Zotpress_oauth_db_version' );
    
            delete_option( 'Zotpress_zoteroItems_db_version' );
            delete_option( 'Zotpress_zoteroCollections_db_version' );
            delete_option( 'Zotpress_zoteroTags_db_version' );
            delete_option( 'Zotpress_zoteroRelItemColl_db_version' );
            delete_option( 'Zotpress_zoteroRelItemTags_db_version' );
          
            // kfeuerherm: added next three lines 15 November 2019
            delete_option( 'Zotpress_zoteroItemImages_db_version' );
            delete_option( 'Zotpress_update_notice_dismissed' );
            delete_option( 'Zotpress_zoteroItemImages_db_version' );
    
            // kfeuerherm: next two are in the reset code; not sure needed yet
            // delete_user_meta( $current_user->ID, 'zotpress_5_2_ignore_notice' );
            // delete_user_meta( $current_user->ID, 'zotpress_survey_notice_ignore' );
    
            // ZOTERO ACCOUNTS TABLE
    
    		/**
    		 * For each table, the basic check is:
    		 *
    		 * If the table version option doesn't exist, OR
    		 * If the table version is not the same as the update version (variables defined above)
    		 *
    		 * Then add/update the table and add/update the option
    		 */
    
            if ( ! get_option("Zotpress_main_db_version")
                    || get_option("Zotpress_main_db_version") != $Zotpress_main_db_version
            )
            {
    			$table_name = $wpdb->prefix . "zotpress";
    
                $structure = "CREATE TABLE $table_name (
                    id INT(9) NOT NULL AUTO_INCREMENT,
                    account_type VARCHAR(10) NOT NULL,
                    api_user_id VARCHAR(10) NOT NULL,
                    public_key VARCHAR(28) default NULL,
                    nickname VARCHAR(200) default NULL,
                    version VARCHAR(10) default '5.1',
                    UNIQUE KEY id (id)
                );";
    
                dbDelta($structure);
    
                update_option("Zotpress_main_db_version", $Zotpress_main_db_version);
            }
    
            // OAUTH CACHE TABLE
    
            if ( ! get_option("Zotpress_oauth_db_version")
                    || get_option("Zotpress_oauth_db_version") != $Zotpress_oauth_db_version
            )
            {
    			$table_name = $wpdb->prefix . "zotpress_oauth";
    
                $structure = "CREATE TABLE $table_name (
                    id INT(9) NOT NULL AUTO_INCREMENT,
                    cache LONGTEXT NOT NULL,
                    UNIQUE KEY id (id)
                );";
    
                dbDelta($structure);
    
                update_option("Zotpress_oauth_db_version", $Zotpress_oauth_db_version);
    
                // Initial populate
                if ($wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."zotpress_oauth;") == 0)
                    $wpdb->query("INSERT INTO ".$wpdb->prefix."zotpress_oauth (cache) VALUES ('empty')");
            }
    
            // ZOTERO ITEM IMAGES TABLE
    
            if ( ! get_option("Zotpress_zoteroItemImages_db_version")
                    || get_option("Zotpress_zoteroItemImages_db_version") != $Zotpress_zoteroItemImages_db_version
            )
            {
    			$table_name = $wpdb->prefix . "zotpress_zoteroItemImages";
    
                $structure = "CREATE TABLE $table_name (
                    id INT(9) AUTO_INCREMENT,
                    api_user_id VARCHAR(50),
                    item_key VARCHAR(50),
                    image TEXT,
                    UNIQUE KEY id (id),
                    PRIMARY KEY (api_user_id, item_key)
                );";
    
                dbDelta( $structure );
    
                update_option( "Zotpress_zoteroItemImages_db_version", $Zotpress_zoteroItemImages_db_version );
            }
    
            // ZOTERO CACHE TABLE
    
            if ( ! get_option("Zotpress_cache_version")
    				|| get_option("Zotpress_cache_version") != $Zotpress_cache_version
            )
            {
                $structure = "CREATE TABLE ".$wpdb->prefix."zotpress_cache (
                    id INT(9) NOT NULL AUTO_INCREMENT,
    				request_id VARCHAR(200) NOT NULL,
                    api_user_id VARCHAR(50),
                    json BLOB,
                    tags BLOB,
                    headers MEDIUMTEXT,
                    libver INT(9),
                    retrieved VARCHAR(100),
                    UNIQUE KEY id (id),
    				PRIMARY KEY (request_id)
                );";
    
                dbDelta($structure);
    
                update_option("Zotpress_cache_version", $Zotpress_cache_version);
            }
    
    	}
        register_activation_hook( ZOTPRESS_PLUGIN_FILE, 'Zotpress_install' );
    
    // INSTALL -----------------------------------------------------------------------------------------
    
    // UNINSTALL --------------------------------------------------------------------------------------
    
        function Zotpress_deactivate()
        {
            global $wpdb;
            global $current_user;
    
            // Drop all tables -- originally not including accounts/main, but not sure why
            $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress;");
            $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_oauth;");
            $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_zoteroItems;");
            $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_zoteroItemImages;");
            $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_zoteroCollections;");
            $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_zoteroTags;");
            $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_zoteroRelItemColl;");
            $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_zoteroRelItemTags;");
            $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_cache;");
    
            // Delete options
            delete_option( 'Zotpress_DefaultCPT' );
            delete_option( 'Zotpress_DefaultAccount' );
            delete_option( 'Zotpress_DefaultStyle' );
            delete_option( 'Zotpress_StyleList' );
            delete_option( 'Zotpress_update_version' );
            delete_option( 'Zotpress_main_db_version' );
            delete_option( 'Zotpress_oauth_db_version' );
            delete_option( 'Zotpress_zoteroItems_db_version' );
            delete_option( 'Zotpress_zoteroCollections_db_version' );
            delete_option( 'Zotpress_zoteroTags_db_version' );
            delete_option( 'Zotpress_zoteroRelItemColl_db_version' );
            delete_option( 'Zotpress_zoteroRelItemTags_db_version' );
    		delete_option( 'Zotpress_zoteroItemImages_db_version' );
    		delete_option( 'Zotpress_cache_version' );
    		delete_option( 'Zotpress_update_notice_dismissed' );
    
            // Delete user meta
            delete_user_meta( $current_user->ID, 'zotpress_5_2_ignore_notice' );
            delete_user_meta( $current_user->ID, 'zotpress_survey_notice_ignore' );
        }
    
        register_uninstall_hook( ZOTPRESS_PLUGIN_FILE, 'Zotpress_deactivate' );
    
    // UNINSTALL ---------------------------------------------------------------------------------------
    
    // UPDATE ------------------------------------------------------------------------------------------
    
    	/**
    	 *
    	 * If update check option doesn't exist, OR
    	 * If it exists but it's not the same version as the database update version
    	 *
    	 * Then, run the install, which installs or updates the databases
    	 *
    	**/
        if ( ! get_option( "Zotpress_update_version" )
    			|| get_option("Zotpress_update_version") != $GLOBALS['Zotpress_update_db_by_version'] )
        {
            Zotpress_install();
    
            // Add or update version number
            if ( !get_option( "Zotpress_update_version" ) )
                add_option( "Zotpress_update_version", $GLOBALS['Zotpress_update_db_by_version'], "", "no" );
            else
                update_option( "Zotpress_update_version", $GLOBALS['Zotpress_update_db_by_version'] );
        }
    
    // UPDATE ------------------------------------------------------------------------------------------
    
    ?>
    
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add account seems to succeed, but…’ is closed to new replies.