Robin W (@robin-w)

Forum Replies Created

Viewing 25 replies - 5,526 through 5,550 (of 14,283 total)
  • @robin-w

    Moderator

    hmmm…ok bbpress can have issues on local sites, which is what I hoped then above would clear.

    so ‘Viewing the default pages and ‘Hello World’ post is OK though, if any help. ‘ is that same as before, or is helped by the above and was wrong before?

    @robin-w

    Moderator

    ok, they’ve done it by a function by the look of it.

    so try this

    add_action ('bbp_theme_before_topic_started_by' , 'rew_reply_author' , 10 ) ;
    
    function rew_reply_author () {
    	$reply_id = bbp_get_topic_last_reply_id () ;
    	echo '<span class="bbp-reply-author">'.bbp_get_reply_author_link( array( 'post_id' => $reply_id, 'type' => 'both', 'size' => 14 ) ) ;
    }

    Put this in your child theme’s function file – or use

    Code Snippets

    then come back and let me know where this appears, we might need to adjust

    @robin-w

    Moderator

    just overwrite your code with the above – that code works

    @robin-w

    Moderator

    I just amended the above, so try it again in case you loaded the wrong version !

    @robin-w

    Moderator
    add_action( 'bbp_theme_before_reply_form_content', 'rew_additional_field' );
    function rew_additional_field($post){
    	?>
    	<select name="rew_additional_field" id="rew_additional_field">
    		<option value="enqury">Enquiry</option>
    		<option value="complaint">Complaint</option>
    		<option value="feedback">Feedback</option>
    	</select>
    	
    	
    	<select name="rew_additional_field_2" id="rew_additional_field_2">
    		<option value="enqury2">Enquiry2</option>
    		<option value="complaint2">Complaint2</option>
    		<option value="feedback2">Feedback2</option>
    	</select>
    	<?php
    }
     
    
    add_action('bbp_new_reply_post_extras', 'rew_save_additional_field');
    
    function rew_save_additional_field($reply_id){ 
        global $post;
        if(isset($_POST["rew_additional_field"])) {
            update_post_meta ($reply_id, 'rew_additional_field', $_POST["rew_additional_field"]) ;
    	}
        if(isset($_POST["rew_additional_field_2"])) {
            update_post_meta ($reply_id, 'rew_additional_field_2', $_POST["rew_additional_field_2"]) ;
    	}
    }
    
    add_action('bbp_theme_before_reply_content', 'rew_show_additional_field');
    
    function rew_show_additional_field () {
    $reply_id = bbp_get_reply_id();
    	$field = get_post_meta($reply_id, 'rew_additional_field', true);
    	if (!empty ($field)) {
    		echo "Type: ". ucfirst($field)."<br>"; 
    	}	
    	$field_2 = get_post_meta($reply_id, 'rew_additional_field_2', true);
    	if (!empty ($field_2)) {
    		echo "Type: ". ucfirst($field_2)."<br>";  
    	}
    }

    @robin-w

    Moderator

    so does that not work ?

    @robin-w

    Moderator

    ok, painting bedroom windows so I’ll come back later with a response 🙂

    @robin-w

    Moderator

    so have you added Reply To: Topic name to the template ?

    @robin-w

    Moderator

    easier to start again

    this works

    add_action( 'bbp_theme_before_reply_form_content', 'rew_additional_field' );
    function rew_additional_field($post){
    	?>
    	<select name="rew_additional_field" id="rew_additional_field">
    		<option value="enqury">Enquiry</option>
    		<option value="complaint">Complaint</option>
    		<option value="feedback">Feedback</option>
    	</select>
    	<?php
    }
     
    
    add_action('bbp_new_reply_post_extras', 'rew_save_additional_field');
    
    function rew_save_additional_field($reply_id){ 
        global $post;
        if(isset($_POST["rew_additional_field"])) {
            update_post_meta ($reply_id, 'rew_additional_field', $_POST["rew_additional_field"]) ;
    	}
    }
    
    add_action('bbp_theme_before_reply_content', 'rew_show_additional_field');
    
    function rew_show_additional_field () {
    $reply_id = bbp_get_reply_id();
      $field = get_post_meta($reply_id, 'rew_additional_field', true);
      if (!empty ($field)) {
    	echo "Type: ". ucfirst($field)."<br>";  
      }
    }

    @robin-w

    Moderator

    quickest way is

    add_filter(  'gettext',  'rew_bbpress_translate', 20 , 3  );
    
    function rew_bbpress_translate( $translated, $text, $domain ) {
    	if ($domain == 'bbpress') {
         $words = array(
                            
                            'Website' => 'WhatsApp no'
                 );
         $translated = str_replace(  array_keys($words),  $words,  $translated );
    	}
    
         return $translated;
    }

    Put this in your child theme’s function file – or use

    Code Snippets

    @robin-w

    Moderator

    ok, so the threads above have one poster asking about having this as a single forum, and another about not having ‘no forum’

    what are you wishing to achieve?

    @robin-w

    Moderator

    refresh my memory, when does this come up ?

    I don’t see a default form in my forums list

    @robin-w

    Moderator

    ok, I’ve ONLY edited this to correct syntax, but try it and then come back

    add_action( 'bbp_theme_before_reply_form_content', 'so_additional_content' );
    function so_additional_content($post){
    	$reply_id = bbp_get_reply_id();
        $meta_element_class = get_post_meta($reply_id, 'custom_element_grid_class_meta_box', true); //true ensures you get just one value instead of an array
         echo '<label>Choose the size of the element :  </label>' ;
    	?> 
        <select name="custom_element_grid_class" id="custom_element_grid_class">
          <option value="normal" <?php selected( $meta_element_class, 'normal' ); ?>>normal</option>
          <option value="square" <?php selected( $meta_element_class, 'square' ); ?>>square</option>
          <option value="wide" <?php selected( $meta_element_class, 'wide' ); ?>>wide</option>
          <option value="tall" <?php selected( $meta_element_class, 'tall' ); ?>>tall</option>
        </select>'
        <?php
    }
     
    
     
    add_action('bbp_new_reply_post_extras', 'so_save_metabox');
    
    function so_save_metabox(){ 
        global $post;
        if(isset($_POST["custom_element_grid_class"])) {
             //check the capability: if ( !current_user_can( 'edit_post', $post->ID ))  return $post->ID;
            $meta_element_class = $_POST['custom_element_grid_class'];
            //END OF UPDATE
    
            update_post_meta($reply_id, 'custom_element_grid_class_meta_box', $meta_element_class);
            //print_r($_POST);
    		
        }
    }
    
    add_action('bbp_theme_before_reply_content', 'so_show_metabox');
    
    function so_show_metabox() {
      $meta_element_class = get_post_meta($reply_id, 'custom_element_grid_class_meta_box', true);
      // the problem is "Field 1" appear in every reply post
      echo "Field 1: ". $meta_element_class."<br>";  
    }

    @robin-w

    Moderator

    great

    @robin-w

    Moderator

    ok, then suggest you do that 🙂

    @robin-w

    Moderator

    unless you are running a very highly spec’d server and your users can’t wait another nano second, I would not worry about only loading on bbpress pages.

    @robin-w

    Moderator

    none of it ?

    @robin-w

    Moderator

    that only matters if you are doing it for say a theme. there probably is another way, but that is WordPress not bbpress, so if you want to pursue, try the main WordPress forums.

    @robin-w

    Moderator

    1. Download the plugin from this url :

    Fix forum


    Then upload to your site and activate

    3. Create a page called anything and put this shortcode in it
    [fix-topics]
    and publish

    4. Go to this page and you will see a drop down, use the drop down to select ‘run’ and click submit

    That should do it

    @robin-w

    Moderator

    Great – I do have a plugin that will do that, but if you are happy to do that manually then fine.

    Are replies all ok ?

    @robin-w

    Moderator

    not that I can see easily

    @robin-w

    Moderator

    ok, so final test, and then I’ll be happy I know what needs doing (one we did earlier)

    go into
    dashboard>topics> and select one topic to edit, and just hit update.
    DON’T set the forum.

    @robin-w

    Moderator

    I’d suggest you just add redirect to htaccess

    @robin-w

    Moderator

    can you answer this question

    Then go back to
    dashboard>topics and see if the forums show in the main list

    @robin-w

    Moderator

    so did you reset forums as in

    dashboard>tools>forums>reset forums

Viewing 25 replies - 5,526 through 5,550 (of 14,283 total)