Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewlimaza committed Sep 6, 2022
2 parents e589e10 + 3af3125 commit 42149cf
Show file tree
Hide file tree
Showing 13 changed files with 226 additions and 112 deletions.
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Items to ignore when downloading a zip
pmpro-mailpoet-baner.png export-ignore
.gitattributes export-ignore
.github export-ignore
.wordpress-org export-ignore
README.md export-ignore
Binary file added .wordpress-org/screenshot-1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
![](pmpro-mailpoet-banner.png)


# [Paid Memberships Pro - MailPoet](https://www.paidmembershipspro.com/add-ons/mailpoet-integration/) #
[comment]: # (Generate badges from shields.io, only works for .org plugins to get other stats etc. We'd have to create our own endpoints for Premium plugins)

![WordPress Plugin Downloads](https://img.shields.io/wordpress/plugin/dy/mailpoet-paid-memberships-pro-add-on?style=flat-square) ![Travis (.org)](https://img.shields.io/travis/strangerstudios/MailPoet-Paid-Memberships-Pro-Add-on?style=flat-square) ![License](https://img.shields.io/badge/license-GPL--2.0%2B-red.svg?style=flat-square)

### Welcome to the Paid Memberships Pro - MailPoet GitHub Repository

This integration plugin is designed to support membership sites that use MailPoet to distribute email newsletters for their WordPress site.

With Paid Memberships Pro, you can automatically subscribe members to MailPoet lists or allow them to opt-in to specific MailPoet newsletters.

[MailPoet](https://wordpress.org/plugins/mailpoet/) is an email marketing plugin and service that you can use directly inside your WordPress site. You can use the MailPoet drag-and-drop builder to design custom email newsletters, select subscribers, and distribute emails through the WordPress admin.

For more information please visit [the Add On documentation page for this plugin](https://www.paidmembershipspro.com/add-ons/mailpoet-integration/).

## Installation ##
For detailed installation steps, visit the [documentation](https://www.paidmembershipspro.com/add-ons/mailpoet-integration/) page.

1. Download the current development ZIP file directly: `https://github.com/strangerstudios/MailPoet-Paid-Memberships-Pro-Add-on/archive/dev.zip`

**Please ensure that once installing this version of the plugin to remove `-dev` from the plugin's folder name.**

## Bugs ##
If you find an issue/bug, let us know by [creating a detailed GitHub issue](https://github.com/strangerstudios/MailPoet-Paid-Memberships-Pro-Add-on/issues/new/choose).

## Support ##
This is a developer's portal for Paid Memberships Pro - MailPoet. We do not offer support on this channel. **Any support related questions should be directed to [our website](https://www.paidmembershipspro.com/add-ons/mailpoet-integration/).**

## Contributing to Paid Memberships Pro - MailPoet ##
We encourage and welcome any contribution to Paid Memberships Pro - MailPoet. Please read the [guidelines for contributing](https://github.com/strangerstudios/MailPoet-Paid-Memberships-Pro-Add-on/blob/dev/.github/CONTRIBUTING.md) to this repository.

There are various **ways to the help development** of Paid Memberships Pro - MailPoet:

1. Report [bugs/issues](https://github.com/strangerstudios/MailPoet-Paid-Memberships-Pro-Add-on/issues/new/choose) on GitHub.
2. Work on any issues by submitting a Pull Request.

Here are some ways for **non-developers to contribute** to Paid Memberships Pro - MailPoet:

1. Translate Paid Memberships Pro - MailPoet into your own [language](https://www.paidmembershipspro.com/paid-memberships-pro-in-your-language/).
2. [Purchase a Plus membership](https://www.paidmembershipspro.com/pricing) to help fund ongoing development and bug fixes.
13 changes: 0 additions & 13 deletions css/pmpromailpoet.css

This file was deleted.

9 changes: 8 additions & 1 deletion includes/api-wrapper.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/**
* Get the MailPoet API.
*
Expand Down Expand Up @@ -28,6 +27,14 @@ function pmpro_mailpoet_get_all_lists() {
// We don't have the lists yet. Get them and cache them.
$mailpoet_api = pmpro_mailpoet_get_api();
$cached = empty( $mailpoet_api ) ? array() : $mailpoet_api->getLists();

// Remove trashed lists from results.
foreach( $cached as $key => $list ) {
if ( $list['deleted_at'] ) {
unset( $cached[$key] );
}
}

return $cached;
}

Expand Down
72 changes: 44 additions & 28 deletions includes/opt-in-lists-functions.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/**
* Dispaly additional opt-in list fields on checkout
*
Expand All @@ -20,31 +19,20 @@ function pmpro_mailpoet_additional_lists_on_checkout() {

// Show the opt-in lists at checkout.
?>
<table id="pmpro_mailing_lists" class="pmpro_checkout top1em" width="100%" cellpadding="0" cellspacing="0" border="0">
<thead>
<tr>
<th>
<?php
if ( count( $options['opt-in_lists'] ) === 1 ) {
esc_html_e( 'Join our mailing list.', 'pmpro-mailpoet' );
} else {
esc_html_e( 'Join our mailing lists.', 'pmpro-mailpoet' );
}
?>
</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>
<?php
<div id="pmpro_checkout_box-mailpoet-require-opt-in" class="pmpro_checkout">
<hr />
<h3>
<span class="pmpro_checkout-h3-name">
<?php echo _n( 'Join Our Mailing List', 'Join Our Mailing Lists', count( $options['opt-in_lists'] ), 'mailpoet-paid-memberships-pro-add-on' ); ?>
</span>
</h3>
<div class="pmpro_checkout-fields">
<?php
global $current_user;
pmpro_mailpoet_show_optin_checkboxes( empty( $current_user->ID ) ? null : $current_user->ID );
?>
</td>
</tr>
</tbody>
</table>
?>
</div> <!-- end pmpro_checkout-fields -->
</div> <!-- end pmpro_checkout_box-name -->
<?php
}
add_action( 'pmpro_checkout_after_tos_fields', 'pmpro_mailpoet_additional_lists_on_checkout' );
Expand Down Expand Up @@ -75,12 +63,12 @@ function pmpro_mailpoet_show_optin_list_profile_fields( $user ) {

// Show opt-in lists setting.
?>
<h3><?php esc_html_e( 'Opt-in MailPoet Lists', 'pmpro-mailpoet' ); ?></h3>
<h3><?php esc_html_e( 'Opt-in MailPoet Lists', 'mailpoet-paid-memberships-pro-add-on' ); ?></h3>

<table class="form-table">
<tr>
<th>
<label><?php esc_html_e( 'Mailing Lists', 'pmpro-mailpoet' ); ?></label>
<label><?php esc_html_e( 'Mailing Lists', 'mailpoet-paid-memberships-pro-add-on' ); ?></label>
</th>
<td>
<?php pmpro_mailpoet_show_optin_checkboxes( $user->ID ); ?>
Expand All @@ -91,7 +79,29 @@ function pmpro_mailpoet_show_optin_list_profile_fields( $user ) {
}
add_action( 'show_user_profile', 'pmpro_mailpoet_show_optin_list_profile_fields', 12 );
add_action( 'edit_user_profile', 'pmpro_mailpoet_show_optin_list_profile_fields', 12 );
add_action( 'pmpro_show_user_profile', 'pmpro_mailpoet_show_optin_list_profile_fields', 12 );


/*
Add opt-in Lists to the user profile/edit user page.
*/
function pmpro_mailpoet_show_optin_list_profile_fields_frontend( $user ) {
// If no opt-in lists are set, bail.
$options = pmpro_mailpoet_get_options();
if ( empty( $options['opt-in_lists'] ) ) {
return;
}

// Show opt-in lists setting.
?>
<div class="pmpro_checkout_box-mailpoet-require-opt-in">
<h3><?php echo _n( 'Join Our Mailing List', 'Join Our Mailing Lists', count( $options['opt-in_lists'] ), 'mailpoet-paid-memberships-pro-add-on' ); ?></h3>
<div class="pmpro_member_profile_edit-fields">
<?php pmpro_mailpoet_show_optin_checkboxes( $user->ID ); ?>
</div> <!-- end pmpro_member_profile_edit-fields -->
</div> <!-- end pmpro_checkout_box_mailpoet-require-opt-in -->
<?php
}
add_action( 'pmpro_show_user_profile', 'pmpro_mailpoet_show_optin_list_profile_fields_frontend', 12 );

/**
* Show opt-in mailing lists checkboxes.
Expand Down Expand Up @@ -131,12 +141,18 @@ function pmpro_mailpoet_show_optin_checkboxes( $user_id = null ) {
}

// Show opt-in lists setting.
echo '<div class="pmpro_checkout-field pmpro_checkout-field-checkbox_grouped">';
echo '<input type="hidden" name="pmpro_mailpoet_opt-in_lists_showing" value="1" />';
echo '<ul>';
foreach ( $optin_lists as $optin_list ) {
$checked = in_array( $optin_list['id'], $user_list_ids );
echo '<li>';
echo "<input type='checkbox' name='pmpro_mailpoet_opt-in_lists[]' value='" . esc_attr( $optin_list['id'] ) . "' id='pmpro_mailpoet_opt-in_lists_" . esc_attr( $optin_list['id'] ) . "'" . checked( $checked, true, false ) . '>';
echo "<label for='pmpro_mailpoet_opt-in_lists_" . esc_attr( $optin_list['id'] ) . "' class='pmpromailpoet-checkbox-label'>" . esc_html( $optin_list['name'] ) . '</label><br>';
echo " <label for='pmpro_mailpoet_opt-in_lists_" . esc_attr( $optin_list['id'] ) . "' class='pmpro_label-inline pmpromailpoet-checkbox-label'>" . esc_html( $optin_list['name'] ) . '</label>';
echo '</li>';
}
echo '</ul>';
echo '</div>';
}

/**
Expand Down
Loading

0 comments on commit 42149cf

Please sign in to comment.