Mammoth CA Home Search
/*
Plugin Name: Home Search Page
Plugin URI: http://www.realivent.com
Description: Add an IDX Framed solution to your blog.
Version: 1.0
License: GPL
Author: Realivent Corporation
Author URI: http://www.realivent.com
Contributors: Matt Dunlap
==============================================================================
*/
function hs_admin_menu() {
if (function_exists('add_options_page')) {
add_options_page('hs Options Page', 'Home Search', 8, basename(__FILE__), 'hs_subpanel');
}
}
function hs_subpanel()
{
$blogname = $_SERVER['HTTP_HOST'];
$blogname = str_replace(".","_",$blogname);
$current_user = wp_get_current_user();
$user_id = $current_user->ID;
$email = get_usermeta($user_id,’pwemail_’.$blogname);
if(!get_post(get_option(’Home_Search_Page_ID’)))
{
//The page has been deleted so let’s remove all the details
delete_option(’Home_Search_Page_ID’);
delete_option(’Home_Search_title’);
delete_option(’idx_link’);
delete_option(’idx_link_width’);
delete_option(’idx_link_height’);
delete_option(’idx_link_scrolling’);
delete_option(’idx_link_border’);
}
if(isset($_POST['submit']))
{
//update_usermeta($user_id,”pwemail_”.$blogname,$_POST['email']);
$_POST['post_type'] = ‘page’;
$_POST['post_content'] = ‘‘;
$_POST['post_author'] = $user_id;
$_POST['post_status'] = ‘publish’;;
$_POST['post_title'] = $_POST['hs_title'];
if(get_option(’Home_Search_Page_ID’))
$_POST['ID'] = get_option(’Home_Search_Page_ID’);
$post_ID = wp_update_post($_POST);
update_meta(get_option(’Home_Search_Page_ID’), ‘_wp_page_template’, $_POST['page_template']);
update_option(’Home_Search_Page_ID’, $post_ID);
update_option(’Home_Search_title’, $_POST['hs_title']);
update_option(’idx_link’, $_POST['hs']);
update_option(’idx_width_type’, $_POST['width_type']);
update_option(’idx_link_width’, $_POST['width']);
update_option(’idx_link_height’, $_POST['height']);
update_option(’idx_link_scrolling’, $_POST['scrolling']);
update_option(’idx_link_border’, $_POST['idx_border']);
echo ““;
die;
}
?>
Powered by WordPress