Searching using member id

Discussion in 'Customization & add-ons' started by ludo99, Sep 3, 2010.

  1. ludo99

    ludo99 aMember Pro Customer

    Joined:
    Jul 20, 2008
    Messages:
    13
    Hi , I would to search for users by their member id. Is this possible? Cause I can only search user by email, name, username , email, payment id etc with amember....

    However, i dont see anything about searching by entering their member id

    Thanks
  2. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
  3. bfritton

    bfritton Certified aMember Developer

    Joined:
    Oct 26, 2009
    Messages:
    54
    This might help too, if you want to check if a member is active or not based on their ID. I used part of past member's code posted to do this although I can't find the specific thread.

    Assuming you place this file in the aMember root:

    PHP:
    <?php
    include "./config.inc.php";
    ?>
    <html>
    <title>Check a Member's Account Status</title></head>
    <body>
    <?php
    $member_id 
    intval($_GET[member_id]);
    $user $db->get_user($member_id);
    $namer $db->query("SELECT * from {$db->config[prefix]}members where `member_id` = '$member_id' ");
    $namea mysql_fetch_array($namer,0);
    if (
    $namea != ''){
    $name $namea['name_f'].' '.$namea['name_l'];
    }else{ 
    $name 'Member ID does not exist'; };

    if((
    $user[status]==1) && ($member_id != '')){
    $status 'User with account # '.$member_id.' ('.$name.') is ACTIVE.';
    }elseif((
    $user[status]!==1) && ($member_id != '')){
    $status 'User with account # '.$member_id.' ('.$name.') is <strong>NOT</strong> ACTIVE.';
    }
    ?>
    <h4>Check a Member's account status</h4>
    <form name="check_member_status" action="check_member.php" method="get">
    <p>Input Member ID (Account Number): </p>
    <input type="text" name="member_id" id="member_id" width="30" /><br />
    <input type="submit" value="Check Status" name="Check Status"  />
    </form>
    <?php echo $status?>
    </html>
    </body>

Share This Page