Skip to:
Content
Pages
Categories
Search
Top
Bottom

Conflict with my plugin

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

  • shanebp
    Moderator

    @shanebp

    What version of BP are you using to test this?

    Is this what you see on /bp-members-admin.php:829
    if ( $this->users_page != get_current_screen()->id ) {

    Just guessing, but…

    You’re using the admin_init hook to call hmn_cp_trigger_upgrades which calls hmn_cp_v121_upgrade which seems to call remove_signups_from_user_query() in class BP_Members_Admin

    So maybe the screen id or users_page doesn’t exist yet.

    Perhaps try a hook other than admin_init?
    Or give it a high number for priority?

    Other than the warning, is your plugin executing as expected?


    shanebp
    Moderator

    @shanebp

    afaik, this call in bp-members-admin.php is causing the issue.

    add_action( 'pre_user_query', array( $this, 'remove_signups_from_user_query'), 10, 1 );

    You might try hooking admin_init early, 1 or 2,
    then doing a remove action, run your code and the replace the action?


    Paul de Wouters
    Participant

    @pauldewouters

    Thanks for your reply.
    So, did a little research, and Codex says:

    The function [get_current_screen] returns null if called from the admin_init hook. It should be OK to use in a later hook.

    So BuddyPress could check whether the remove_signups_from_user_query method was called through the admin_init hook and return if so:

    		if ( ( doing_action( 'admin_init' )  ) || $this->users_page != get_current_screen()->id ) {
    			return;
    		}

    This fixes the issue for me.

    Hi @pauldewouters, welcome to the BuddyPress forums.

    Sounds like this discussion should be moved to a Trac ticket, if someone would like to do that.

    I’m not familiar enough with this part of the code to know if this is a good way to fix the problem, but I know a man who does: @imath – hello. 🙂


    Paul de Wouters
    Participant

    @pauldewouters

    Hey Paul,

    Thanks, I’ll open a trac ticket


    Paul de Wouters
    Participant

    @pauldewouters

    Thanks @djpaul & @pauldewouters,

    i think the doing_action( ‘admin_init’ ) check is ok, thanks a lot for your feedback.

    oopsy spoke too quick, sorry. doing_action( ‘admin_init’ ) is only available since WordPress 3.9


    Paul de Wouters
    Participant

    @pauldewouters

    ah, what’s the earliest supported version? Answer: 3.6 or higher

    Thanks for creating the ticket. Looks like we should have a fix in trunk soon.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Conflict with my plugin’ is closed to new replies.
Skip to toolbar