Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'country state city'

Viewing 5 results - 26 through 30 (of 30 total)
  • Author
    Search Results
  • #75896
    shaisimchi
    Participant

    i now have this which is your code:

    function my_login_redirect($redirect_to,$redirect_to2,$user) {

    global $bp;

    $city = xprofile_get_field_data(26, $user->ID );
    $state = xprofile_get_field_data(27, $user->ID );
    $country = xprofile_get_field_data(103, $user->ID );
    $zip = xprofile_get_field_data(23, $user->ID );

    if( !empty($city) && !empty($state) && !empty($country) && !empty($zip) )

    return ‘http://athleticrash.com’;

    else

    return bp_core_get_user_domain($user->ID) . ‘profile/edit/’;

    }

    add_filter(‘login_redirect’,’my_login_redirect’,100,3);

    goes to the home page…

    #75892
    shaisimchi
    Participant

    I mean what is passed as the $user parameter.
    it seems that the 2 redirect parameters are not in use and the $user – i am not sure how it is passed here.
    I have tried to do something similar (dont worry about the mess now – I just want the redirect to work):
    function my_login_redirect($redirect_to,$redirect_to2,$user_id) {

    global $wpdb,$bp;
    $user_id = $bp->loggedin_user->id;
    $city = $wpdb->get_var($wpdb->prepare(“SELECT value FROM wp_bp_xprofile_data WHERE user_id=%d AND field_id=26” , $user_id ));
    $state = $wpdb->get_var($wpdb->prepare(“SELECT value FROM wp_bp_xprofile_data WHERE user_id=%d AND field_id=27” , $user_id ));
    $country = $wpdb->get_var($wpdb->prepare(“SELECT value FROM wp_bp_xprofile_data WHERE user_id=%d AND field_id=103” , $user_id ));
    $zip = $wpdb->get_var($wpdb->prepare(“SELECT value FROM wp_bp_xprofile_data WHERE user_id=%d AND field_id=23” , $user_id ));
    if (!$city || $city==”)
    $has_city=0;
    else
    $has_city=1;
    if (!$state || $state==”)
    $has_state=0;
    else
    $has_state=1;
    if (!$country || $country==”)
    $has_country=0;
    else
    $has_country=1;
    if (!$zip || $zip==”)
    $has_zip=0;
    else
    $has_zip=1;
    if ($has_city==1 && $has_state==1 && $has_country==1 && $has_zip==1 )
    return ‘http://athleticrash.com’;
    else
    return bp_core_get_user_domain($user_id) . ‘profile/edit/’;
    }
    add_filter(‘login_redirect’,’my_login_redirect’,100,3);

    this gave the same results – just went to the home page.

    #75874
    shaisimchi
    Participant

    i tried with the new action – same result.

    here is the function:

    function bp_location_redirect_to_page()
    {
    global $bp,$wpdb;

    $redirect_url_has_location = ‘http://athleticrash.com’;
    $city = $wpdb->get_var($wpdb->prepare(“SELECT value FROM wp_bp_xprofile_data WHERE user_id=%d AND field_id=26” , $bp->loggedin_user->id ));
    $state = $wpdb->get_var($wpdb->prepare(“SELECT value FROM wp_bp_xprofile_data WHERE user_id=%d AND field_id=27” , $bp->loggedin_user->id ));
    $country = $wpdb->get_var($wpdb->prepare(“SELECT value FROM wp_bp_xprofile_data WHERE user_id=%d AND field_id=103” , $bp->loggedin_user->id ));
    $zip = $wpdb->get_var($wpdb->prepare(“SELECT value FROM wp_bp_xprofile_data WHERE user_id=%d AND field_id=23” , $bp->loggedin_user->id ));
    if (!$city || $city==”)
    $has_city=0;
    else
    $has_city=1;

    if (!$state || $state==”)
    $has_state=0;
    else
    $has_state=1;

    if (!$country || $country==”)
    $has_country=0;
    else
    $has_country=1;

    if (!$zip || $zip==”)
    $has_zip=0;
    else
    $has_zip=1;

    $user_link = $bp->loggedin_user->domain;
    $profile_path = ‘profile/edit’;
    $redirect_url_no_location = $user_link . $profile_path;

    if ($has_city==1 && $has_state==1 && $has_country==1 && $has_zip==1 )
    bp_core_redirect($redirect_url_has_location);
    else
    bp_core_redirect($redirect_url_no_location);
    }
    /*Add an action to redirect user after login*/
    add_action(‘login_redirect’,’bp_location_redirect_to_page’,100,0);

    #59528
    Mike Pratt
    Participant

    @bravenewcode I have to agree with @katendarcy. We have a field for address, city, state, country and postal code so, to which field(s) are you referring when you aks for the field representing “location” Please clarify. Additionally, please explain why you need “description for each user” for what purpose? Thanks

    #36677
    realfam
    Member

    I followed the Codex and created the template, it looks correct, but when I click “submit” to execute the script…I just get the index page. Any ideas on that? Here is my page code.

    <?php

    /*

    Template Name: Browse ExBriefs

    */

    ?>

    <?php get_header(); ?>

    <div id=”content” class=”narrowcolumn”>

    <h2>Search</h2>

    <form name=”search” method=”post” action=”<?=$PHP_SELF?>”>

    Seach for: <input type=”text” name=”find” /> in

    <Select NAME=”field”>

    <Option VALUE=”first”>First Name</option>

    <Option VALUE=”last”>Last Name</option>

    <Option VALUE=”city”>City</option>

    <Option VALUE=”state”>State</option>

    <Option VALUE=”country”>Country</option>

    <Option VALUE=”gender”>Gender</option>

    </Select>

    <input type=”hidden” name=”searching” value=”yes” />

    <input type=”submit” name=”search” value=”Search” />

    </form>

    <?PHP

    //This is only displayed if they have submitted the form

    if ($_POST[searching] ==”yes”)

    {

    echo “<h2>Results</h2><p>”;

    //If they did not enter a search term we give them an error

    if ($_POST[find] == “”)

    {

    echo “<p>You forgot to enter a search term”;

    exit;

    }

    // Otherwise we connect to our Database

    include(“http://www.ex-brief.com/profiles/dbinfo.inc.php&#8221;);

    mysql_connect(localhost,$username,$password);

    @mysql_select_db($database) or die( “Unable to select database”);

    // We preform a bit of filtering

    $find = strtoupper($_POST[find]);

    $find = strip_tags($find);

    $find = trim ($find);

    //Now we search for our search term, in the field the user specified

    $data=mysql_query(“select * from contacts where “.$_POST[field].” like ‘%”.addslashes($find).”%'”);

    //And we display the results

    while($result = mysql_fetch_array( $data ))

    {

    echo $result;

    echo ” “;

    echo $result;

    echo “
    “;

    echo $result;

    echo “
    “;

    echo $result;

    echo “
    “;

    echo $result;

    echo “
    “;

    echo $result;

    echo “
    “;

    echo “
    “;

    }

    //This counts the number or results – and if there wasn’t any it gives them a little message explaining that

    $anymatches=mysql_num_rows($data);

    if ($anymatches == 0)

    {

    echo “Sorry, there is no Ex-Brief for <b>”$find”</b> yet

    Please try again.

    “;

    }

    }

    ?>

    </div>

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

Viewing 5 results - 26 through 30 (of 30 total)
Skip to toolbar