Eliminate age brackets on browse

Need A Custom Modification To Your Webdate Script. Ask For Help Here.

Eliminate age brackets on browse

Postby mutton on Thu May 01, 2008 7:36 am

This is a real nuisance! Using the ages means that someone doing a browse has to go back to step one over and over again to see who is in their state. And age doesn't mean much to my users. I want to either eliminate the age or add an option for "All ages".

In browse_gender_age.php I changed the table of ages to

$ages["All ages"] = "age_from=18&age_to=180";

but it seems to have no effect.
mutton
 
Posts: 100
Joined: Mon Feb 11, 2008 11:47 pm

Re: Eliminate age brackets on browse

Postby paul on Thu May 01, 2008 10:07 pm

open browse.php

near line 350 find

Code: Select all
$ages = array();
      $ages["Age 18 to 25"] = "age_from=18&age_to=25";
      $ages["Age 26 to 30"] = "age_from=26&age_to=30";
      $ages["Age 31 to 35"] = "age_from=31&age_to=35";
      $ages["Age 36 to 40"] = "age_from=36&age_to=40";
      $ages["Age 41 to 45"] = "age_from=41&age_to=45";
      $ages["Age 46 to 50"] = "age_from=46&age_to=50";
      $ages["Over 50"] = "age_from=50&age_to=199";


add this line into the function after array() $ages["Browse All Ages"] = "age_from=18&age_to=199";

Code: Select all
$ages = array();
      $ages["Browse All Ages"] = "age_from=18&age_to=199";
      $ages["Age 18 to 25"] = "age_from=18&age_to=25";
      $ages["Age 26 to 30"] = "age_from=26&age_to=30";
      $ages["Age 31 to 35"] = "age_from=31&age_to=35";
      $ages["Age 36 to 40"] = "age_from=36&age_to=40";
      $ages["Age 41 to 45"] = "age_from=41&age_to=45";
      $ages["Age 46 to 50"] = "age_from=46&age_to=50";
      $ages["Over 50"] = "age_from=50&age_to=199";


you had the right idea but you need to modify this for browse.php and browse_gender_age.php

while I was looking at it I noticed that you had to select each town within a state.. this is another headache so I wrote some code to choose Browse All Cities...

Near line 175 find these lines

Code: Select all
$cities_list = "<table border=0 cellspacing=2 cellpadding=2 width=99% align=center>";
   
            $i = 0;
            $was_tr = 0;


add this line after so it will now look like this

Code: Select all
$cities_list = "<table border=0 cellspacing=2 cellpadding=2 width=99% align=center>";
   
            $i = 0;
            $was_tr = 0;
   $cities_list .= '<td align=center width=33%><a href="index.php?page=browse&browse_page=browse_profiles&gender='.$gender.'&'.$ages_link.'&country='.$country.'&state='.$state.'">Browse All Cities</a></td>';


near line 219 find:

Code: Select all
if($state == "") $state_sql = "";
      else $state_sql = " AND profile.state='$state' ";


add these lines before it so it will look like this

Code: Select all
if($city=="")$city_sql="";
      else $city_sql="AND profile.city='$city'";
      if($state == "") $state_sql = "";
      else $state_sql = " AND profile.state='$state' ";


the next line is the sql and you need to change it to this

Code: Select all
$sql = "
            SELECT *, country.name as country, profile.id as id, profile.name as name, mb.age as age
            FROM dt_profile profile, dt_countries as country, dt_members as mb
            WHERE profile.country='$country' AND profile.gender='$gender' AND mb.age>='$age_from' AND mb.age<='$age_to' AND mb.id=profile.member_id
                     $state_sql $city_sql AND country.id=profile.country AND profile.status='1'
            GROUP BY profile.id ORDER BY profile.name
      ";


now you should be up and running with the all ages and any city browse..

let me know how it goes for you

Paul
User avatar
paul
Site Admin
 
Posts: 264
Joined: Sat Jan 26, 2008 7:30 pm
Location: Newington,Ct,USA

Re: Eliminate age brackets on browse

Postby mutton on Fri May 02, 2008 3:55 pm

Works great!
mutton
 
Posts: 100
Joined: Mon Feb 11, 2008 11:47 pm


Return to Need A Modification To Your Webdate Script?

Who is online

Users browsing this forum: No registered users and 3 guests

cron