Use popups for links
Update links on following 2 templates to work as popups:
- templates/CRM/Contribute/Page/ContributionRecur.tpl Membership link
- templates/CRM/Member/Form/MembershipView.tpl Recurring Contribution link
Steps to reproduce:
- Create a recurring contribution manually
$result = civicrm_api3('ContributionRecur', 'create', [
'contact_id' => contact_id_of_your_choosing,
'amount' => 50,
'frequency_interval' => 1,
]);
- Create a membership
- Link the recurring contribution to the membership
$result = civicrm_api3('Membership', 'create', [
'id' => id_of_the_membership,
'contribution_recur_id' => id_of_the_recurring_contribution,
]);
Recurring Contribution View (CRM_Contribute_Page_ContributionRecur)
Clicking on the link to membership opens it in a new page
Membership View (CRM_Member_Form_MembershipView)
Clicking on the link to recurring contribution opens it in a new page
Fix
- In templates/CRM/Contribute/Page/ContributionRecur.tpl added class
crm-popup
to the hyperlink in following code block
{if $recur.membership_id}
<tr>
<td class="label">{ts}Membership{/ts}</td>
<td><a class="crm-hover-button" href='{crmURL p="civicrm/contact/view/membership" q="action=view&reset=1&cid=`$contactId`&id=`$recur.membership_id`&context=membership&selectedChild=member"}'>{$recur.membership_name}</a></td>
</tr>
{/if}
- In templates/CRM/Member/Form/MembershipView.tpl added class
crm-popup
to the hyperlink in following code block
{if $contribution_recur_id}
<tr>
<td class="label">{ts}Recurring Contribution{/ts}</td>
<td>
<a class="crm-hover-button" href='{crmURL p="civicrm/contact/view/contributionrecur" q="reset=1&id=`$contribution_recur_id`&cid=`$contactId`&context=contribution"}'>View Recurring Contribution
</a>
</td>
</tr>
{/if}