After updating CiviCRM from 4.7.14 to 4.7.21, I got a strange problem. My newsletter subscription form (a profile with a name and email field) lost its Submit button. The submit button is missing from the HTML, while in 4.7.14 it was there.
The profile is included in the page via a Wordpress shortcode: [civicrm component="profile" gid="22" mode="create" hijack="0"]
I'm using Wordpress 4.8. PHP is 5.6.30. As far as I can see, I don't have any related errors/notices in either the CiviCRM or the Wordpress logs.
I have some template overrides but nothing that seems related to that profile.
Does anyone have any idea why the Submit button would not be there? Anything I can do to debug this?
UPDATE:
After I asked this question yesterday, today I had the brilliant idea to look at the template file responsible for outputting the profile. I wonder why it took me a day to think of this. Anyways.
The template file in question is /civicrm/templates/CRM/Profile/Form/Dynamic.tpl. Inside it there is the following section responsible for the buttons:
{if ($action eq 1 and $mode eq 4 ) or ($action eq 2) or ($action eq 8192)}
{if $action eq 2 and $multiRecordFieldListing}
{include file="CRM/Profile/Page/MultipleRecordFieldsListing.tpl" showListing=true}
{assign var=floatStyle value='float:right'}
{/if}
<div class="crm-submit-buttons" style='{$floatStyle}'>
{include file="CRM/common/formButtons.tpl"}{if $isDuplicate}<span class="crm-button">{$form._qf_Edit_upload_duplicate.html}</span>{/if}
<a class="button cancel" href="{$cancelURL}">
<span>
<i class="crm-i fa-times"></i>
{ts}Cancel{/ts}
</span>
</a>
</div>
{/if}
So apparently I need to have the correct $action and/or $mode. From the top of the file I learn about $mode:
{* Profile forms when embedded in CMS account create (mode=1) or
cms account edit (mode=8) or civicrm/profile (mode=4) pages *}
So for me $mode is 4. But what is $action? After half an hour of googling, I found this answer which referred me to this file.
From this I gather that in my situation $action's value should be 1 (add) or 2 (update). But putting {$debug} in the template file shows that $action is 1024 (preview). This doesn't make sense.
Does anyone have any ideas why $action isn't properly set?