samholman (@samholman)

Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)

  • samholman
    Participant

    @samholman

    Plugins shouldn’t be calling any user related functions until after the user is actually loaded. The soonest place you can do this is on the ‘init’ action; doing it sooner is _doing_it_wrong() and will cause other hidden issues in your installation later. bbPress provides that debug notice to let you know your approach was incorrect.

    Thanks for that. But why would calling a boolean function cause any “hidden issues”? That current behaviour would strike me as very definitely `_doing_it_wrong()`. It should return true/false without impacting anything else.


    samholman
    Participant

    @samholman

    Calling is_user_logged_in() in a plugin’s init file causes bbPress to error (Cheatin’ uh?) in the admin when trying to manage anything to do with the forums (settings, forums, threads, replies).

    Makes no sense to me.


    samholman
    Participant

    @samholman

    Doing a little more digging, inside wp-content/plugins/bbpress/bbp-theme-compat/bbpress/content-single-topic.php, line 28: bbp_show_lead_topic() is returning false, which means the template doesn’t render the first post.

    After that, the bbp_has_replies() function is also returning false, despite the fact that there is a reply…

Viewing 3 replies - 1 through 3 (of 3 total)