The MU forums have moved to WordPress.org

About $wpdb (3 posts)

  1. YoBazil
    Member
    Posted 16 years ago #

    Well i have installed WordPress MU, using Apache2, PHP 5.2
    my site developed with php5.2 and symphony.
    I have set the WordPress at the root directory of my site web directory inder blogs/
    this is working fine, i can see blogs, and create new one.
    When i try to call the blog login page from my symfuny project, i get error.
    i have puten all the wordpress code from the installation in my \frontend\modules\user\templates and call wp-loginSuccess from my action.
    the problem i have is that the $wpdb gets error when trying to call it -
    Call to a member function get_var() on a non-object

    for some reason this global db connection is not initiated,
    someone knows where this initiation takes place? and way it is not working?

    maybe because at initiating the wordpress DB i specified the directory of : web\blogs
    and now i moved all the code to my module at :
    \frontend\modules\user\templates

    could someone help please.

  2. PhoenixRises
    Member
    Posted 16 years ago #

    Including ~/wp-includes/wpdb.php (where ~ is the root directory of WordPress) should give you the initialized variable, $wbdb, then declare the global in any functions that need it.

    Having not used symfony, if that doesn't help, posting the problem code might help in solving the issue.

  3. bradmkjr
    Blocked
    Posted 16 years ago #

    something like this may be in order:

    <?php

    if (empty($wp)) {
    require_once('/blog/wp-config.php');
    wp();
    }
    ?>

About this Topic

  • Started 16 years ago by YoBazil
  • Latest reply from bradmkjr