Affects Version/s: 4.7.14, 4.7.16
Fix Version/s: None
Versioning Impact:Patch (backwards-compatible bug fixes)
Funding Source:Needs Funding
I'm setting up a mailing list in CiviCRM (originally 4.7.14, now 4.7.16) and the latest Wordpress. I created a plugin to call MailingEventSubscribe to add an email to a group, pending clicking the link in a confirmation email.
In Administer->System Settings->CMS Database Integration, I have the base page set to /civicrm. Yet when the mailing list subscribe confirmation is sent, the subscribe.url token uses http://mydomain.com/wp-admin/admin.php?page=CiviCRM&q=civicrm/mailing/confirm&reset=1&etc...
I tracked this down to /CRM/Utils/System/Wordpress.php line 280. The condition is met of is_admin() and !$frontend, so the $base is set to wp-admin/admin.php instead of using the /civicrm/ base.
I can fix this by changing line 246 of CRM/Mailing/Event/BAO/Subscribe.php to set $frontend to 1:
$url = CRM_Utils_System::url('civicrm/mailing/confirm',
TRUE, '', '', 1
But I don't know whether this will cause other problems.
I suspect this will also need to be done where the unsubscribe.url is generated, and maybe elsewhere.
I'm not sure of the cleanest way to address this problem for all cases.