site.inc.php error

Discussion in 'Customization & add-ons' started by mlurie, Feb 7, 2008.

  1. mlurie

    mlurie New Member

    Joined:
    Dec 31, 2007
    Messages:
    14
    Hi, I am trying to create a function in the site.inc.php file that uses the $db->get_payments($payment_id); hook. But when I try to use this hook according to the amember manual, I get the error message: "Fatal error: Call to undefined function setup_plugin_hook() in /home/wikicook/public_html/amember/site.inc.php on line 21"

    I am getting the error message when I type www.wikicook.com/amember/site.inc.php directly into the browser. I know the error means that the code doesn't interpret $db as an object. But I declared 'global $db;' like the amember manual told me to so I don't know why it isn't.

    Any help would be appreciated!
    Thanks!

    I have copied the function below - this is the complete code of the site.inc.php file.

    ___________________
    <?php
    error_reporting(E_ALL);

    function get_active_member_array(){
    //this function assumes users can only subscribe to one product at a time.

    global $db;

    $active_member_array =
    $db->query($sql= "SELECT member_id
    FROM {$db->config[prefix]}members
    WHERE status = '1'
    ORDER BY member_id"); //This statement begins on line 21, which the error message refers to.

    return $active_member_array;
    }

    //Testing the Function by printing the member array:
    $member_array =
    get_active_member_array();

    echo "active member array:<br>";
    echo "<pre>";
    print_r($member_array);
    echo "</pre>";

    ?>

Share This Page