Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adding “Post To Forum Page”

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

  • LPH2005
    Participant

    @lph2005

    Ugh. I feel like I’m so close to getting this to work.

    Rather than try to create a BP page, a WP page was created with a template. The template contains the following code:

    `<?php
    /*
    Template Name: Question
    */
    ?>

    How To Ask A Great Question And Get It Answered

    Maybe you are stuck on a homework problem or do not understand a particular concept. Don’t panic. TheChemBook.com is a great place to ask your questions.
    First search to see if someone else has asked about the problem. Next, search The Chemistry Text by reading the section on the topic.
    If none of this helps, start a new topic by completing the form below.
    Start with a great headline. Avoid saying, “I’m lost” or “how do I do problem 12?”
    A great headline might be “Determining Significant Figures – Captured Zeros”
    Next, type as much detail as possible, for example, add the exact wording of the problem you are trying to answer.
    Finally, explain the problem and what you have tried.
    The more details you add then the faster someone can help you.
    Teachers are available at irregular intervals, therefore, make sure that you help others with their questions, too.


    —-

    <option value="”>

    <input type="submit" name="submit_topic" id="submit" value="” />
    <input type="button" name="submit_topic_cancel" id="submit_topic_cancel" value="” />

    <?php printf( __( "You are not a member of any groups so you don't have any group forums you can post in. To start posting, first find a group that matches the topic subject you'd like to start. If this group does not exist, why not create a new group? Once you have joined or created the group you can post your topic in that group’s forum.”, ‘buddypress’ ), site_url( BP_GROUPS_SLUG . ‘/create/’ ) ) ?>

    `

    Now – the header has gone wild on the whole site, the buttons at the top right disappear on the WP page for ask-a-question, and NO submit button is showing when logged into the site.

    Link: http://www.thechembook.com/ask-a-question/

    Any thoughts on what is wrong with the code?

    Update: Looking at the source after the page loads – the form is not completing; that is, no `` is being served.


    LPH2005
    Participant

    @lph2005

    Update:

    If I remove, “ and ` ` then the header loads properly, the submit buttons show

    BUT nothing posts to the forums. This is due to form action being incorrect. What should it be?

    Oh so close!

    Update to the update:

    It turns out that the file attachments portion of buddypress plugin aren’t present either. :(


    LPH2005
    Participant

    @lph2005

    OK ! It’s working with the exception of the file attachments (because I removed the do_action lines) but the page now posts to the proper forum. :)

    Here is the code:

    `<?php
    /*
    Template Name: Question
    */
    ?>

    IMPORTANT: This form does not work yet.

    Please do not use this form.

    How To Ask A Great Question And Get It Answered

    Maybe you are stuck on a homework problem or do not understand a particular concept. Don’t panic. TheChemBook.com is a great place to ask your questions.
    First search to see if someone else has asked about the problem. Next, search The Chemistry Text by reading the section on the topic.
    If none of this helps, start a new topic by completing the form below.
    Start with a great headline. Avoid saying, “I’m lost” or “how do I do problem 12?”
    A great headline might be “Determining Significant Figures – Captured Zeros”
    Next, type as much detail as possible, for example, add the exact wording of the problem you are trying to answer.
    Finally, explain the problem and what you have tried.
    The more details you add then the faster someone can help you.
    Teachers are available at irregular intervals, therefore, make sure that you help others with their questions, too.


    —-

    <option value="”>

    <input type="submit" name="submit_topic" id="submit" value="” />
    <input type="button" name="submit_topic_cancel" id="submit_topic_cancel" value="” />

    <?php printf( __( "You are not a member of any groups so you don't have any group forums you can post in. To start posting, first find a group that matches the topic subject you'd like to start. If this group does not exist, why not create a new group? Once you have joined or created the group you can post your topic in that group’s forum.”, ‘buddypress’ ), site_url( BP_GROUPS_SLUG . ‘/create/’ ) ) ?>

    You need to <a href="”>log in or <?php printf( __( ' ‘, ‘buddypress’ ), site_url( BP_REGISTER_SLUG . ‘/’ ) ) ?> to participate in the tutoring area.

    `

    If you see a way to enhance this template then please let me know. The file attachment plugin isn’t working with this page (nor edit a topic) so something obvious is probably missing.

    Hope this helps someone else trying to get a page with a form to post to the forums ….


    LPH2005
    Participant

    @lph2005

    OK. I found duplicate lines of add_action in the forum-attachments-for-buddypress-bp-functions.php.

    I kept these lines (starting around 183) and removed the ones that I apparently added at the top of the php file.

    `add_action(‘groups_forum_new_topic_after’,’bb_attachments_upload_form’);
    add_action(‘groups_forum_new_reply_after’, ‘bb_attachments_upload_form’);
    add_action(‘groups_forum_edit_post_after’, ‘bb_attachments_upload_form’);
    add_action(‘bp_after_group_forum_post_new’, ‘bb_attachments_upload_form’);
    add_action(‘bp_group_after_edit_forum_post’, ‘bb_attachments_upload_form’);
    add_action(‘bp_group_after_edit_forum_topic’, ‘bb_attachments_upload_form’);`

    Now the hooks (do_action) are added to the template file question.php and the page loads properly. Unfortunately – the hook isn’t working – and the file upload function is not being presented.

    Oh – even closer :)


    LPH2005
    Participant

    @lph2005

    @boonebgorges

    This problem is narrowed to the firing of the add_action within forum-attachments-for-buddypress-bp-functions.php.

    A simple function / add_action is loaded in the theme functions.php then it fires on that question.php template. If that sample function/add_action is placed in the forum-attachments-for-buddypress-bp-functions.php file then it does not fire.

    This is the test function placed in the themes functions.php that works. Also added to plugin functions file and it fails.

    `// Test question.php form hook
    function question_fire() {
    echo “Testing the hook”;
    }
    add_action(‘question_after’, ‘question_fire’);`

    I’m about ready to give up. Google searches are not leading me to an answer. And my knowledge is limited.

    Update I hope that didn’t seem negative. I’m at my limit and stretching :)

    OK. So, I know the forum attachment plugin is Boone’s bane … and I love that plugin .. so … press forward.

    I tried my test function in another active plugin (akismet) and it worked AND interestingly the test function works in forum-attachments-for-buddypress.php.


    LPH2005
    Participant

    @lph2005

    Wow. It turns out that the plugin is initialized using bp_init
    `add_action( ‘bp_init’, ‘bp_forum_attachments_init’ );`

    If this is changed to:
    `add_action( ‘init’, ‘bp_forum_attachments_init’ );`

    Then the test function fires.

    But, the add_action for the bb_attachment form does not fire.

    `add_action( ‘question_after’, ‘bb_attachments_upload_form’ );`


    ewebber
    Participant

    @ewebber

    I’d be pretty interested in seeing how you get on with this


    LPH2005
    Participant

    @lph2005

    Everything works except the attachment plugin not working.


    4ella
    Participant

    @4ella

    Very interesting question page and very useful ! I will try that out on my website too , thanks for this !! I am sure that I will come back for some advices , because if your knowledge is limited , mine is far mooooore limited –:)


    ewebber
    Participant

    @ewebber

    @LPH2005 cool thanks, I will give it a go – although for the moment I have moved my form to the bottom of the discussions page and added an anchor tag http://www.yeahhackney.com/forums/#newform

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Adding “Post To Forum Page”’ is closed to new replies.
Skip to toolbar