Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] BP 1.7 – what is this message intended for ?

  • @chouf1

    Participant

    What means this message in BP 1.7 bp-core-dependancy.php81 ?

    The current user is being initialized without using $wp->init().

    if it happens, what must to be done (or not) ?

Viewing 6 replies - 1 through 6 (of 6 total)
  • @sbrajesh

    Participant

    Most probably the code you are using is trying to access logged in user’s data before init action. Since the current user is set on ‘set_current_user’ hook’ which is just before init, any function trying to access current user data should be called on or after init action.

    Hope that helps.

    Reference: https://codex.wordpress.org/Plugin_API/Action_Reference

    @chouf1

    Participant

    thanks @sbrajesh

    i’m working on the translation, not coding actually. 😉

    I just wonder on this new message and the comments:

    function bp_setup_current_user() {

    // If the current user is being setup before the “init” action has fired,
    // strange (and difficult to debug) role/capability issues will occur.

    Is this message viewed by the user on front-end ? Or only in the admin ?

    And if roles/caps will occur, the super-admi is also affected i guess. I presume this was tested by the devs, so advice about what kind of incident this can give would be great to know.

    @chouf1

    Participant

    [resolved]
    Is harmless. This sends only a php notice when debug mode is on.

    @sbrajesh

    Participant

    Hi @chouf1
    sorry I could not follow up.
    That message is intended for debugging the site and will be visible if WP_DEBUG is set true as you have already noticed.

    It is there to aid the developers/site admin to properly use functions related to current user.

    @chouf1

    Participant

    @sbrajesh,

    For help or guidance  on the french BP support forum, it’s as important for me to undestand such error messages clearly. Thank you again !

    @shanebp

    Moderator

    I wouldn’t say it’s entirely harmless.

    If you need to check something like user roles right after you load your plugin but before continuing, you can do something like this:
    `
    function something_check_access () {
    $current_user = wp_get_current_user();
    $roles = $current_user->roles;
    $role = array_shift($roles);

    if($role == ‘administrator’ ) {
    // add your hooks here
    }
    }
    add_action(‘init’, ‘something_check_access’);`

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] BP 1.7 – what is this message intended for ?’ is closed to new replies.
Skip to toolbar