Results 1 to 8 of 8

Thread: Tie Location/Area fields to USER

  1. #1
    Thread Starter
    Veteran rodeoramsey's Avatar
    Join Date
    Jan 2010
    Location
    Ohio
    Posts
    277
    Thanks
    3
    Thanked 13 Times in 10 Posts

    Tie Location/Area fields to USER

    Not sure if there is a thread on this or if it can be done or not but here's what I'd like to see:

    Every ad post form has a spot for Location (state, zip code, address, phone, etc.). Instead of having to fill this out every time you post an ad, since membership IS REQUIRED, it would be nice to tie these fields to the USER instead of the AD. That way, they only have to submit the ad info, and the location is done. To further customize this option, you could have a checkbox to say something like "Use your default location" (which would be pre-checked), and when Un-Checked, the Location fields become editable.
    Last edited by pepsi; August 29th, 2010 at 07:32 PM.
    ~Ramsey

  2. #2
    Community Partner scarstens's Avatar
    Join Date
    Apr 2010
    Location
    Cave Creek, AZ USA
    Posts
    912
    Thanks
    2
    Thanked 129 Times in 86 Posts

    Re: Tie Location/Area fields to USER

    Thats pretty funny, you should visit ads on my site and notice where the address moved to?

    http://mytacksales.com/
    ~ Seth Carstens, Sethmatics Inc.


  3. #3
    Senior Member netpotion's Avatar
    Join Date
    Feb 2010
    Location
    United States
    Posts
    246
    Thanks
    30
    Thanked 13 Times in 10 Posts

    Re: Tie Location/Area fields to USER

    @scarstens: I like that. It makes much more sense and it looks nicer too.

    I really dig the way you added your login to the homepage. Very nice.

    ~NetPotion
    My Currently Live Sites
    ~ http://www.netpotion.com - Free Flash Gamez
    ~ http://www.picdepict.com - Free Image Hosting

  4. #4
    Community Partner scarstens's Avatar
    Join Date
    Apr 2010
    Location
    Cave Creek, AZ USA
    Posts
    912
    Thanks
    2
    Thanked 129 Times in 86 Posts

    Re: Tie Location/Area fields to USER

    I'm glad you like it, I've already had a request for me to put up the code in mod tutorial... someday I'll get to that one too. I'm sure when I wake up tomorrow we will have a reply here asking how exactly I moved the address around.
    ~ Seth Carstens, Sethmatics Inc.


  5. #5
    Thread Starter
    Veteran rodeoramsey's Avatar
    Join Date
    Jan 2010
    Location
    Ohio
    Posts
    277
    Thanks
    3
    Thanked 13 Times in 10 Posts

    Re: Tie Location/Area fields to USER

    Seth, I'm referring to actually moving the FORM fields from the Submit-Ad form to the Profile form. Then the user fills out that information once, on their Profile, and every ad they submit pulls the data from there for the location. So they don't have to repeatedly enter their address information, PLUS, the Googlemaps will pull the data from one central location. I registered on your site (hope that's okay!) and checked the Profile and didn't see fields for state or zip so figured this isn't exactly what's happening here.
    ~Ramsey

  6. #6
    Community Partner scarstens's Avatar
    Join Date
    Apr 2010
    Location
    Cave Creek, AZ USA
    Posts
    912
    Thanks
    2
    Thanked 129 Times in 86 Posts

    Re: Tie Location/Area fields to USER

    Yes! You are quite astute!

    Right now I have moved to "address" the the poster column for the item. My idea was not to complicate how the system works, especially how it grabs the google maps information.

    I do however like your idea, and already had it in my todo list, of storing the address and city/state/zip combo in the profile. Heres some thoughts and problems.

    1. Its already a "pretty serious task" just to add 1 entry to the author profile, see my mod on adding a phone number and you will know what I mean. If I had things my way we would re-use the "custom fields" code on the site and modify it to create a new section called "custom author fields". Allowing anyone to easily ad more content to be stored about the authors.

    2. The google maps entry is based on the "listing address" so we always want to make sure we are storing the address for each listing.

    3. My idea was to automatically fill in the address/city/state/zip for the user on the listings, but leave them so you are able to modify them. Thus eliminating the headache of entering your address every time, but maintaining the flexibility of per listing address and simplicity of google maps still working without any modification.

    When I get to that part of my project, I'll be sure to post a mod/tutorial guide a complete solution. For now I've just moved the address to its "proper place" in the item details page.
    ~ Seth Carstens, Sethmatics Inc.


  7. #7
    artfan1's Avatar
    Join Date
    Jun 2010
    Location
    United States
    Posts
    59
    Thanks
    4
    Thanked 3 Times in 1 Post

    How I changed Google Maps to reflect user's Profile information

    This is how I did it, quick and dirty.

    First, I followed Seth's tutorial on adding the new phone number field to the "Poster" tab and "Profile" sections.
    http://appthemes.com/forum/showthrea...g+phone+number (Great Tutorial!)

    I then added more fields to generate a new address entry for the usermeta table.
    I made some personal preference changes but for the most part, it's straight from his tutorial.

    For example on Seth's tutorial under step 1, I added;
    Code:
    update_usermeta($user_ID, 'business_name', $_POST['business_name']);
    update_usermeta($user_ID, 'profile_street', $_POST['profile_street']);
    update_usermeta($user_ID, 'profile_city', $_POST['profile_city']);
    update_usermeta($user_ID, 'profile_state', $_POST['profile_state']);
    update_usermeta($user_ID, 'profile_zip', $_POST['profile_zip']);
    update_usermeta($user_ID, 'phone', $_POST['phone']);
    Ok, so now on to my temporary method of telling the google map to ignore the posting meta for the address only, and look at the users profile address if they choose to fill it in.

    **This is on a 3.02 install. I am assuming that this can be done with child themes now but I have not upgraded to 3.03 just yet.

    First I made a backup copy of sidebar-gmap.php.

    Second I opened it in the Editor.

    Find this line…(around line 13)
    Code:
     $gmaps_loc_txt = get_option('cp_gmaps_loc_txt');
    I added some variables just below that line;
    Code:
    $author_street = get_the_author_meta('profile_street');
    $author_city = get_the_author_meta('profile_city');
    $author_state = get_the_author_meta('profile_state');
    $author_zip = get_the_author_meta('profile_zip');
    Then I found this line…(line 24 I think)
    Original Line;
    Code:
    $make_address = get_post_meta($post->ID, 'cp_street', true) . ' ' . get_post_meta($post->ID, 'cp_city', true) . ' ' . //get_post_meta($post->ID, 'cp_state', true) . ' ' . get_post_meta($post->ID, 'cp_zipcode', true);
    And I changed it to this…
    Code:
    $make_address = ($author_street) . ' ' . ($author_city) . ' ' . ($author_state) . ' ' . ($author_zip);
    That's all I did. Now each post's map will show the address for the user from information entered only once by the user in their "Edit Profile" section.

    Oh, I also removed the address fields from the posting forms. That way user won't see those as an option when posting an ad.
    At the moment however, I still have to add the country option to both mods. I will do that when I work on a child-theme function for this.

    Lastly, I'm a beginner Wordpress and ClassiPress user. Only had them for a few weeks so I have no doubt that there are better ways of doing what I did. So if any of you see a simpler way, please let me know. I've tested this and it all appears to be working fine. And this is across a WP 3.0 network install. All sub sites show the user's address on the map no matter which section they post in.

    Thanks,
    TroyD

  8. The Following 3 Users Say Thank You to artfan1 For This Useful Post:

    ajamm (March 9th, 2012), dyflin (November 22nd, 2010), msyahrizan (September 30th, 2011)

  9. #8
    artfan1's Avatar
    Join Date
    Jun 2010
    Location
    United States
    Posts
    59
    Thanks
    4
    Thanked 3 Times in 1 Post
    Just noticed that this is in the Feature Requests section. Maybe I should have posted this elsewhere and then linked from here. Sorry if I did it the wrong way. I guess this can be moved.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)