Store Locator Plus for WordPress
Mashup after polling user meta in Multisite Network (5 posts)

  1. kirkward
    Posted 3 years ago #

    I have a mutlisite network. Admin profiles contain user meta with city names, street addresses, and post codes. I can retrieve the location information on each individual site by using the following code:

    $user_id_from_email = get_user_id_from_string( get_blog_option($thisblog, 'admin_email'));
    $current_site_admin = get_userdata($user_id_from_email);
    <div style="font-weight: bold; font-size: 18px; line-height: 125%;">
    <font color="blue"><?php echo (get_user_meta($current_site_admin, 'practicename', true)); ?></font><br />
    <?php echo (get_user_meta($current_site_admin, 'officestreet', true)); ?><br />
    <?php echo (get_user_meta($current_site_admin, 'officecity', true));?>, <?php echo (get_user_meta($current_site_admin, 'officestateprovince', true)); ?> <?php echo (get_user_meta($current_site_admin, 'officepostcode', true)); ?><br />
    <?php echo (get_user_meta($current_site_admin, 'officephone', true)); ?><br /><br />

    How can I retrieve that data from each site in the network of blogs and save it so SLP can show all locations on the main site?


  2. Store Locator Plus
    Plugin Author

    Posted 3 years ago #

    You will need to write a multi-site processing loop then store the data into the SLP table. There is a lot of documentation on the http://www.charlestonsw.com site about extending data, the hooks and filters, and plenty of code in the add-on packs that manipulate the data store.

    You'll need to write your own code to hook into the save locations process, but other than that it is a fairly simple "flat" data table format.

  3. kirkward
    Posted 3 years ago #

    Well piddle.

    That's going to be over my head.

  4. kirkward
    Posted 3 years ago #

    Then again, maybe not. I think I've made progress.

    Does it mess with anything else if I merely insert/create a new row in the wp_store_locator table and update the following fields ?

    Fields to update:
    sl_private - Null
    sl_neat_title - Null
    sl_pages_url - Null
    sl_pages_on - Null
    sl_lastupdated - Time
    sl_option_value - Null

    Then, geocode from the dashboard?

  5. kirkward
    Posted 3 years ago #

    I was able to cobble this together from searches done on the web. I confirmed that I was retrieving the correct data by using a php echo statement to list the data on the page before attempting the section that inserts it into the table. I added the table stuff, but the data is not being entered into the table.

    What do I need to change in order to get it to save the map info?


    $bcount = get_blog_count();
    global $wpdb;
    $blogs = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->blogs WHERE spam = '0' AND deleted = '0' and archived = '0' and public='1'"));
        ?><ul class="menu"><?php
        foreach($blogs as $blog){
            $details = get_blog_details($blog->blog_id);
            if($details != false){
                $addr = $details->siteurl;
                $name = $details->blogname;
                $blognum = $details->blog_id;
                if(!(($blog->blog_id == 1)&&($show_main != 1))){
                    <li class="menu-item<?php if($counter == get_current_blog_id()){ echo ' current-menu-item';}?>">
                        Blog ID = <?php echo $blognum; ?><br />
                        Blog URL = <?php echo $addr; ?><br />
                        Blog Name = <?php echo $name;?><br />
    $user_id_from_email = get_user_id_from_string( get_blog_option($blognum, 'admin_email'));
    $current_site_admin = get_userdata($user_id_from_email);
    $kw_fname = (get_user_meta($current_site_admin, 'first_name', true));
    $kw_lname = (get_user_meta($current_site_admin, 'last_name', true));
    $kw_admin_email = get_bloginfo ( 'admin_email' );
    $kw_practice_name = (get_user_meta($current_site_admin, 'practicename', true));
    $kw_office_phone = (get_user_meta($current_site_admin, 'officephone', true));
    $kw_office_city = (get_user_meta($current_site_admin, 'officecity', true));
    $kw_office_street = (get_user_meta($current_site_admin, 'officestreet', true));
    $kw_office_state = (get_user_meta($current_site_admin, 'officestateprovince', true));
    $kw_office_zip = (get_user_meta($current_site_admin, 'officepostcode', true));
    $data = array(
        'sl_id' => $blognum,
        'sl_store' => $kw_practice_name,
        'sl_address' => $kw_office_street,
        'sl_city' => $kw_office_city,
        'sl_state' => $kw_office_state,
        'sl_zip' => $kw_office_zip,
        'sl_country' => ,
        'sl_url' => $addr,
        'sl_image' => ,
        'sl_private' => NULL,
        'sl_neat_title' => NULL,
        'sl_pages_url' => NULL,
        'sl_pages_on' => NULL,
        'sl_lastupdated' => current_time('mysql', 1),
        'sl_option_value => NULL
    $wpdb->insert(wp_store_locator, $data);

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Store Locator Plus for WordPress
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.