Forum Replies Created

Viewing 15 replies - 121 through 135 (of 162 total)
  • Edit this file…
    /Applications/MAMP/htdocs/wordpress/wp-content/plugins/openid/Auth/OpenID/Server.php

    In newer versions of PHP, the support for & before the variables was removed.

    Thread Starter alieneila

    (@alieneila)

    I agree, and I usually do share. Ok, first you need to find a free zipcode database online, I can’t remember the one I used but you can search on Google. Then put it into your database in a table called wp_hc_zipcodes with at least the zip int(5), lat float(10,6), lng float(10,6) fields.

    Now the below probably could be optimized, but I just threw it together for functionality. I used it as a shortcode [locationsearch]

    add_shortcode('locationsearch','em_location_search');
    function em_location_search() {
    	global $wpdb;
    	$table_name = $wpdb->prefix . "hc_zipcodes";
    	$output = '<div class="loc-search-form">Search locations.<br /><form method="post" action="">';
    	$output .= '<label for="mbn_zipcode">Zip Code:</label> <input type="text" name="mbn_zipcode" id="mbn_zipcode" maxlength="5" size="7" /> ';
    	$output .= '<label for="mbn_distance">within </label><select name="mbn_distance" id="mbn_distance" tabindex="2">
    			<option value="5">5</option>
    			<option value="10">10</option>
    			<option value="25">25</option>
    			<option value="50">50</option>
    			<option value="100">100</option>
    			</select> miles ';
    	$output .= '<label for="state"><strong>OR</strong> by State:</label> <select name="state" id="state" tabindex="3"><option></option>';
    	$states = mysql_query('SELECT DISTINCT location_state FROM ' . $wpdb->prefix . 'em_locations');
    	while ($state = mysql_fetch_array($states)) {
    		$output .= '<option value="' . $state[0] . '">' . $state[0] . '</option>';
    	}
    	$output .= '</select>';
    	$output .= '<input type="submit" id="submit" name="submit" value="Search" /> ';
    
    	$output .= '</form></div>';
    	if ($_POST['submit'] && ($_POST['mbn_zipcode'] || $_POST['state'])) {
    		if ($_POST['state']) {
    			$stores = mbn_get_stores_by_state( $_POST['state'] );
    			$stores_total = count( $stores );
    			if( $stores_total > 0 ) {
    				$output .= '<div class="loc-search-result"><h3>Search Results</h3>';
    				$output .= '<ol>';
    				foreach( $stores as $store) {
    					$output .= '<li>
    					<a href="'.get_bloginfo('wpurl').'/locations/
    					' . $store[0] . '">
    					' . $store[1] . '</a> Distance (' . $store[6] . ' miles)<br />
    					' . $store[2] . ',
    					' . $store[3] . ',
    					' . $store[4] . ',
    					' . $store[5] . '
    					</li>';
    				}
    				$output .= '</ol></div>';
    			}
    			else {
    				$output .= '<p>No results within the area searched.</p>';
    			}
    		}
    		else {
    			if( !is_numeric( $_POST['mbn_zipcode'] ) ) {
    				$the_zip = '0';
    			}
    			else {
    				$the_zip = $_POST['mbn_zipcode'];
    			}
    			$the_distance = intval( $_POST['mbn_distance'] );
    
    			$stores = mbn_get_stores_by_location( $the_zip, $the_distance );
    			$stores_total = count( $stores );
    			if( $stores_total > 0 ) {
    				$output .= '<div class="loc-search-result"><h3>Search Results</h3>';
    				$output .= '<ol>';
    				foreach( $stores as $store) {
    					$output .= '<li>
    					<a href="'.get_bloginfo('wpurl').'/locations/
    					' . $store[0] . '">
    					' . $store[1] . '</a> Distance (' . $store[6] . ' miles)<br />
    					' . $store[2] . ',
    					' . $store[3] . ',
    					' . $store[4] . ',
    					' . $store[5] . '
    					</li>';
    				}
    				$output .= '</ol></div>';
    			}
    			else {
    				$output .= '<p>No results within the area searched.</p>';
    			}
    		}
    	}
    	return $output;
    }		
    
    function mbn_get_stores_by_state( $state ) {
      global $wpdb;
    	$sql = '
    	SELECT location_id, location_slug, location_name, location_address, location_town, location_state, location_postcode
    FROM ' . $wpdb->prefix . 'em_locations
    WHERE location_state = "' . $state . '"
    ORDER BY location_name
    ';
    
      $nearby_zips = mysql_query( $sql ) or die(mysql_error());
    
      // we need to store the zips in order to build the Pods query
      $target_zips = array();
      WHILE ($row = mysql_fetch_array($nearby_zips)) {
    		$target_zips[$row['location_id']][] = $row['location_slug'];
    		$target_zips[$row['location_id']][] = $row['location_name'];
    		$target_zips[$row['location_id']][] = $row['location_address'];
    		$target_zips[$row['location_id']][] = $row['location_town'];
    		$target_zips[$row['location_id']][] = $row['location_state'];
    		$target_zips[$row['location_id']][] = $row['location_postcode'];
    		$target_zips[$row['location_id']][] = round($row['distance'], 2);
      }
    
      return $target_zips;
    }
    
    function mbn_get_stores_by_location( $zip, $radius ) {
      global $wpdb;
      $radius = intval( $radius );
      // we first need to get the source coordinates
      $sql = mysql_query('SELECT <code>lat</code>, <code>lng</code> FROM ' . $wpdb->prefix . 'hc_zipcodes WHERE zipcode = "' . $zip . '" LIMIT 1');
      $coords = mysql_fetch_row( $sql );
      // now we'll get the other ZIP codes within the radius, ordered by distance
    	$sql = '
    	SELECT location_id, location_slug, location_name, location_address, location_town, location_state, location_postcode, ( 3959 * acos( cos( radians( ' . $coords[0] . ' ) ) * cos( radians( location_latitude ) ) * cos( radians( location_longitude ) - radians( ' . $coords[1] . ' ) ) + sin( radians( ' . $coords[0] . ' ) ) * sin( radians( location_latitude ) ) ) ) AS distance
    	FROM ' . $wpdb->prefix . 'em_locations
    	HAVING distance <= ' . $radius . '
    	OR distance IS NULL
    	ORDER BY distance
    	LIMIT 0 , 30;';
    
      $nearby_zips = mysql_query( $sql ) or die(mysql_error());
    
      // we need to store the zips in order to build the Pods query
      $target_zips = array();
      WHILE ($row = mysql_fetch_array($nearby_zips)) {
    		$target_zips[$row['location_id']][] = $row['location_slug'];
    		$target_zips[$row['location_id']][] = $row['location_name'];
    		$target_zips[$row['location_id']][] = $row['location_address'];
    		$target_zips[$row['location_id']][] = $row['location_town'];
    		$target_zips[$row['location_id']][] = $row['location_state'];
    		$target_zips[$row['location_id']][] = $row['location_postcode'];
    		$target_zips[$row['location_id']][] = round($row['distance'], 2);
      }
    
      return $target_zips;
    }
    Thread Starter alieneila

    (@alieneila)

    I didn’t think so, I ended up writing my own search that works with the em_locations table. Thank you for the reply. =)

    Thread Starter alieneila

    (@alieneila)

    Ahh yeah… I forgot I also added a custom_genesis_content_limit(), so I figured since this was an amplified version of the original widget that you might have done something similar. =P Ahh well, maybe it’ll help someone =)

    I am trying out the dev version now on my dev site. One thing so far when I just activated it, I get the following line 12 times at the top of the dashboard. They only showed up during activation. bbp is either buddypress or bbpress related no? I don’t get the errors during activating any other plugins.

    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ‘bbp_filter_sample_permalink’ was given in /wp-includes/plugin.php on line 170

    I think I might be having a similar problem. I’ve tried new pages, new slugs, etc…
    I can go to the events/categories page just fine and it lists my categories (I have about 15 categories and they all show up fine). The problem I am having is when I click on the category… for example “Musicals”, it takes me to /events/categories/musicals but instead of listing events that are assigned to that category, it shows me one of my media images as a post with a [Read More] link that links to the category I’m viewing…

    Latest version of WP
    Latest version of BuddyPress
    Latest version of this plugin
    Using Genesis framework

    It’s not really a bug with this plugin, it is just that this bug will only mess up themed Administrator Profiles when using the Genesis Framework. The layout settings only shows up on admin profiles and Genesis only loads the functions required for that when in the real Dashboard.

    You already mentioned the below, but for other people coming across this…

    If you don’t need your Administrators to have themed profiles, then if you go into Theme My Login settings for the Themed Profiles uncheck the Administrator having themed profiles. That’s the only work around I’ve found so far and will still allow for every other user rank to be themed.

    No, I tried it for a couple days but kept getting the error. I decided to use the WoW Armory API library that someone put on sourceforge and write a plugin to do a whole guild roster that links the members to a character sheet within the site. I appreciate the reply though =)

    Hmm… I updated the shortcode and cleared the cache, still getting the same error.

    I see that this plugin was updated a couple days ago, and on your site it seems to be working. I am unable to get it to work though as I receive the same error the original poster wrote about.

    Unable to fetch data from battle.net for character

    I’m using the shortcode…

    [armory-character name=”Alieneila” realm=”Darrowmere” region=”US” locale=”en_US”]

    Here is my solution to this that I’ve used, I found it to be easier than creating a lot of other code to handle a checkbox and new option and blah blah to handle it.

    In wp-cycle.php, 417 change the line

    if($data['image_links_to'])
    			echo '<a href="'.$data['image_links_to'].'">';

    to

    if($data['image_links_to']) {
    			$link = explode('|', $data['image_links_to']);
    			if ($link[1]) {
    				echo '<a href="'.$link[0].'" target="'.$link[1].'">';
    			}
    			else {
    				echo '<a href="'.$link[0].'">';
    			}
    		}

    And then in the URL field, use a pipe and put the target, such as..

    https://www.yourwebsite.com|_blank

    Plugin Author alieneila

    (@alieneila)

    Hmm… I may have missed something somewhere =P I’ll fix it.

    Plugin Author alieneila

    (@alieneila)

    Hmm… I will look in to it… I’ve replied back to your email =)

    My 2 cents…
    This isn’t a plugin for what you’re looking for, but you could build a plugin around this plugin, as it allows for uploading by members of certain authorization that you can set, and can create dynamic galleries… would take some work to get it to do exactly what you want, but it’s totally doable.

    https://smashly.net/photosmash-galleries/

    Check out this post, might help you out…

    https://blog.firetree.net/2008/11/30/wordpress-multi-widget/

Viewing 15 replies - 121 through 135 (of 162 total)