Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to use the same BP DB-Tables for two Buddypress installations?!

  • Avatar of Philipp
    Philipp
    Participant

    @philippmuenchen

    Hi @ all!
    I’m going to get very frustrated soon, thats why I’m searching for some help here! :)

    I do have a Buddypress installation on WP Multisite basis. This a community for young Germans, who do a social year abroad. Now we’re going to plan a new “Alumni-Community” for our former volunteers. For that we want to use another WP-Single installation – of cause – with Buddypress. What we want is that the useres are able to login into both sites with just one username and password. So I found this solution:

    define(‘CUSTOM_USER_TABLE’, ‘wp_users’);
    define(‘CUSTOM_USER_META_TABLE’, ‘wp_usermeta’);

    I put this into the wp-config.php of the new installation and it works perfectly. Now I’m able to login into both sites, because it shares the user tables of WordPress. But we have to go further: It should also use the same XPROFILE table, because the user registers for his social service e.g. with “In which country: Albania; How long: 12 Months; …” – and the Alumni-Community should use the same information from the same table. E.g. “Was in: Albania; For: 12 Moths;” …

    So is there a way to tell Buddypress to use a table with another prefix in the same database?! Something like:

    define(‘CUSTOM_BP_XPROFILE_DATA_TABLE’, ‘wp_bp_xprofile_data’);

    If this is possible, the two communities could be synchron in users, user xprofile data, messages,… Right?!

    I really, really hope that someone is able to help me. I’m going to get crazy with that! ;)

    Best and thanks!

    Philipp

Viewing 4 replies - 1 through 4 (of 4 total)
  • Avatar of Philipp
    Philipp
    Participant

    @philippmuenchen

    I would like to add the following:

    function table_prefix_switch() {
    global $wpdb;
    $options = $wpdb->options; //Save the site 2 options table
    $wpdb->set_prefix(‘wp_’); //The prefix to site 1
    $wpdb->options = $options; //Put the options table back
    }

    add_action(‘init’, ‘table_prefix_switch’);

    Maybe this could help me to hack it a little bit?!

    UPDATE: It’s just using the tables of WordPress – Not of Buddypress! Why?! :(

    I’m not sure it’s possible. It’d be more than just, for example, the main activity table. You’d have to pick up the meta tables, too, and figure out how to deal with conflicts when one site tries to update meta (or any other setting) from another site.

    Avatar of Philipp
    Philipp
    Participant

    @philippmuenchen

    Hi Paul!
    Thanks, but the code isn’t working. If I use the code above as a plugin I’m able to use all WP Tables from both installations. So e.g. I have access from both pages on the same articles,…
    But with the BP tables nothing happens. Maybe there is another way I could go to reach my goal. Some ideas?! :)

    Avatar of Philipp
    Philipp
    Participant

    @philippmuenchen

    Some more ideas?!

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.