I’m using wp 3.9, bp 2.0.1 and the bp-groupblog plugin 1.8.5. In the ‘create_screen’-function in BP_Groupblog_Extension-class (extending the BP_Group_Extension-class) the plugin adds an action:

function create_screen( $group_id = null ) {
    add_action( 'bp_groupblog_create_screen_markup', 'bp_groupblog_signup_blog' );
    do_action( 'bp_groupblog_create_screen_markup' );

To customize the group-blog-registration-HTML I need to replaced ‘bp_groupblog_signup_blog’-function.

Code in pb-custom.php:

function replace_bp_groupblog_signup_blog() {
   remove_action('bp_groupblog_create_screen_markup', 'bp_groupblog_signup_blog');
    function my_bp_groupblog_signup_blog($blogname = '', $blog_title = '', $errors = ''){      
        // all the code
    add_action( 'bp_groupblog_create_screen_markup', 'my_bp_groupblog_signup_blog');
add_action( 'plugins_loaded', 'replace_bp_groupblog_signup_blog' );

I can add a customized function bud i can’t remove the original one and I’m getting the HTML for both functions displayed on my page now .
The ‘has_action’ returns false at the time of the remove_action. So I’m hooking too early? I checked the action-hooklist (http://goo.gl/C5exli), tried ‘bp_include’, ‘bp_loaded’, added/altered the priority etc bud nothing works.

How is it done?


Read more here: replace a function added in external class


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , ,

Wordpress related questions and answers: