Comments (2)
Fabio, thanks for the heads up here. We were doing other work on the addon and merged some of this in in this pull request here: d188663
I'm still using the old ->data['entries'] method if you have < 100 lists just to be sure to not disrupt other users. Although the foreach method does work for < 100 lists as well. Thanks again.
from pmpro-aweber.
Resolved!
I have changed this piece of code in pmpro-aweber.php from:
function pmproaw_option_users_lists()
{
global $pmproaw_lists;
$options = get_option('pmproaw_options');
if(isset($options['users_lists']) && is_array($options['users_lists']))
$selected_lists = $options['users_lists'];
else
$selected_lists = array();
if(!empty($pmproaw_lists))
{
echo "<select multiple='yes' name=\"pmproaw_options[users_lists][]\">";
foreach($pmproaw_lists as $list)
{
echo "<option value='" . $list['id'] . "' ";
if(in_array($list['id'], $selected_lists))
echo "selected='selected'";
echo ">" . $list['name'] . "</option>";
}
echo "</select>";
}
else
{
echo "No lists found.";
}
}
function pmproaw_option_double_opt_in()
{
$options = get_option('pmproaw_options');
?>
<select name="pmproaw_options[double_opt_in]">
<option value="0" <?php selected($options['double_opt_in'], 0);?>>No</option>
<option value="1" <?php selected($options['double_opt_in'], 1);?>>Yes</option>
</select>
<?php
}
function pmproaw_option_memberships_lists($level)
{
global $pmproaw_lists;
$options = get_option('pmproaw_options');
$level = $level[0]; //WP stores this in the first element of an array
if(isset($options['level_' . $level->id . '_lists']) && is_array($options['level_' . $level->id . '_lists']))
$selected_lists = $options['level_' . $level->id . '_lists'];
else
$selected_lists = array();
if(!empty($pmproaw_lists))
{
echo "<select multiple='yes' name=\"pmproaw_options[level_" . $level->id . "_lists][]\">";
foreach($pmproaw_lists as $list)
{
echo "<option value='" . $list['id'] . "' ";
if(in_array($list['id'], $selected_lists))
echo "selected='selected'";
echo ">" . $list['name'] . "</option>";
}
echo "</select>";
}
else
{
echo "No lists found.";
}
}
to:
function pmproaw_option_users_lists()
{
global $pmproaw_lists;
$options = get_option('pmproaw_options');
if(isset($options['users_lists']) && is_array($options['users_lists']))
$selected_lists = $options['users_lists'];
else
$selected_lists = array();
if(!empty($pmproaw_lists))
{
echo "<select multiple='yes' name=\"pmproaw_options[users_lists][]\">";
$pmproaw_aweber_api = new AWeberAPI(PMPROAW_CONSUMER_KEY, PMPROAW_CONSUMER_SECRET);
$pmproaw_aweber_account = $pmproaw_aweber_api->getAccount($options['access_key'], $options['access_secret']);
foreach($pmproaw_aweber_account->lists as $offset => $list)
{
echo "<option value='" . $list->id . "' ";
if(in_array($list->id, $selected_lists))
echo "selected='selected'";
echo ">" . $list->name . "</option>";
}
echo "</select>";
}
else
{
echo "No lists found.";
}
}
function pmproaw_option_double_opt_in()
{
$options = get_option('pmproaw_options');
?>
<select name="pmproaw_options[double_opt_in]">
<option value="0" <?php selected($options['double_opt_in'], 0);?>>No</option>
<option value="1" <?php selected($options['double_opt_in'], 1);?>>Yes</option>
</select>
<?php
}
function pmproaw_option_memberships_lists($level)
{
global $pmproaw_lists;
$options = get_option('pmproaw_options');
$level = $level[0]; //WP stores this in the first element of an array
if(isset($options['level_' . $level->id . '_lists']) && is_array($options['level_' . $level->id . '_lists']))
$selected_lists = $options['level_' . $level->id . '_lists'];
else
$selected_lists = array();
if(!empty($pmproaw_lists))
{
echo "<select multiple='yes' name=\"pmproaw_options[level_" . $level->id . "_lists][]\">";
$pmproaw_aweber_api = new AWeberAPI(PMPROAW_CONSUMER_KEY, PMPROAW_CONSUMER_SECRET);
$pmproaw_aweber_account = $pmproaw_aweber_api->getAccount($options['access_key'], $options['access_secret']);
foreach($pmproaw_aweber_account->lists as $offset => $list)
{
echo "<option value='" . $list->id . "' ";
if(in_array($list->id, $selected_lists))
echo "selected='selected'";
echo ">" . $list->name . "</option>";
}
echo "</select>";
}
else
{
echo "No lists found.";
}
}
from pmpro-aweber.
Related Issues (20)
- Illegal string offset 'id' HOT 1
- Users are not changed to new level HOT 2
- Uncaught Error: Class 'AWeberAPI' not found on AfiliateWP regististration? HOT 3
- User email Update
- Can't save changes without having chosen an All Users List HOT 1
- Subscriber update fails in `pmproaw_subscribe()` HOT 1
- Update plugin for translation
- API Rate Limit Errors during Expire Memberships
- Version string not updated since v0.2 HOT 1
- Enhancement: Add support for Tags HOT 1
- PHP8 Errors Originating from the AWeber Library
- Setting unsubscribe from level change to `No` still removes members from the list if they expire HOT 1
- Feature Request: Send the same custom fields through as we do in MC
- Enhancement: Allow Multiselect fields to be unselected
- Unable to connect to the AWeber API HOT 3
- Name Unknown HOT 3
- Incorrect handling of Create Subscriber response in Aweber API
- No exception handling in pmproaw_profile_update() HOT 1
- double opt-in HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pmpro-aweber.