Hi,
I am trying to embed the user contact form under the node full view.
I have tried with the code field, using this code:

print drupal_get_form('contact-personal-form'); 

or

print drupal_get_form('contact_personal_form'); 

=> got these error messages in both cases:

Notice : Undefined index: contact_personal_form dans drupal_retrieve_form()...
Warning : call_user_func_array() expects parameter 1 to be a valid callback, function 'contact_personal_form' not found or invalid function name dans drupal_retrieve_form() ...

Then I tried using the dynamic field, adding content from widget > contact form.
=> nothing is displayed.

Is it possible at all to display the user contact form via display suite?

(PS: great module, great tutorial videos!)

Comments

swentel’s picture

Status: Active » Closed (fixed)

Well, the contact form is in contact.pages.inc, so you need to make sure you include that file, that's why PHP is complaining about the valid callback problem.
I have no idea why the custom content wouldn't work, but that's rather a ctools problem that something else, but if you'd include that extra file for the custom field, it should work.

Louis Bob’s picture

Thanks a lot for your reply.

I have tried that:

include('/modules/contact/contact.pages.inc'); 
print drupal_get_form('contact-personal-form'); 

The only thing displayed now is "Array".

No big deal anyway, I have given up this solution, but thanks again :)

ytsurk’s picture

this should work (i'm using it in a slightly different way ..)

module_load_include('inc', 'contact', 'contact.pages');
print drupal_render(drupal_get_form('contact_personal_form')); 

better to use the module_load_include function ..
plus you missed the rendering of the form-array,
plus the form key uses underlines instead of dashes .... *argh*

sjdmackay@netscape.net’s picture

hello ytsurk,
thanks for this code.
how can I add node author name into code to complete recipient field on form?
v grateful for any help as contributed modules that should do this (eg Contact Links, Contact Form on node) don't appear to work with DS enabled displays....

bossmac’s picture

hope this will help

<?php

$recipient = user_load($entity->uid);
module_load_include('inc', 'contact', 'contact.pages');
print drupal_render(drupal_get_form('contact_personal_form',$recipient)); 

?>