• We are testing out the AffiliateWP plugin on our site and are using their affiliate portal add on. When a new affiliate attempts to register, a critical error is logged in the debug logs.

    [26-Jan-2022 19:14:54 UTC] PHP Fatal error: Uncaught Error: Call to a member function get_safe_name() on null in /nas/content/live/site/wp-content/plugins/enhanced-category-pages/classes/ecp/WP_Integration.php:267
    Stack trace:
    #0 /nas/content/live/site/wp-includes/class-wp-hook.php(305): ecp\WP_Integration->update_post(1980498)
    #1 /nas/content/live/site/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters(NULL, Array)
    #2 /nas/content/live/site/wp-includes/plugin.php(470): WP_Hook->do_action(Array)
    #3 /nas/content/live/site/wp-includes/post.php(4442): do_action(‘post_updated’, 1980498, Object(WP_Post), Object(WP_Post))
    #4 /nas/content/live/site/wp-content/plugins/flamingo/includes/class-contact.php(202): wp_insert_post(Array)
    #5 /nas/content/live/site/wp-content/plugins/flamingo/includes/class-contact.php(135): Flamingo_Contact->save()
    #6 /nas/content/live/site/wp-content/plugins/flamingo/includes/user.php(25): Flamingo_Contact::add(Array)
    #7 /nas/content/live/site in /nas/content/live/site/wp-content/plugins/enhanced-category-pages/classes/ecp/WP_Integration.php on line 267

    I adjusted the update_post function in WP_Integration.php to check for null. I don’t know if AffilliateWP is updating posts incorrectly or if this is the correct solution. Would appreciate your feedback.

    Here is the modified function:
    public function update_post($post_id) {
    $post = get_post($post_id);
    if($this->_enhanced_category !== null) { //This is the check for null
    if ($post->post_type === $this->_enhanced_category->get_safe_name()) {
    $this->_enhanced_category->update_from_post($post_id);
    }
    }
    }

  • The topic ‘affiliateWP conflict’ is closed to new replies.