Skip to:
Content
Pages
Categories
Search
Top
Bottom

Update existing forum by importing file


  • quigli
    Participant

    @quigli

    Hi there,
    I’m new to this buissness and it’s my turn to explore feasibilities for my chemistry project (am a teacher). Finally it’s about generating questions and answers, a good and possible plugin would be of course bbPress. Following questions:
    — is it possible to update an existing bbPress forum by reading data via import?
    — an update to be read in only includes the data of the author, the question and the corresponding answer (keyword: new question resp. answer). Are there existing import options for this? Certainly … there are plugins like woocommerce etc, but they seem to me to be almost too much for the simplicity of the problem.
    Well, thanks for answers, best regards, Rainer

    my project: http://www.chemieaufgaben.ch , bbPress-Version: 2.6.9, wordpress: newest Version

Viewing 3 replies - 1 through 3 (of 3 total)

  • Robin W
    Moderator

    @robin-w

    I doubt this can be solved as posted without custom code.

    You can import files using

    GD bbPress Attachments

    It would be possible to add some fields to the topic and or reply fields – this article explains the principals.

    https://wp-dreams.com/articles/2013/06/adding-custom-fields-bbpress-topic-form/

    Whilst it talks about the functions file, you can also use code snipetts

    Code Snippets

    so for instance if you wanted to try their code you would put all this into a single code snippet

    add_action ( 'bbp_theme_before_topic_form_content', 'bbp_extra_fields');
    function bbp_extra_fields() {
       $value = get_post_meta( bbp_get_topic_id(), 'bbp_extra_field1', true);
       echo '<label for="bbp_extra_field1">Extra Field 1</label><br>';
       echo "<input type='text' name='bbp_extra_field1' value='".$value."'>";
    
       $value = get_post_meta( bbp_get_topic_id(), 'bbp_extra_field2', true);
       echo '<label for="bbp_extra_field1">Extra Field 2</label><br>';
       echo "<input type='text' name='bbp_extra_field2' value='".$value."'>";
    }
    add_action ( 'bbp_new_topic', 'bbp_save_extra_fields', 10, 1 );
    add_action ( 'bbp_edit_topic', 'bbp_save_extra_fields', 10, 1 );
    
    function bbp_save_extra_fields($topic_id=0) {
      if (isset($_POST) && $_POST['bbp_extra_field1']!='')
        update_post_meta( $topic_id, 'bbp_extra_field1', $_POST['bbp_extra_field1'] );
      if (isset($_POST) && $_POST['bbp_extra_field1']!='')
        update_post_meta( $topic_id, 'bbp_extra_field1', $_POST['bbp_extra_field2'] );
    }
    add_action('bbp_template_before_replies_loop', 'bbp_show_extra_fields');
    function bbp_show_extra_fields() {
      $topic_id = bbp_get_topic_id();
      $value1 = get_post_meta( $topic_id, 'bbp_extra_field1', true);
      $value2 = get_post_meta( $topic_id, 'bbp_extra_field2', true);
      echo "Field 1: ".$value1."<br>";
      echo "Field 2: ".$value2."<br>";
    }

    There are reply equivalents, but would need you to specify what should go into topic and what reply


    Robin W
    Moderator

    @robin-w

    again, without knowing exactly what you are after, and alternative would be to have a forum where the teacher asks a question (posts a topic) and students the answer (post a reply).

    If the replies can been seen by all students (and teachers of course), then you could use this plugin to create that solution

    Private groups

    and use the topic permissions to set teachers to have access to both topics and replies, but students to only have access to replies.


    quigli
    Participant

    @quigli

    Hi Robin,
    thanks a lot for your answers, highly appreciated. I will check your solutions.
    rainer

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar