Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: redirect after login error


Olaf Lederer
Participant

@finalwebsites

just checked the code and it seems to me that this function is not 100% fine:

function new_topic( $args = null ) {
$defaults = array( 'text' => __('Add New »'), 'forum' => 0, 'tag' => '' );
if ( $args && is_string($args) && false === strpos($args, '=') )
$args = array( 'text' => $args );

$args = wp_parse_args( $args, $defaults );
extract( $args, EXTR_SKIP );

if ( $forum && $forum = get_forum( $forum ) )
$url = get_forum_link( $forum->forum_id ) . '#postform';
elseif ( $tag && ( ( is_numeric($tag) && $tag = bb_get_tag( $tag ) ) || $tag = bb_get_tag_by_name( $tag ) ) )
$url = bb_get_tag_link( $tag->tag ) . '#postform';
elseif ( is_forum() || is_bb_tag() )
$url = '#postform';
elseif ( is_topic() )
$url = get_forum_link() . '#postform';
elseif ( is_front() )
$url = add_query_arg( 'new', '1', bb_get_option( 'uri' ) );

if ( !bb_is_user_logged_in() )
$url = add_query_arg( 're', urlencode($url), bb_get_option( 'uri' ) . 'bb-login.php' );
elseif ( is_forum() || is_topic() ) {
if ( !bb_current_user_can( 'write_topic', get_forum_id() ) )
return;
} else {
if ( !bb_current_user_can( 'write_topics' ) )
return;
}

if ( $url = attribute_escape( apply_filters( 'new_topic_url', $url ) ) )
echo "<a href='$url' class='new-topic'>$text</a>n";
}

this part is not good and result im some error:

elseif ( is_forum() || is_bb_tag() )
$url = '#postform';

what is your adbvice to fix that? rewriting the function / adding a filter as a kind of plugin?

Skip to toolbar