Support » Plugins and Hacks » Search function driving me crazy

Search function driving me crazy

  • esmarts


    Ok This may be a looser question but it is driving me crazy. I have just updated my plugin wp-direct to work with WP 2.6.
    The search function seemed to work for me (well I thought I checked it)

    Here is what the search function is reportedly doing.

    When the search function is used for the plugin it only returns as like a page refresh. )No Search results just page refresh. So I am went looking deeper for changes made from the Old WP to now and have not found a change in code on how to call a wp_query for searching.

    So my question is…
    Can someone look at this code and tell me why it would just return like a page refresh.

    function format_base() {
    		$base = $_SERVER['REQUEST_URI'];
    		$base = preg_replace("/&wp_dir=(.*)&?/","",$base);
    		$base = preg_replace("/&cat_id=(.*)&?/","",$base);
    		$base = preg_replace("/&sub_cat_id=(.*)&?/","",$base);
    		$base = preg_replace("/wpdir-(.*)\/?/","",$base);
    		$base = rtrim($base, "/");
    		$base = $base."/";
    		return $base;
    	function get_search_results() {
    		$search = $_REQUEST['search_term'];
    		$sql = "SELECT * FROM ".$this->db_pre."sites WHERE deleted = '0' AND enabled = '1' AND title LIKE '%$search%' OR description LIKE '%$search%'";
    		$res = wp_query($sql);
    		return $res;
    	function show_search_front() {
    		$m = "";
    		$base = $this->format_base();
    		$search_term = $_REQUEST['search_term'];
    		$search_term = $this->format_for_url($base);
    		$m .= "<div align='right'><form method=\"post\" action=\"$base/wpdir-search/\" name=\"easy_search\">     
            	Directory Search <input type=\"text\" name=\"search_term\" value=\"{$_REQUEST['search_term']}\" size=\"30\" />
                &nbsp;&nbsp;&nbsp;<input type=\"submit\" name=\"search\" value=\"Search\" />
    		return $m;
    	function format_for_url($string){
    		$string = strtolower($string);
    		$string = str_replace(" ", "-", $string);
    		return $string;
  • The topic ‘Search function driving me crazy’ is closed to new replies.