Home Forums WC Vendors Free Support Undefinite notice on all pages

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.

https://docs.wcvendors.com/

Thank you to all of our customers!

 

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #34650
    Igor
    Participant

    I have notice on all pages if BuddyPress and WC Vendor installed

    bp_setup_current_user was called incorrectly. The current user is being initialized without using $wp->init(). Please see Debugging in WordPress for more information. (This message was added in version 1.7.)

    Stack of loading

    bp_setup_current_user()
    wp-includes/functions.php:3897
    do_action(‘set_current_user’)
    wp-includes/pluggable.php:47
    wp_set_current_user()
    wp-includes/user.php:2475
    _wp_get_current_user()
    wp-includes/pluggable.php:69
    wp_get_current_user()
    wp-includes/capabilities.php:428
    current_user_can()
    wp-content/plugins/wc-vendors/classes/admin/class-product-meta.php:19
    WCV_Product_Meta->__construct()
    wp-content/plugins/wc-vendors/class-wc-vendors.php:208
    WC_Vendors->include_core()
    Unknown location

    As I remember I had this error early in another plugin. Problem was in priority of initialization. Plugin inits some code before Buddypress and wordpress, so, function current_user_can() makes notice

    #34682
    WC Vendors Support
    Participant

    We dont call bp_setup_current_user anywhere in WC Vendors Free, or Pro, or any of our software we write. Most likely this is your theme doing it.

    #34716
    Igor
    Participant

    I don’t write that you call bp_setup_current_user. This calling is from Buddypress. I wrote that you make calling of current_user_can() which makes this notice.

    I suggest that this is because you use hook plugins_loaded to load core functions. Many other plugins use hook “init” which is calling after plugins_loaded, and this creates some incompatibilities with your plugin. Among these plugins: BPress and BuddyPress, also most of other extended plugins for user functions.

    So, more safety way is to call current_user_can() after “init”.

    Currently, this doesn’t make any big problem, but they can be in some cases

    #37995
    Berdych
    Participant

    My debug log writes the same after every reloading of any page:

    `[23-Jul-2016 11:16:47 UTC] PHP Notice: Trying to get property of non-object in C:\OpenServer\domains\vendors\wp-content\plugins\wc-vendors\classes\class-install.php on line 33

    [23-Jul-2016 11:18:47 UTC] PHP Notice: bp_setup_current_user was called incorrectly. The current user is being initialized without using $wp->init().
    ===
    Trace:
    #6 C:\OpenServer\domains\vendors\wp-content\plugins\wc-vendors\classes\admin\class-product-meta.php(19): current_user_can(‘manage_woocomme…’)
    #7 C:\OpenServer\domains\vendors\wp-content\plugins\wc-vendors\class-wc-vendors.php(227): WCV_Product_Meta->__construct()
    #8 [internal function]: WC_Vendors->include_core(”)
    #9 C:\OpenServer\domains\vendors\wp-includes\plugin.php(525): call_user_func_array(Array, Array)
    #10 C:\OpenServer\domains\vendors\wp-settings.php(277): do_action(‘plugins_loaded’)
    #11 C:\OpenServer\domains\vendors\wp-config.php(94): require_once(‘C:\OpenServer\d…’)
    #12 C:\OpenServer\domains\vendors\wp-load.php(37): require_once(‘C:\OpenServer\d…’)
    #13 C:\OpenServer\domains\vendors\wp-admin\admin-ajax.php(22): require_once(‘C:\OpenServer\d…’)
    #14 {main}
    ===
    Please see Debugging in WordPress for more information. (This message was added in version 1.7.) in C:\OpenServer\domains\vendors\wp-includes\functions.php on line 3897

    #38127
    WC Vendors Support
    Participant

    @Berdych — The first issue is a warning and you can ignore that. The second issue is not from WC Vendors, that’s a BuddyPress warning, and also a really really common one that they havent addressed in years (literally!). You can safely ignore it, too.

    #38750
    Lawrence
    Participant

    hi Ben,

    I have some problem with Wc vendor + woocommerce. After installing both plugin, whenever i logout from main user an error will be display.

    #38839
    Anna
    Member

    @Lawrenceyidi
    Please start your own thread, as the topic originally posted in this thread is not related to your question. We can then help you with your concerns and the followers of this thread are not getting unnecessary unrelated notifications.

    Thank you 🙂

    #39007
    Igor
    Participant

    Problem is that it’s not real Buddypress issue. Without WC Vendor – there is no such error in Buddypress. As I wrote early, you use current_user_can() function in plugins_loaded hook, but such function must be in init hook as in most of popular member plugins to prevent different incompatibilities. And it’s not a single problem with Buddypress. BBPress also will have the same problem.

    #39053
    Berdych
    Participant

    I guess the solving for:
    [23-Jul-2016 11:16:47 UTC] PHP Notice: Trying to get property of non-object in C:\OpenServer\domains\vendors\wp-content\plugins\wc-vendors\classes\class-install.php on line 33

    is:
    #33 if ( $orders_page && $orders_page->post_name === 'orders' ) {

    #40700
    Igor
    Participant

    I have another several customers who found this problem as a real big bug which makes their site totally broken.

    http://screencast.com/t/55lMLohW

    I understand that this notice will be just notice if debug mode is disabled. But in many cases, sich issue can have big impact on all login/register functions and even breaks admin page.

    One more time, how easily to solve this. Instead of using

    add_action( 'plugins_loaded', array( $this, 'include_core' ) );

    you can use

    add_action( 'init', array( $this, 'include_core' ) );

    or, if it’s impossible, you can load only one file class-product-meta.php with init hook

    #40889
    Pippa
    Participant

    So far really happy with Rehab and the integration with WCPro but this issue keeps coming up for me also, breaking my site.

    #40910
    Jamie
    Keymaster

    Hello,

    There was a reason I couldn’t bubble it up to init but I cannot remember why. I will attempt to fix this issue to stop the warnings and get back to you.

    cheers,

    Jamie.

    #40929
    Jamie
    Keymaster

    Hello

    The reason is changing it to init for all objects breaks checkout. Which isn’t exactly what you what to do 🙂 I have re-arranged when things load and will continue to do some testing to make sure I haven’t broken any core functionality of free. My testing continues.

    cheers,

    Jamie.

    #41492
    Jamie
    Keymaster

    Hello,

    Looks like my updates in free have fixed these notices from no longer appearing and not breaking check out. You can download the latest check in from our github if you’d like to test it out before our next official release.

    cheers,

    Jamie

    #41522
    Skywalker
    Participant

    I registered just to say thanks, Jamie! Been waiting for this fix for months!
    The usual fix changing the hook ‘plugin_loaded’ to ‘init’ will result in JSON error in the checkout page like you said, and probably also break Vendor’s Paypal email. With Ben denying responsibility in every bug report I was afraid the fix might never come. I just tried out your fix in Paypal Sandbox and it seems to be working. Thank you again!
    P.S. See this comment for BuddyPress’s explanation for this issue.

Viewing 15 posts - 1 through 15 (of 15 total)
  • The forum ‘WC Vendors Free Support’ is closed to new topics and replies.