WordPress.org

Ready to get started?Download WordPress

Forums

overriding code in theme (3 posts)

  1. Robin W
    Member
    Posted 1 year ago #

    Ok, so I have written and got working my first plugin, I am adding some user info to the reply display in bbpress.

    It has the following lines in one of its php files (loop-single-reply)

    <?php do_action( 'bbp_theme_before_reply_author_details' ); ?>
    <?php bbp_reply_author_link( array( 'sep' => '<br />', 'show_role' => true) ); ?>
    [...other lines of code here]
    
    <?php do_action( 'bbp_theme_after_reply_author_details' ); ?>

    I worked out how to get a plugin to put some other stuff I need before ‘bbp_theme_after_reply_author_details’ so it’s working fine

    BUT I want to change the line

    <?php bbp_reply_author_link( array( 'sep' => '<br />', 'show_role' => true) ); ?> to
    <?php bbp_reply_author_link( array( 'sep' => '<br />', 'show_role' => false) ); ?>
    I think I do this with a “remove action” in my plugin, and then add the code line as I want it back into my plugin – in effect deleting the line between “do actions” and replacing this with what I want.

    But I cannot fathom from the codex and other googles quite how you do this

    1) is my understanding correct?
    2) what would the code line be in my plugin?

  2. rwatuny
    Member
    Posted 6 months ago #

    Hello,

    I just saw your question. Pretty new at this.

    You can't use a remove action to remove lines in a template.

    But I think that you could be able to do what you want using the bbp_after_get_reply_author_link_parse_args filter.

    It is called in the bbp_get_reply_author_link function, via the bbp_parse_args function :

    $r = bbp_parse_args( $args, array(
    			'post_id'    => 0,
    			'link_title' => '',
    			'type'       => 'both',
    			'size'       => 80,
    			'sep'        => '&nbsp;',
    			'show_role'  => false
    		), 'get_reply_author_link' );

    So in your plugin, you could simply override the 'show_role' to false.

  3. Robin W
    Member
    Posted 6 months ago #

    Thanks for that - I'll give it a try

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.