I found a work-around.
- Use CPanel’s file manager (or FTP) and go to
plugins → bbpress-post-topics → templates.
- Open the file
comments-bbpress-link.php.
- Locate the line that begins with
<a href="php bbp_topic_permalink…
- Replace it with
<a href="<?php bbp_topic_permalink( $bbp_post_topics->topic_ID ); ?>"><?php echo "<button>" . esc_attr($link_text) . "</button>"; ?></a>
This will output a button with the text you give in the settings. Naturally the button uses whatever formatting your theme has defined for buttons.
Plugin Author
Nick
(@nickchomey)
@robin-w, esc_attr was added to satisfy concerns that the plugin team had. But I just looked at the code and don’t see any reason whatsoever for this $link_text variable to be be escaped – the text is set in the backend by an admin, so there shouldn’t be any concerns about it.
Can we revert to echo ($link_text) here?
https://plugins.trac.ww.wp.xz.cn/changeset?old_path=%2Fbbpress-post-topics%2Ftrunk%2Ftemplates%2Fcomments-bbpress-link.php&old=2497386&new_path=%2Fbbpress-post-topics%2Ftrunk%2Ftemplates%2Fcomments-bbpress-link.php&new=2745884&sfp_email=&sfph_mail=
Plugin Author
Nick
(@nickchomey)
Moreover, we can include html in the “Content of topic first post:”
which ultimately is displayed by this template file wp-content/plugins/buddyboss-platform/bp-forums/templates/default/bbpress/content-single-topic-lead.php (buddyboss version, but will be roughly the same for bbpress) which displays the post content with this function, which is a straight echo.
function bbp_topic_content( $topic_id = 0 ) {
echo bbp_get_topic_content( $topic_id );
}
So, if the mods have a problem with us echoing the admin-set link text, they should take up battle with bbpress itself.
Plugin Author
Nick
(@nickchomey)
Nevermind – that function calls get_post_field() which uses sanitize_post_field(), which removes tags like <button> </button>.
It sounds like we need to keep it as-is to not run afoul of the plugin mods. Anyone who prefers something else can manually override the code as @juhametsakallas has done…