WordPress integration breaks member.php?

Discussion in 'Integration' started by alexve, Jan 27, 2011.

  1. alexve

    alexve aMember Pro Customer

    Joined:
    Nov 19, 2010
    Messages:
    14
    Hiya,

    I am using the WordPress integration method by @andyb/@kengary that requires a small modification to config.inc.php and the creation of a site.inc.php. I am using the latest WordPress version btw (v3.0.4).

    Using this integration method, I cannot add add/buy any product using the 'add new subsription tab' a user' profile/account. When a user tries to add/buy a product this way, an 'error' is shown. The result is a red box with an empty <li> item (basically, an unknow error).

    After renaming my site.inc.php to site.inc.php.old (removing the integration), the issue remains.

    After rolling back the config.inc.php file to the original version, the issue goes away. Basically, when I remove the following code from my config.inc.php, I can buy a product without any error:
    /**
    * WordPress Integration
    *
    */
    $__POST = $_POST;
    $__GET = $_GET;
    $__REQUEST = $_REQUEST;

    define('WP_USE_THEMES', false);

    require_once(dirname(__FILE__).'/../wp-config.php'); // as amember is installed to root folder of wp install

    global $wp;

    $wp->init();
    $wp->parse_request();
    $wp->query_posts();
    $wp->register_globals();
    $_POST = $__POST;
    $_GET = $__GET;
    $_REQUEST = $__REQUEST;


    However, this disables the WordPress integration...something we don't want of course. How can I fix this?

    Thanks!
    Alex
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
  3. alexve

    alexve aMember Pro Customer

    Joined:
    Nov 19, 2010
    Messages:
    14
    Thanks for pointing me into this direction as it solves the issue.

    However I am curious if you would recommend integrating WordPress & Amember using config.inc.php & site.inc.php method?

    Anton from Amember support and @kengary recommended today that I use the regular Amember method (using layout.html, header.html, etc).

    I'd prefer the config.inc.php & site.inc.php method but perhaps you can put some more guidance on this topic in your FAQ? E.g. if it is supported, recommended, etc?

    Thanks & best regards,
    Alex
  4. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Alex,
    Of course this is recommended to just modify amember templates, because there will be issues when you integrate two different scripts such way. But all issues can be fixed, so if you get that integration working already, why not to use it.

Share This Page