Search Results for 'code'
-
AuthorSearch Results
-
April 20, 2020 at 4:10 am #210339
In reply to: Cannot read text in my forum
Robin W
Moderatoryou set up a page called say register_page and put this code into the content
[bbp-register]
April 20, 2020 at 1:13 am #210333Topic: How to display latest topic in horizontal format
in forum Troubleshootingfabwintle
ParticipantHi,
I’d love to display the latest forum topic to my logged in user using a ‘hello bar’ / horizontal bar at the top of my site (I’d build it in Elementor).I’ve tried with the [bbp-display-topic-index show=’5′] shortcode but it displays it vertically.
I’m not well versed in php but I can copy and adapt.
Would anyone be able to advise how I can do this?
Thanks!April 19, 2020 at 4:43 pm #210330In reply to: Show Custom Warning Message
Robin W
Moderatoradd_action ('bbp_theme_before_topic_form_notices' ,'rew_show_notice' ) ; function rew_show_notice () { if (!is_user_logged_in()) { echo '<div class="rew-notice">Only registered users are allowed to upload attachments'</div>' ; } }April 19, 2020 at 4:25 pm #210329In reply to: Change Forum Title from Archives: Forums
ticsandthoughts
ParticipantHi Robin,
Thanks for the quick response. Yes I have a wordpress page called forums with the shortcode [bbp-forum-index] in the body.
From there, in my menus, the Forums link is linked to https://ticsandthoughts.com/forums/
April 19, 2020 at 3:21 pm #210327In reply to: Search form styling
Robin W
Moderatorplay with the width settings in the above code
width: calc(100% - 85px);and
width: 84px;April 19, 2020 at 3:16 pm #210324In reply to: Show Custom Warning Message
Robin W
Moderatoradd_action ('bbp_theme_before_topic_form_notices' ,'rew_show_notice' ) ; function rew_show_notice () { echo '<div class="rew-notice">Only registered users are allowed to upload attachments'</div>' ; }April 19, 2020 at 2:39 pm #210322In reply to: Search form styling
Hum Gurung
ParticipantHi @robin-w
Thank you for quick reply and code. I placed the code to customizer and it looks little better, however the width of the search form is still half of the area. Is it possible to display 100% width? BTW, the search form is displayed automatically without any shortcode. Here is my bbpress installation.
Thanks again.
EtchbeeApril 19, 2020 at 2:35 pm #210320Topic: How can i display bbpress tag list
in forum PluginsKikis
ParticipantI would like to display all topic tags list but I could not find the widget ot shortcode so please help me out here
April 19, 2020 at 2:03 pm #210318In reply to: Search form styling
Robin W
Moderator#bbp-search-form input[type="text"] { font-size: 15px; background: #fff; border: 1px solid #bacad6; margin-right: -4px; border-right: 0; border-top-left-radius: 5px; border-bottom-left-radius: 5px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; width: calc(100% - 85px); }#bbp-search-form input[type="submit"] { font-size: 15px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 0px; border-bottom-left-radius: 0px; width: 84px; }April 19, 2020 at 11:38 am #210313In reply to: Moving a reply to a new topic
Robin W
Moderatorgreat – not sure why it didn’t work in code snippets (in essence it’s the same code as you’ve just enabled in style pack), but that will help me – glad you are fixed !!
April 19, 2020 at 10:46 am #210311In reply to: Moving a reply to a new topic
Robin W
Moderatoryou guessed right, we might need to do that.
This was found to happen with Theme my login plugin, which registered a public query which both use. My bug fix should have corrected that, even if another plugin is doing it.
But yes, we need to find which plugin is doing that.
however just before we do, can you take out the code above from code snippets
then in
dashboard>settings>bbp style pack>bug fixes, can you tick “Fix ‘A variable Mismatch has been detected’ ” save and try again.
then come back
April 19, 2020 at 8:10 am #210306In reply to: Moving a reply to a new topic
finallyfoundausernamenotusedbefore
ParticipantThanks for the quick response, Robin.
I am afraid I still get the same message – “A variable mismatch has been detected.”, with PHP7.1.
I added this using Code Snippets.
John
April 19, 2020 at 7:26 am #210305In reply to: Moving a reply to a new topic
Robin W
ModeratorPut this in your child theme’s function file – or use
function rew_get_topic_split_link( $retval, $r, $args ) { // Parse arguments against default values $r = bbp_parse_args( $args, array( 'id' => 0, 'link_before' => '', 'link_after' => '', 'split_text' => esc_html__( 'Split', 'bbpress' ), 'split_title' => esc_attr__( 'Split the topic from this reply', 'bbpress' ) ), 'get_topic_split_link' ); // Get IDs $reply_id = bbp_get_reply_id( $r['id'] ); $topic_id = bbp_get_reply_topic_id( $reply_id ); // Bail if no reply/topic ID, or user cannot moderate if ( empty( $reply_id ) || empty( $topic_id ) || ! current_user_can( 'moderate', $topic_id ) ) { return; } $uri = add_query_arg( array( 'action' => 'bbp-split-topic', 'reply_id' => $reply_id ), bbp_get_topic_edit_url( $topic_id ) ); $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" title="' . $r['split_title'] . '" class="bbp-topic-split-link">' . $r['split_text'] . '</a>' . $r['link_after']; // Filter & return return apply_filters( 'rew_get_topic_split_link', $retval, $r, $args ); } add_filter ('bbp_get_topic_split_link', 'rew_get_topic_split_link' , 10 , 3) ; function rew_is_topic_split() { // Assume false $retval = false; // Check topic edit and GET params if ( bbp_is_topic_edit() && ! empty( $_GET['action'] ) && ( 'bbp-split-topic' === $_GET['action'] ) ) { $retval = true; } // Filter & return return (bool) apply_filters( 'rew_is_topic_split', $retval ); } add_filter ('bbp_is_topic_split' , 'rew_is_topic_split' ) ;and come back and confirm that it works
April 18, 2020 at 4:39 pm #210294In reply to: Cannot read text in my forum
Robin W
Moderatoryou theme is affecting this, specifically
body, .entry-title a, :root .has-primary-color { color: #ffffff; }which turns text white
April 18, 2020 at 12:24 pm #210289In reply to: Notify user when a reply goes into moderation
Robin W
Moderator@ajtruckle Most of the code I did is probably redundant as I think digital arms moderation tools does it
But the code for Clive immediately above notifies the user that their reply is in moderation.
so
1. create a WordPress page with a permalink of ‘/moderation/’
2. put whatever message you want in there eg ‘your reply is being held in moderation’
3. if you want you can also put the shortcode [mod-return] in the page as well which will post a return link to the topic
4. add the code above to functions file or code snippets
5. when a user (logged in or anonymous if you allow that) posts a reply that goes into moderation, they are directed to your moderation page, so get certainty that their post is being held in moderation, with a link back to their topic if you’ve added the shortcodeApril 18, 2020 at 12:16 pm #210288In reply to: Notify user when a reply goes into moderation
Robin W
Moderator@clivesmith try this and you can add
[mod-return]shortcode to your moderation page that gives a return to topic link//add message if reply help in moderation add_filter ('bbp_new_reply_redirect_to' , 'rew_pending_check', 30 , 3) ; function rew_pending_check ($reply_url, $redirect_to, $reply_id) { $status = get_post_status ($reply_id) ; $topic_id = bbp_get_reply_topic_id( $reply_id ); if ($status == 'pending' ) { $reply_url = '/moderation/?moderation_pending='.$topic_id ; } return $reply_url ; } add_shortcode ('mod-return' , 'mod_return' ) ; function mod_return () { if (!empty($_REQUEST['moderation_pending'] )) { $topic_url = get_permalink( $_REQUEST['moderation_pending'] ); echo '<div class="mod-return"><a href= "'.$topic_url,'">Return to topic</a></div>'; } }April 18, 2020 at 10:16 am #210282In reply to: Notify user when a reply goes into moderation
Robin W
Moderatorok, let’s try upping the priority as that plugin updates the url, so change
add_filter ('bbp_new_reply_redirect_to' , 'rew_pending_check', 10 , 3) ;to
add_filter ('bbp_new_reply_redirect_to' , 'rew_pending_check', 30 , 3) ;April 18, 2020 at 9:22 am #210274In reply to: Notify user when a reply goes into moderation
Robin W
Moderator@clivesmith just tried an anonymous post using
//add message if reply help in moderation add_filter ('bbp_new_reply_redirect_to' , 'rew_pending_check', 10 , 3) ; function rew_pending_check ($reply_url, $redirect_to, $reply_id) { $status = get_post_status ($reply_id) ; if ($status == 'pending' ) { $reply_url = '/moderation/' ; } return $reply_url ; }and it does redirect to the moderation page – can you recheck yours please ?
April 18, 2020 at 8:08 am #210270In reply to: Notify user when a reply goes into moderation
Clivesmith
ParticipantI ran your code on my development site as a guest and it does not work it returns the same as on the live site as a guest.
As I am the only member, I only moderate guests.April 18, 2020 at 7:41 am #210265In reply to: forum title in topics page
Robin W
ModeratorPut this in your child theme’s function file – or use
add_action ('bbp_template_before_replies_loop' ,'rew_show_forum' ) ; function rew_show_forum () { $forum_id = bbp_get_topic_forum_id() ; $title = bbp_get_forum_title($forum_id) ; echo '<div class="rew-in-forum">In forum : '.$title.'</div>' ; }April 18, 2020 at 7:17 am #210262In reply to: Notify user when a reply goes into moderation
Robin W
Moderatorso are you saying my code does nothing for anonymous users ? It seems to work for logged in users.
am doing further testing later, but your feedback would be useful
April 18, 2020 at 6:53 am #210260In reply to: Notify user when a reply goes into moderation
Clivesmith
ParticipantJust realized that even without your code it comes back as /topic/adelaide-airport-adl/?moderation_pending=7608 never noticed that before
April 18, 2020 at 6:01 am #210258Robin W
Moderatoror this for full name
add_shortcode ('kiki-greet' , 'kiki_greet' ) ; function kiki_greet() { $user = wp_get_current_user() ; echo $user->first_name.' '.$user->last_name ; }April 18, 2020 at 5:58 am #210257Robin W
Moderatorah, sorry forgot that I had done that for you !
add_shortcode ('kiki-greet' , 'kiki_greet' ) ; function kiki_greet() { $user = wp_get_current_user() ; echo $user->display_name ; }and
[kiki-greet]April 18, 2020 at 5:43 am #210256Kikis
Participantadd_shortcode (‘kiki-stats’ , ‘kiki_show_stats’ ) ;
function kiki_show_stats() {
$user_count = count_users();
$users = $user_count[‘total_users’] ;
$topic_count = wp_count_posts(‘topic’);
$topics = $topic_count->publish;
$reply_count = wp_count_posts(‘reply’);
$replies = $reply_count->publish ;
$text = ‘Our ‘.$users.’ users have created ‘.$topics. ‘ topics with ‘.$replies.’ replies.’ ;
echo $text ;
} -
AuthorSearch Results