Forum Replies Created
-
In reply to: first post
That’s causing the same error!
In reply to: first postHi Robin,
The full error is this:
Parse error: syntax error, unexpected ‘only’ (T_STRING), expecting ‘,’ or ‘;’ in …./blog/wp-content/themes/virtue_premium/bbpress/loop-replies.php on line 54<?php // if user is not logged in and is the first reply
if( !is_user_logged_in() && $rep_position =2 ) {
echo “Replies only viewable for logged in users”;
}
// if user is not logged in and is after the forst reply, then don’t do naything
elseif( !is_user_logged_in() && $rep_position >2 ) {
}
//otherwise carry on as usual
else bbp_get_template_part( ‘loop’, ‘single-reply’ ); ?>In reply to: first postI think we are close, but it gives me an error in this line
echo “Replies only viewable for logged in users”;
Parse error: syntax error, unexpected ‘only‘ (T_STRING), expecting ‘,’ or ‘;’
Seems like it uses the message as code?In reply to: first postHm, it shows this error…
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'bb_auth_reply_view' not found or invalid function name in ..../blog/wp-includes/plugin.php on line 213
In reply to: first postI thought I can do it with a filter in functions.php.
Don’t want to setup a child theme for this.
Is it possible to do it with just adding a additonal bbpress file to my theme?My php-code knowledge is just search, copy and paste 😉
Thanks
MatthiasIn reply to: first postThat’s how it looks in my forum. There are all answer-posters visible only the text is hidden.
and I just want to show like the yellow template notice here
Thanks
MatthiasIn reply to: first postI found a nice code, that shows the first message in a thread for everyone.
Answer are shown only to logged in users.Perfekt so far.
BUT the code shows in every answer the same message for non logged users
“Replies only viewable for logged in users”Does anyone know, how to change the code, to show only one template-notice
“Replies only viewable for logged in users” instead?function bb_auth_reply_view( $reply_id ) { $reply_id = bbp_get_reply_id( $reply_id ); // Check if password is required if ( post_password_required( $reply_id ) ) return get_the_password_form(); $content = get_post_field( 'post_content', $reply_id ); // first topic reply shouldn't be hiding $rep_position = bbp_get_reply_position($reply_id); // if user is not logged in and not the first post topic if( !is_user_logged_in() && $rep_position > 1 ) { return "Replies only viewable for logged in users"; } else { // return normal return $content; } } add_filter( 'bbp_get_reply_content', 'bb_auth_reply_view' );
Thanks
MatthiasIn reply to: first postI still can not post my question. It’s a longer question and its a link in it.
Perhabs that’s the problem…?