Forum Replies Created

Viewing 9 replies - 46 through 54 (of 54 total)
  • Thread Starter Philip Isaacs

    (@pisaacs)

    Thanks for the feedback. I wasn’t sure because the counts we have been seing on our site fro 24 hours seem so close to the weekly count. (We use the plugin in two places on our site. One to show the most popular for the last 24 hours and in another area to see the most popular for the week).

    Can your tell me when the 24hrs period begins and ends?

    Sorry if this seems like a dumb questions, but I want to track it on my own today.

    Thanks again,

    Philip

    I’m interested in this as well. As anyone come up with a solution.

    Thread Starter Philip Isaacs

    (@pisaacs)

    Okay I actually found a number of plug ins that more or less do this for me, but now I’ve run into one issue.

    Currently I’m using Contextual Related Posts Version 1.8.5 | By Ajay D’Souza

    The related posts plug in works great on post pages but does not show up at all on the Category pages.

    Anyhow have any ideas for me?

    How are Category pages different then post pages in this regard.

    Philip

    I did it a little more backwards. I went into the functions.php file of my theme and added the additional address information fields that way.

    Here’s the code

    /////////////////////////////////////////////////////
    // Custom Field for adding user information
    /////////////////////////////////////////////////////
    add_action( 'show_user_profile', 'extra_user_profile_fields' );
    add_action( 'edit_user_profile', 'extra_user_profile_fields' );
    
    function extra_user_profile_fields( $user ) { ?>
    <h3><?php _e("Extra profile information", "blank"); ?></h3>
    
    <table class="form-table">
    <tr>
    <th><label for="address"><?php _e("Address"); ?></label></th>
    <td>
    <input type="text" name="address" id="address" value="<?php echo esc_attr( get_the_author_meta( 'address', $user->ID ) ); ?>" class="regular-text" /><br />
    <span class="description"><?php _e("Please enter your address."); ?></span>
    </td>
    </tr>
    
    <tr>
    <th><label for="city"><?php _e("City"); ?></label></th>
    <td>
    <input type="text" name="city" id="city" value="<?php echo esc_attr( get_the_author_meta( 'city', $user->ID ) ); ?>" class="regular-text" /><br />
    <span class="description"><?php _e("Please enter your city."); ?></span>
    </td>
    </tr>
    
    <tr>
    <th><label for="state"><?php _e("State"); ?></label></th>
    <td>
    <input type="text" name="state" id="province" value="<?php echo esc_attr( get_the_author_meta( 'state', $user->ID ) ); ?>" class="regular-text" /><br />
    <span class="description"><?php _e("Please enter your state."); ?></span>
    </td>
    </tr>
    
    <tr>
    <th><label for="postalcode"><?php _e("Postal Code"); ?></label></th>
    <td>
    <input type="text" name="postalcode" id="postalcode" value="<?php echo esc_attr( get_the_author_meta( 'postalcode', $user->ID ) ); ?>" class="regular-text" /><br />
    <span class="description"><?php _e("Please enter your postal code."); ?></span>
    </td>
    </tr>
    </table>
    <?php }
    
    add_action( 'personal_options_update', 'save_extra_user_profile_fields' );
    add_action( 'edit_user_profile_update', 'save_extra_user_profile_fields' );
    
    function save_extra_user_profile_fields( $user_id ) {
    
    if ( !current_user_can( 'edit_user', $user_id ) ) { return false; }
    
    update_user_meta( $user_id, 'address', $_POST['address'] );
    update_user_meta( $user_id, 'city', $_POST['city'] );
    update_user_meta( $user_id, 'state', $_POST['state'] );
    update_user_meta( $user_id, 'postalcode', $_POST['postalcode'] );
    
    }

    Then I’m using a custom page type to write in my own PHP and Javascript code. to pull it back out.

    Like I saids it’s just a basic proof of concept at this point, but I’m pretty sure it will work for my needs.

    Philip

    I’ve got a prototype working that does what I want now. But haven’t had any time to work on it since last week. Basically it pulls the addresses out of the wordpress database and runs them through Google’s Geolocation API to get the Longitude and Latitude coordinates as an XML feed. Once I have that, i loop through the XML and plot the contributors names and locations on the map.

    It’s working fine as a proof of concept but I need to finasse it some more.

    My idea is to build a custom template page as a sort of one off. I started around by just creating a new template page in my custom template and then replacing the code which I got from this page . But this only gets me started. I still don’t know how to get the custom meta data that I created for the location infromation yet fromt he database of even how to to use Google’s GeoLocation Service to convert that to Long and Latitude information. I’ve done something like this in the past, but it’s been a few years, so I’m sort of starting from scratch. As far as the map goes, I’m think of just using straight JavaScript.

    Floyd

    Hey bfranker,

    Yeah I’ve already got the extra address fields set up to allow me to gather ther users address. Next step for me is create a custom page to pull the data out and pass it to the Google Maps API.

    The way I see this working is.

    1) Use the WP framework to query the DB and pull out the Contributors I want to highlight on the map.
    2) Formate the results and pass them to the Google Maps API
    3) Print the Google map on my page.

    Sounds easy enough.

    Right?

    Floyd

    Since yesterday I’ve been looking around for a way to do this, but so far have found nothing. At this point I’m now looking into how to build it myself, but since I’m still new to WordPress I’m not exactly familiar with the architecture of the system. My gut tells me I need to develop a custom template page and program it with calls to mt database which then format the results as JavaScript and pass them to a custom Google Map on the page. But this is just one approach, if people have other suggestions on how to approach this problem, I’d loe to hear them.

    Floyd

    I’m looking for something that does that exact same thing. Has anyone come up with a solution like this?

    Floyd

Viewing 9 replies - 46 through 54 (of 54 total)