[wp-hackers] Conditionals not working properly when trying to filter admin_footer_text
Kim Parsell
kparsell-wp at kpdesign.net
Tue Jul 5 23:36:21 UTC 2011
I'm trying to filter the admin footer text just for the Subscriber role
using admin_footer_text.
I'm using conditionals to target Subscribers and version 3.2. The code
I'm using is:
---------------------------------------------------------
function my_custom_admin_footer_text() {
global $blog, $blog_id, $current_user, $custom_footer_text, $id,
$wp_db_version;
$custom_footer_text = '<span id="footer-thankyou">'.__('Powered by
<a title="WordPress" href="http://wordpress.org/">WordPress</a>').'</span>';
/* Let's change the footer text for Subscribers in WordPress 3.2 or
higher */
if ((!current_user_can('edit_posts') ||
!current_user_can_for_blog($blog_id, 'edit_posts')) && $wp_db_version >=
18226) {
echo $custom_footer_text;
}
}
add_filter('admin_footer_text', 'my_custom_admin_footer_text');
---------------------------------------------------------
The results are:
- In version 3.1, for all roles, the footer text for every role is
getting whacked completely, rather than displaying the default footer
text from admin-footer.php. Conditional indicates db version is WP 3.2
or higher, so 3.1 shouldn't get touched.
- In version 3.2, the footer text is being replaced for Subscribers, but
is whacked completely for all other roles.
Is there an issue with using conditionals when trying to filter
admin_footer_text? If not, any ideas on why the above code isn't
functioning properly?
Thanks in advance.
Kim
More information about the wp-hackers
mailing list