The MU forums have moved to WordPress.org

GoePress Site Wide Posts Map? (11 posts)

  1. OutdoorsBlogger
    Member
    Posted 17 years ago #

    I just tried GeoPress on MU, and it seems to be working great on a per blog basis. I'm interested in modifying the "geopress_map" function to show geocoded posts on the main site. I'm OK with displaying the markers & html on a custom Gmap, but I'm not sure how to query the separate tables for each blog. In that respect, I'm not even sure what to search for on the forums.

    Any direction, help, or ideas would be greatly appreciated!

  2. OutdoorsBlogger
    Member
    Posted 17 years ago #

    OK, so after a bit of research, I think there are three ways I can try to go:

    1.)Rewrite a map page discarding GeoPress's geopress_map function & query the DB on my own

    2.)Hack GP's geopress_map function to query all blogs' GP tables

    3.)Hack GeoPress to only insert records into one site wide table as opposed to one per blog

    I'm guessing that #3 may be the easiest for a PHP rookie like me, please somebody tell me if I'm crazy (I'm already talking to myself).

  3. OutdoorsBlogger
    Member
    Posted 17 years ago #

    So I've gone with #3 above, question is: how do I insert a post id into my new table? I've got the new SQL statment pluging all the info in, including GeoPress's stuff & the Blog ID. Here's the function in question:

    function update_geo ($id, $name,$loc,$coord,$geom,$warn,$mapurl,$visible = 1) {
    	global $table_prefix, $wpdb, $blog_id, $post, $id;
          $post2 = get_post($id, ARRAY_A);
          $wade = $post2['ID'];
    	if($name == "") { $visible = 0; }
    
    	$table_name = "geopress";
    	$sql = "SELECT * FROM ".$table_name." WHERE geopress_id = '".$id."' OR name = '".$name."' LIMIT 1";
    	$row = $wpdb->get_row( $sql );
    
    	//TODO SQL INJECTION POSSIBLE?
    	if ($row) {
    		$geo_id = $row->geopress_id;
    		$sql = "UPDATE ".$table_name." SET name = '$name', loc = '$loc', coord = '$coord', geom = '$geom', warn = '$warn', visible = '$visible', mapurl = '$mapurl', blog_id = '$blog_id', post_id = '$wade' WHERE geopress_id = '$geo_id'";
    		$wpdb->query( $sql );
    	} else {
    		$sql = "INSERT INTO ".$table_name." VALUES (NULL,'$name','$loc','$warn','$mapurl','$coord','$geom',NULL,NULL,NULL,NULL,NULL,'$visible', '$blog_id', '$wade')";
    		$wpdb->query( $sql );
    		$geo_id = mysql_insert_id();
    	}
    	return $geo_id;
      }

    echoing the post ID works fine:

    $post2 = get_post($id, ARRAY_A);
          $wade = $post2['ID'];
    	echo $wade;

    I'm guessing it's something pretty basic, if I do finally figure it out, I will of course share here.

  4. dbasulto
    Member
    Posted 17 years ago #

    Wow, nice work.

    Where do users "place" their blog on the map? their profiles?

  5. OutdoorsBlogger
    Member
    Posted 17 years ago #

    I think I got it!!!!!
    You can see the Site Wide Post Map here. In a week or two, once we done some testing, I'll post the hack. Hopefully, some smarter folks here can suggest some improvements for the reasons stated above.

  6. Bike
    Member
    Posted 17 years ago #

    That's pretty cool :)

    Would love to see that as a WPMU plugin or some hacking instructions. Actually when playing around with GEOpress it did not seem to work even for single blogs, so I removed it, but this endresult is great.

    Do the separate blogs also have their own map, just for their posts?

    Cheers, Bike

  7. dbasulto
    Member
    Posted 17 years ago #

    any updates on this?

  8. ajturner
    Member
    Posted 17 years ago #

    Thanks for the suggestions & edits. I'll see about incorporating these edits into GeoPress.

  9. wpmupremium
    Member
    Posted 15 years ago #

  10. Farms
    Member
    Posted 15 years ago #

    Nice, adding to a couple of older high search profile threads with a link to a single premium theme costing $99... even I haven't quite got round to doing that yet!

    Although I s'pose what with the GFC etc. one should never rule out ones options ;)

  11. wpmupremium
    Member
    Posted 15 years ago #

    I'd blame it on Warren Buffett if I thought I'd get away with it...

    To be honest, we'd much rather people spend the time like we did to learn how to integrate Google Maps into their own work from the source, and geoRSS is the first starting block.

    For those that want to skip ahead, they'll need to get the theme, but that's not our request, that's our client, who commissioned us to develop the theme in the first place...

About this Topic

  • Started 17 years ago by OutdoorsBlogger
  • Latest reply from wpmupremium