Advertising Manager Update:
A lot of popular WordPress plugins have not been properly updated for several years now, and contain deprecated code. While the plugin may seem "fine" when its activated in wp-admin, deprecated code often means that it's not functioning properly. This tends to only be noticed when you enable debug mode in the wp-config.php file.
Advertising Manager gives the following error when activated:
Code:
Notice: has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in X:\...\wp-includes\functions.php on line 2722
Notice: has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in X:\...\wp-includes\functions.php on line 2722
Notice: has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in X:\...\wp-includes\functions.php on line 2722
Notice: has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in X:\...\wp-includes\functions.php on line 2722
Notice: has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in X:\...\wp-includes\functions.php on line 2722
Notice: has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in X:\...\wp-includes\functions.php on line 2722
Notice: has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in X:\...\wp-includes\functions.php on line 2722
Notice: has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in X:\...\wp-includes\functions.php on line 2722
These refers to permissions based on user levels (old, wrong) vs permissions based on capabilities (new, correct).
Furthermore, in WordPres 3.4.x, the Advertising Manager drop-down dialog is missing the HTML editor. This does not generate any specific debugging error code, but is obvious to end-users familiar with a properly functioning Advertising Manager plugin.
Where to Download ?
You can either download our ready-to-use files...
How / Where to Download the Files? You'll find the attached file downloads at the bottom of this top post. Files are provided for the convenience of our members. To get download access, simply join the forum as either a Free Member or Premium Member. We don't send spam or sell your email addresses. If you're not sure what to do with .zip or .rar files, see this help post. |
What Was Changed ?
... or you can make the edits yourself.
PART 1 -- To correct the non-functional editor:
At line 40 of \lib\Advman\Template\WP2.7\Editor.php begins control of the editor dropdown menu:
Code:
?> var advman_tb = document.getElementById('ed_toolbar');
if (advman_tb) {
advman_tb.insertBefore(advman_select, document.getElementById('ed_spell'));
/* Below is a Kludge for IE, which causes it to re-read the state of onChange etc. set above. Tut tut tut */
if (navigator.appName == 'Microsoft Internet Explorer') {
advman_tb.innerHTML = advman_tb.innerHTML;
}
}
It needs to be changed to:
Code:
?>
toolTimer = setInterval(awaitToolbar,500);
function awaitToolbar()
{
var advman_tb = document.getElementById('ed_toolbar');
if (advman_tb) {
clearInterval(toolTimer);
advman_tb.appendChild(advman_select);
if (navigator.appName == 'Microsoft Internet Explorer') {
advman_tb.innerHTML = advman_tb.innerHTML;
}
}
}
And then it will appear:
wordpress-admanager-editor.jpg
PART 2 -- To correct the deprecated WP 2.x code:
Lines 15-23 of \lib\Advman\Admin.php refer to user level 8 in multiple places:
Code:
add_object_page(__('Ads', 'advman'), __('Ads', 'advman'), 8, 'advman-manage', array('Advman_Admin','process'));
add_submenu_page('advman-manage', __('Edit Ads', 'advman'), __('Edit', 'advman'), 8, 'advman-manage', array('Advman_Admin','process'));
add_submenu_page('advman-manage', __('Create New Ad', 'advman'), __('Create New', 'advman'), 8, 'advman-create', array('Advman_Admin','create'));
add_options_page(__('Ads', 'advman'), __('Ads', 'advman'), 8, 'advman-settings', array('Advman_Admin','settings'));
} else {
add_menu_page(__('Ads', 'advman'), __('Ads', 'advman'), 8, 'advman-manage', array('Advman_Admin','process'));
add_submenu_page('advman-manage', __('Edit Ads', 'advman'), __('Edit', 'advman'), 8, 'advman-manage', array('Advman_Admin','process'));
add_submenu_page('advman-manage', __('Create New Ad', 'advman'), __('Create New', 'advman'), 8, 'advman-create', array('Advman_Admin','create'));
add_options_page(__('Ads', 'advman'), __('Ads', 'advman'), 8, 'advman-settings', array('Advman_Admin','settings'));
These need to be changed to reflect an admin capability, like activate_plugins():
Code:
add_object_page(__('Ads', 'advman'), __('Ads', 'advman'), 'activate_plugins', 'advman-manage', array('Advman_Admin','process'));
add_submenu_page('advman-manage', __('Edit Ads', 'advman'), __('Edit', 'advman'), 'activate_plugins', 'advman-manage', array('Advman_Admin','process'));
add_submenu_page('advman-manage', __('Create New Ad', 'advman'), __('Create New', 'advman'), 'activate_plugins', 'advman-create', array('Advman_Admin','create'));
add_options_page(__('Ads', 'advman'), __('Ads', 'advman'), 'activate_plugins', 'advman-settings', array('Advman_Admin','settings'));
} else {
add_menu_page(__('Ads', 'advman'), __('Ads', 'advman'), 'activate_plugins', 'advman-manage', array('Advman_Admin','process'));
add_submenu_page('advman-manage', __('Edit Ads', 'advman'), __('Edit', 'advman'), 'activate_plugins', 'advman-manage', array('Advman_Admin','process'));
add_submenu_page('advman-manage', __('Create New Ad', 'advman'), __('Create New', 'advman'), 'activate_plugins', 'advman-create', array('Advman_Admin','create'));
add_options_page(__('Ads', 'advman'), __('Ads', 'advman'), 'activate_plugins', 'advman-settings', array('Advman_Admin','settings'));
And that's it.
________
Need a good web host? — Read our 2018 Review of the Best Web Hosts
Quite often, problems with web sites are caused by having a rotten web host. Worse yet, many hosts try to blame you (the customer) for the problems! So dump that lousy company. Say goodbye to slow sites, unresponsive support techs, and downtime. Find yourself a new host today. Whether you need shared, reseller, VPS, semi-dedicated, cloud, or dedicated hosting, something on our list should be a good upgrade for you.
|
- Did my advice help you? Then become a Premium Member and support this site. - Please Like Us on Facebook | Follow Us on Twitter
- Need a good web host? Ask me for help! Get the shared, VPS, semi-dedicated, cloud, or reseller you need.
|