hellocoop / wordpress

A login and registration WordPress plugin for the Hellō service.
4 stars 2 forks source link

detect multi-site user vs site user and only link site user #32

Open dickhardt opened 1 year ago

dickhardt commented 1 year ago

It does not seem we can add Hellō Login to a wordpress.com user (make sense since they are global)

Since that can't happen -- need to detect if in multi-site and if current user is multisite, and if so, then don't link the account with Hellō Wallet

mscurtescu commented 1 year ago

General multisite description:

Multisite related fix in version 3.9.0:

dickhardt commented 1 year ago

Do not show connect to Hellō on settings page -> if we can detect if global account, then don't prompt -> if not, then don't prompt if a multi-site account

mscurtescu commented 1 year ago

Not showing "Connect to Hello" on plugin settings page when in multisite mode: https://github.com/hellocoop/wordpress/commit/8f6745d2da7f6283f2e39bbe401103feef70812e

mscurtescu commented 1 year ago

How to configure WordPress for Multisite:

The docker image can pass the necessary basic configuration through the WORDPRESS_CONFIG_EXTRA env var. See references to WORDPRESS_CONFIG_EXTRA and WP_ALLOW_MULTISITE and the linked issue 142: https://hub.docker.com/_/wordpress

mscurtescu commented 1 year ago

The Heateor Social Login plugin does an interesting activation for all blogs:

function heateor_sl_activate_plugin( $network_wide ) {

    global $wpdb;
    if ( function_exists( 'is_multisite' ) && is_multisite() ) {
        // check if it is network activation if so run the activation function for each id
        if ( $network_wide ) {
            $old_blog =  $wpdb->blogid;
            // Get all blog ids
            $blog_ids =  $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );

            foreach( $blog_ids as $blog_id ) {
                switch_to_blog( $blog_id );
                heateor_sl_save_default_options();
            }
            switch_to_blog( $old_blog );
            return;
        }
    }
    heateor_sl_save_default_options();
    set_transient( 'heateor-sl-admin-notice-on-activation', true, 5 );

}
register_activation_hook( __FILE__, 'heateor_sl_activate_plugin' );
mscurtescu commented 1 year ago

Nextend Social Login and Register

Multisite notes:

Social Login & Register for WordPress – 40+ Social Networks

Multisite notes:

Heateor Social Login WordPress

Multisite notes:

WordPress Social Login and Register (Discord, Google, Twitter, LinkedIn)

Related:

Multisite notes: