Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to Show Members From The Same Region


  • sookie29
    Participant

    @sookie29

    Hi Guys,

    I would like to show members from the same region when logged in and here is the code I have used but now working:

    <!–?php </p–>

    bp_loggedin_user_id();

    $user_id = 14 ;

    $myfield = xprofile_get_field_data( ‘State’, 14);
    echo $myfield;

    xprofile_get_field_data(‘field=Bundesland’, 14);
    ?>

     

     

    <!–?php </p–>

    }

    $sql=”select * from `
    glft448_bp_xprofile_data where value = ‘”.$state.”‘”;
    $con1 = mysql_query(“SELECT distinct user_id FROM glft448_bp_xprofile_data WHERE value = ‘”.$state.”‘”);

    while($queRes1 = mysql_fetch_array($con1))

    {

    ?>

    <!–?php $queRes1[‘user_id’];<br ?–> // echo bp_core_get_userlink($queRes1[‘user_id’]);

    ?>
    <a href=”"<?php”>” >
    <!–?php echo bp_core_fetch_avatar ( array( ‘item_id’ =–>$queRes1[‘user_id’] , ‘type’ => ‘thumb’ ) ); ?></a>

    <!–?php </p–>

    }

    $sqlt=”select * from `glft448_bp_xprofile_data where value = ‘”.$state.”‘”;
    $con2 = mysql_query(“SELECT * FROM glft448_bp_xprofile_data WHERE user_id = ‘”.$user_id.”‘ AND field_id = ‘1’ “);

    while($queRes2 = mysql_fetch_array($con2))

    {

    ?>

    <b> <!–?php //echo $queRes2[‘value’]; ?–></b>

    I added that code to the text version of the page editor but it’s showing like that on the profile page.

    What am I missing?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)

  • shanebp
    Moderator

    @shanebp

    No offense, but your code is a real mess.
    And you should be using wpdb instead of mysql_query.
    Please consider hiring a developer. You can post a job here.


    cybervang
    Participant

    @cybervang

    I don’t see why you need so much coding for such a simple sorting.
    I’d just use a small conditional code to display and ignore a user in the members loops if he wasn’t in my state.

    Shouldn’t require much coding at all.


    sookie29
    Participant

    @sookie29

    Thank you for responding guys, @cybervang may please you show me how the code should be?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to Show Members From The Same Region’ is closed to new replies.
Skip to toolbar