Support » Plugin: Contact Form DB » cfdb is not saving page title and url

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author Michael Simpson


    This only applies to new submissions saved after the options are set.

    I know that. but still…not working.
    My pages arent something special, they are pretty much regular page templates.

    what am i doing wrong? or am experiencing some kind of bug?

    From which tags/meta tags he is retrieving its data?

    Plugin Author Michael Simpson


    The “Page Title” and “Page URL” fields are captured from the Contact Form 7 form submission by calling that’s plugin’s functions:

    wpcf7_special_mail_tag('', '_post_title', '');
    wpcf7_special_mail_tag('', '_post_url',  '');

    Which ultimately references

    get_permalink( $post->ID )

    So what can be the problem that some pages (custom pages) refuses to collect that info?
    For examole, i have at the same page 2 forms:
    1. sticky form that is cross site – page title and url are NOT being submitted.
    2. main page form is getting all the info.

    Link to the example page
    Although its in hebrew, tou can see at the right corner the problematic form, and on the way to the bottom the working form.

    What am i missing???

    Plugin Author Michael Simpson


    Do you see a Page Title and Page Title field in the form submission but they are empty? In that case CF7 is not providing values for those in the submission. You can also try something like: Capturing Form Page URL

    The if the Page Title and Page Title columns do not appear at all in the CFDB submission, then it seems like the Option to collect those values ins not turned or or not recognized as on.

    the fields aren’t in the form submission, not at the page that delivers this data and not in the form that doesn’t.
    so i have inserted hidden field with these names but still NOTHING.

    Is there a solution for my problem?

    Plugin Author Michael Simpson


    1. sticky form that is cross site – page title and url are NOT being submitted.

    Would you elaborate on what is a “sticky form that is cross site” and how that is set up?

    The sticky form is a little window on the right bottom corner of the screen with a CF7 form. its nothing special and no special settings, just a regular CF7 form.
    you can see here a page with both of forms (regular and the sticky)

    Plugin Author Michael Simpson


    I don’t have an answer as to why the sticky form does not have the data. I suppose that when CFDB asks CF7 for that information (by calling its function wpcf7_special_mail_tag), CF7 does not provide a value in that situation.

    But the problem accures also on a regular page with a simple CF7 form
    like this one, this is the homepage that have a form at the bottom:

    Im sure that something is missing, please try to resolve that problem.

    I understand that there is no solution for that problem/bug?!

    Plugin Author Michael Simpson


    I don’t have a solution. I am unable to duplicate this issue.

    Hi @shafshaf, I believe the problem is this:

    Note that the [_post_*] tag has value only when you put the contact form into content of a post or a page. They are not available if the contact form is put inside a sidebar widget.

    Contact Form 7 Special Mail Tags

    As Michael explained, if the options are set to “true” in the plugin settings, CFDB calls the page title and URL from:

    wpcf7_special_mail_tag('', '_post_title', '');
    wpcf7_special_mail_tag('', '_post_url',  '');

    In your case, these aren’t generated because neither form is in the loop. The one at the bottom of the page is in the footer, and you mentioned that the sticky box is placed in a sidebar widget .

    Getting the page URL is easier than the title. Simply add this to your functions file or custom plugin:

    function set_cf7_page_url($formData) {
    	$formData->posted_data['page-url'] = $_SERVER['HTTP_REFERER'];
    	return $formData;
    add_filter('cfdb_form_data', 'set_cf7_page_url');

    This will work for all your CF7 forms, so you can set that option in the plugin settings to “false.”

    To save the post/page title of forms placed outside of the loop, the only thing I was able to figure out was installing the Contact Form 7 Dynamic Text Extension plugin.

    Once installed, add this to both the footer and sidebar forms (in the CF7 edit screen):

    [dynamichidden page-title "CF7_get_post_var key='title'"]

    CFDB will automatically save the submitted data, but note that the column headings won’t be the same when you view the data (“Page Title” for forms that don’t have the dynamic hidden field when the plugin option is set to “true,” versus “page-title” for forms using the dynamic hidden field.) To make everything uniform, you could add the dynamic hidden field to all your forms and set the plugin option to “false”.

    And if you’re using the dynamic text plugin, then you could just add a dynamic hidden field for URLs to all your forms, and you wouldn’t need to add the code snippet above to the functions file.

    Hope this helps!

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘cfdb is not saving page title and url’ is closed to new replies.