Support » Plugin: Events Manager » Sync Two Event Manager Plugins on Different wordpress Sites

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Support caimin_nwl



    Are these sites on a multisite version of WordPress, or two completely separate installs of WordPress?

    Plugin Author Marcus


    NetWebLogic Support

    Unfortunately at the moment this isn’t possible (at least not without custom coding).

    Hi Marcus,

    i’m interested in the same thing.
    Would it work with this approach ?

    … same server, same db, but a different WP instance with another table prefix in my case.

    If so , do I create a page template for the event list page on the Wp instance without event data to put the query code in? …

    regards Micky


    Two Site are seprate WP install on diffrent Server.

    Marcus, I can go ahead with custom coding as well. I think, if there is something i can code, to sync Event Table[DB] of WP 2 with WP 1, May be on Daily Basis [ once in a day ]. I just want to display same calendar on two sites without Worrying about updating on Both of them. ..

    Plugin Support caimin_nwl


    That seems like quite a complicated approach. Have you thought about just using a feed, or content loaded by iframe or server include?

    Plugin Author Marcus


    NetWebLogic Support

    Guys, there might be a solution for you, but I haven’t tested this yet. My friends at hypecal made a cool plugin that allows you to create an ESS feed ( and also allows you to import external ESS feeds.

    The end result will be that you can completely sync different sites together (apparantly, automatically too). It’ll be out as a seperate plugin soon, and maybe eventually become part of the core plugin.

    Check it out and let me know how it goes for you! –

    Thanks for the answers so far. I tried a couple of things like including the according pages from the WP instance which holds the events into the second WP instance.
    This works but comes with some disadvantages. For instance when you click a link of an event in the included page/site you are taken back to the site where it came from – quite logic. Same thing for feeds. To be coherent with the site layout of the “including” site it would be necessary to build all the possible pages for the “including” site within the “parent” site ….

    Unfortunately I can’t go back to turning the whole thing multisite, which would be probably the best solution. … Basic sql works too for sure but one loses all the advantages of the plugin. 🙁

    My question to Marcus is : is there any means to force the plugin to use another instance of $wpdb ? … ( actually only another $prefix in my case) … This would be the perfect solution . All my effort in that direction didn’t work so far. Couldn’t make event-manager using the new $wpdb instance.

    “custom coding ” would be necessary you said : any hint if there is a central file or code point where to pass the new $wpdb instance to the plugIn.


    You could create a custom plugin on the ‘original’ site that effectively provides an API system that the ‘copying’ site can use.

    On the copying site you can then hook into 404 actions to trigger a call to your new API.

    This is quite extensive custom coding though, so you’ll need a developer if you’re not able to code.


    hi philipjohn, thanks for the reply … unfortunately it was not what I was looking for. Coding experience is not the issue here – building sites since 15 years. I’am referring to the structure of the plugin, which I’m using the first time. … and I’m working with WP since 1 year only.

    I looked into em-object.php. it says : “Base class which others extend on. Contains functions shared across all EM objects.” … and it contains a couple of basic functions of the class using the $wpdb object. Naturally I saw that a lot of files of the plugin are using $wpdb …

    From my experience with OOP I can tell that simply to overwrite a class variable or to define a class variable would do the trick if all sql requests of the class were defined in a base class file. In this case it would be the values of the $wpdb objects array… respectively the replacement of the default $wpdb object of the WP instance by another instance of it.

    That’s why I’m asking for the code point or central file to modify, or even more precise if with the given structure of the plugin and it’s integration into WP this kind of a modification would be possible.

    best regards

    Plugin Author Marcus


    NetWebLogic Support

    Micky, $wpdb is pretty central to WP, so the only thing I can think here that might work is you search_replace all $wpdb mentions, replace it with something like $wpdb_alt and make a global variable with a new connection. Pretty hacky though.

    if you have the same server and database, you could just edit the constants in events-manager.php :

    define('EM_CATEGORIES_TABLE', $prefix.'em_categories'); //TABLE NAME
    	define('EM_EVENTS_TABLE',$prefix.'em_events'); //TABLE NAME
    	define('EM_TICKETS_TABLE', $prefix.'em_tickets'); //TABLE NAME
    	define('EM_TICKETS_BOOKINGS_TABLE', $prefix.'em_tickets_bookings'); //TABLE NAME
    	define('EM_META_TABLE',$prefix.'em_meta'); //TABLE NAME
    	define('EM_RECURRENCE_TABLE',$prefix.'dbem_recurrence'); //TABLE NAME
    	define('EM_LOCATIONS_TABLE',$prefix.'em_locations'); //TABLE NAME
    	define('EM_BOOKINGS_TABLE',$prefix.'em_bookings'); //TABLE NAME

    if that works, could certainly consider checking if the constant exists before setting it, so you could add them to wp-config.php

    however, in this case you’d run into problems because wp_posts and similar wp tables are used.

    Hi Marcus,
    Thanx for the reply … sorry for getting back just now. I had to postpone the problem.

    I followed your suggestion and hardcoded the table names prefix in events-manager.php of the eventless EM instance. I used a standard page template to display the synced events-list of the other WP instance sharing the same db. The page uses a modified events-list.php in my child theme:

     global $wpdb;
     $wpdb->set_prefix('otherprefix_'); ?>
    $args = apply_filters('em_content_events_args', array('scope'=>'all', 'limit'=>10, 'category'=>7));
    if( get_option('dbem_css_evlist') ) echo "<div class='css-events-list'>";
    echo EM_Events::output( $args );
    if( get_option('dbem_css_evlist') ) echo "</div>"; ?>
    <?php $wpdb->set_prefix('originalprefix_');

    The neat thing here is that the data comes from the other EM instance but the format setting comes from the one without events. Same for single events further down.

    Annyway you were right : there is a logic problem to display a single event by clicking on a default eventlink in the list: it throws a 404 error ….

    getting a single event from the “otherprefix” table directly by shortcode : [event post_id=’163′][/event] by using a template with set_prefix(‘otherprefix_’) is working though.

    So I created the page “event” for single events, which uses a template like this and redid the eventlink in the list format of my eventless EM instance. It points to the “event” page and adds the events post-id as a variable:


    The new var has to be registered in the themes function.php :

    /** add var info for single event from other domain */
    function add_query_vars($aVars) {
    $aVars[] = "info"; // represents the name of the var
    return $aVars;
    // hook add_query_vars function into query_vars
    add_filter('query_vars', 'add_query_vars');

    The custom template used by the “event” page is basically this:

    <?php get_header(); ?>
    	global $wp_query;
    	if(isset($wp_query->query_vars['info'])) {
    		$the_id = $wp_query->query_vars['info'];
    	global $wpdb;
    	global $post;
    	$EM_Event = em_get_event($the_id, 'post_id');
    <div id="content-full" class="grid col-940">
     <div class="post-entry">
     <?php echo $EM_Event->output( get_option('dbem_single_event_format') ); ?>
     </div><!-- end of .post-entry -->
    </div><!-- end of #content-full -->
    <?php $wpdb->set_prefix('originalprefix_); ?>
    <?php get_footer(); ?>

    … works like a charm.

    @ Webmaster_crawl : the one way sync works ! For you it would be actually the content of the function linked to my first post instead of only : $wpdb->set_prefix(‘otherprefix_’);

    Marcus, I could not find out though how I would reestablish the pretty permalink stuff or just hide the variable bit of the url by adding a rewrite rule. Any hint on that would be very appreciated.

    Getting the event_slug shouldn’t be a problem, but when and how to rewrite the link in any case ? I don’t even know if it could be possibly done.

    Thanx so far


    @lacabriole, @marcus Thanks a lot for all these techy stuff. I’ll try implementing this and get back.
    Also, as the new plugin (ESS) is out, i would like to install that as well, test and get back.
    For sure this is going very good.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Sync Two Event Manager Plugins on Different wordpress Sites’ is closed to new replies.