bbPress

Simple, Fast, Elegant

bbPress support forums » Plugins

bbPM admin menu not working at all

(2 posts)
  • Started 3 months ago by Nightgunner5
  • Latest reply from _ck_
  • This topic is not resolved
  1. You can download a before-alpha copy at http://www.mediafire.com/?51zcmu1mhou

    The problems I'm having are that

    1. When I activate the plugin, it doesn't know about the "bb_is_user_logged_in()" command
    2. And when I delete that command from the plugin, it never finds BB_IS_ADMIN to be true.

    Fatal error: Call to undefined function bb_is_user_logged_in() in J:\www\htdocs\bbpress-stable\my-plugins\bbpm.php on line 20

    Posted 3 months ago #
  2. I am not sure about the loading order of your plugin but keep in mind that stuff like bb_is_user_logged_in() is only available when bbPress is fully initialized.

    Essentially you cannot execute anything but the most basic independent code until do_action('bb_init' happens.

    So you have to hook bb_init, ie:
    add_action('bb_init','your_function_name);`

    and THEN your function can check bb_is_user_logged_in.

    BB_IS_ADMIN is a constant so be sure to use DEFINED to test it and not directly or you'll get an error
    if (defined('BB_IS_ADMIN')) {

    (also, BB_IS_ADMIN means if you are in the admin menu, not if the user is an administrator - not sure if you knew that)

    Posted 3 months ago #

RSS feed for this topic

Reply

You must log in to post.

Code is Poetry.