WordPress.org

Forums

Connections Business Directory
[resolved] [Plugin: Connections] Support multisite in single mode (6 posts)

  1. lancelot-du-lac
    Member
    Posted 2 years ago #

    Hello All,

    I patched connections.php for support multisite with a new feature to use main table as global.
    here the patch:

    /***************************************************************/
    /* goal: To run Connections on a multisite as single site mode,
    /* add to wp-config.php: define('CONCT_MULTISITE_GLOBAL', true);
    /*
    /***************************************************************/
    /* Changes between lines 225 to 240 */
    
    if ( ! defined('CONCT_MULTISITE_GLOBAL') ) define ('CONCT_MULTISITE_GLOBAL', false);
    if ( is_multisite() && CONCT_MULTISITE_GLOBAL ) $cnct_prefix = $wpdb->base_prefix; else $cnct_prefix = $wpdb->prefix;
    
    define('CN_ENTRY_TABLE', $cnct_prefix . 'connections');
    define('CN_ENTRY_ADDRESS_TABLE', $cnct_prefix . 'connections_address');
    define('CN_ENTRY_PHONE_TABLE', $cnct_prefix . 'connections_phone');
    define('CN_ENTRY_EMAIL_TABLE', $cnct_prefix . 'connections_email');
    define('CN_ENTRY_MESSENGER_TABLE', $cnct_prefix . 'connections_messenger');
    define('CN_ENTRY_SOCIAL_TABLE', $cnct_prefix . 'connections_social');
    define('CN_ENTRY_LINK_TABLE', $cnct_prefix . 'connections_link');
    define('CN_ENTRY_TABLE_META', $cnct_prefix . 'connections_meta');
    define('CN_TERMS_TABLE', $cnct_prefix . 'connections_terms');
    define('CN_TERM_TAXONOMY_TABLE', $cnct_prefix . 'connections_term_taxonomy');
    define('CN_TERM_RELATIONSHIP_TABLE', $cnct_prefix . 'connections_term_relationships');

    See discussion with simllar request for wppa (Wp Photo Album Plus) http://wordpress.org/support/topic/plugin-wp-photo-album-plus-multisite-support-switch-local-to-global-set-option-request?replies=10 and finally accepted as new option.

    Request: Can you integrate this feature in next release ?

    To see patch in action :
    - http://www.cieuxinternational.org/en/community/interreligious/
    - http://www.cieuxinternational.org/paris-11/en/local-commitee/

    http://wordpress.org/extend/plugins/connections/

  2. shazahm1
    Member
    Plugin Author

    Posted 2 years ago #

    @lancelot-du-lac

    I don't have a problem adding this ... actually this will work perfectly with some of the changes I made for the paths to better support multi-site in the next release. However, I do want to use a different global name so it fits better with *my* naming convention. I'm going to use CN_MULTISITE_ENABLED

  3. shazahm1
    Member
    Plugin Author

    Posted 2 years ago #

    I just added the following for the next release:

    /*
    * Goal: To run Connections on a multisite as single site mode.
    * Add to wp-config.php: define('CN_MULTISITE_ENABLED', TRUE);
    *
    * @credit lancelot-du-lac
    * @url http://wordpress.org/support/topic/plugin-connections-support-multisite-in-single-mode
    */
    if ( ! defined('CN_MULTISITE_ENABLED') ) define('CN_MULTISITE_ENABLED', FALSE);
    $prefix = ( is_multisite() && CN_MULTISITE_ENABLED ) ? $wpdb->base_prefix : $wpdb->prefix;
    
    define('CN_ENTRY_TABLE', $prefix . 'connections');
    define('CN_ENTRY_ADDRESS_TABLE', $prefix . 'connections_address');
    define('CN_ENTRY_PHONE_TABLE', $prefix . 'connections_phone');
    define('CN_ENTRY_EMAIL_TABLE', $prefix . 'connections_email');
    define('CN_ENTRY_MESSENGER_TABLE', $prefix . 'connections_messenger');
    define('CN_ENTRY_SOCIAL_TABLE', $prefix . 'connections_social');
    define('CN_ENTRY_LINK_TABLE', $prefix . 'connections_link');
    define('CN_ENTRY_DATE_TABLE', $prefix . 'connections_date');
    
    define('CN_ENTRY_TABLE_META', $prefix . 'connections_meta');
    define('CN_TERMS_TABLE', $prefix . 'connections_terms');
    define('CN_TERM_TAXONOMY_TABLE', $prefix . 'connections_term_taxonomy');
    define('CN_TERM_RELATIONSHIP_TABLE', $prefix . 'connections_term_relationships');
  4. shazahm1
    Member
    Plugin Author

    Posted 2 years ago #

    @lancelot-du-lac

    If you have a moment, can you contact me via the form on the following page? I like to have a discussion with you about the template you're using on those sites.

    http://connections-pro.com/help-desk/

  5. lancelot-du-lac
    Member
    Posted 2 years ago #

    Great - I apply these changes

    thx

  6. lancelot-du-lac
    Member
    Posted 2 years ago #

    Hi, I downloaded your last update connections.0.7.3...

    I did not yet watch all the new features. But it is promising.

    Thank you for the geocode, very useful.

    The key for me was to get my global configuration of the multisite.
    For this, the directories for customization 'connections_templates' and 'connection_images' must be shared, and therefore the boolean variable CN_MULTISITE_ENABLED must also act on the definition of these two directories.

    This gives something like this in connections.php :

    if ( ! defined('CN_MULTISITE_ENABLED') ) define('CN_MULTISITE_ENABLED', FALSE);
    			if( is_multisite() && !CN_MULTISITE_ENABLED )
    			{
    				define('CN_IMAGE_PATH', WP_CONTENT_DIR . '/blogs.dir/' . $blog_id . '/connection_images/');
    				define('CN_IMAGE_BASE_URL', network_site_url('/wp-content/blogs.dir/' . $blog_id . '/connection_images/'));
    				define('CN_CUSTOM_TEMPLATE_PATH', WP_CONTENT_DIR . '/blogs.dir/' . $blog_id . '/connections_templates');
    				define('CN_CUSTOM_TEMPLATE_URL', network_site_url('/wp-content/blogs.dir/' . $blog_id . '/connections_templates/'));
    			} else {
    				define('CN_IMAGE_PATH', WP_CONTENT_DIR . '/connection_images/');
    				define('CN_IMAGE_BASE_URL', content_url() . '/connection_images/');
    				define('CN_CUSTOM_TEMPLATE_PATH', WP_CONTENT_DIR . '/connections_templates');
    				define('CN_CUSTOM_TEMPLATE_URL', content_url() . '/connections_templates');
    			}
    
    			$prefix = ( is_multisite() && CN_MULTISITE_ENABLED ) ? $wpdb->base_prefix : $wpdb->prefix;

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Connections Business Directory
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.