your triple ===
means that is has to match type (eg string or integer) as well as value, hence why
if(bbp_forum_id() === '513')
didn’t work, as the forum id is an integer and by havng quotes round the number you are asking it to be a string
in your solution
<?php if(bbp_get_forum_id() === $forum_id = 513): ?>
would be better as
<?php if(bbp_get_forum_id() === 513): ?>
or better still
<?php if(bbp_get_forum_id() == 513): ?>
as unless you are using the $forum_id variable elsewhere (when it probbaly needs to be declared as a global) then the $forum_id =
is redundant
but glad you fixed it