1

As the title, I try to display a user picture IN comment form. But I'm not familiar with Form function. Below is my code and I don't know how to do next?

function btmentry_form_comment_form_alter(&$form, &$form_state) {
global $user;
$user_picture = user_load($user->picture);

//What should I do next?

}

My purpose is style my comment form as Facebook. Thanks.

1 Answer 1

3

I don't think you need to do coding for your requirement. You can take help from this documentation for same - https://drupal.org/node/22271. It says for D7 :

Enable user pictures for Drupal 7

  1. Navigate to Configuration > People > Account settings.
  2. In the Personalization settings, select Enable user pictures.
  3. For Picture directory type pictures
  4. Under Picture display style, select thumbnail (you can change the size settings
  5. Click "Save configuration".

Next, ensure your user pictures display in your theme. These are enabled by default in Bartik, the default theme of Drupal 7 , so you may have to check this with any new theme you add.

  1. Go to Appearance and click "Settings" for the theme you have enabled as default.
  2. In the Toggle display settings, select User pictures in posts and/or User pictures in comments.
  3. Click "Save configuration".

If your theme doesn't support user pictures, then you should look for bartik & apply same structure for TPL.

2
  • Thanks your reply. But I already did it what you said and it doesn't work. It just show user picture beside the comment and that not what I need.
    – JamesYin
    Commented Dec 10, 2013 at 9:13
  • Thanks your reply. But I already did what you said and it doesn't work. It just show user picture beside the comment and that not what I need. I mean I want to display a user picture beside the comment editor textarea IN <form>...</form> . English not my nature language, pls forgive my poor English. I hope I can clarify my will.
    – JamesYin
    Commented Dec 10, 2013 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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