[wp-hackers] Conditionals not working properly when trying to filter admin_footer_text

Lutz Schröer latz at elektroelch.de
Wed Jul 6 05:29:39 UTC 2011


> 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?

As John pointed out you need to return the footer text in your 
function. In your code you're returning nothing if the condition is not 
fulfilled. You have to use the standard footer text as a parameter for 
the function and return this text if the condition is not fulfilled.


This function should work:

function my_custom_admin_footer_text($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) {
         return $custom_footer_text;
     }

     else {
       return $footer_text;
    }
}


More information about the wp-hackers mailing list