2

How I could put a block of text after my comment form (kinda like politics), I put comments separated from the content (different pages).

  • 1
    could you be more explicit on where you want the text, for all the comments forms ? the same text ? – ropic May 9 '12 at 0:52
3

As megadesk mentioned its hook_form_alter you're after.

Depending on what your more comfortable with you can either add this to your theme in template.php or you can add it to a module. I'm going to assume from now on that you'r putting it into template.php. An infact rather than hook_form_alter we'll use hook_form_FORM_ID_alter.

/*
* Implementation of hook_form_FORM_ID_alter
* 
* Adding text after the comment form
*/

function YOUR_MODULE_NAME_form_comment_form_alter(&$form, &$form_state) {

    //add an I agree to house rules checkbox to the form
    $form['markup'] = array(
                 //This is the text you want to add to the form, using the t() function allows it to be translatable
                '#markup' => t('You can leave us a message using the contact form below.'),
                //By making the weight 20 we insure that it appears at the bottom of the form
                '#weight' => 20,
        );
}

I havnt tested this but that should be what your after... Let me know if you need more.

|improve this answer|||||
0

You could simply use hook_form_alter. http://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_form_alter/7

Here is a little Tutorial for that: http://www.digett.com/blog/05/26/2011/how-theme-comment-form-drupal-7

|improve this answer|||||
  • Answers that are just a little more than a link are not considered answers, on Stack Exchange. – kiamlaluno May 9 '12 at 8:46
  • Sorry, didn't know that. Just wanted to push him in the right direction. I think in the tutorial is all described what he needs. Will try better next time. – megadesk3000 May 9 '12 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.