i have a plugins with just a single php code
<?php
/*
Plugin Name: COinS Metadata Exposer
Plugin URI: http://www.zotero.org
Description: Makes your blog readable by Zotero and other COinS interpreters.
Version: 0.5
Author: Sean Takats - Center for History and New Media
Author URI: http://chnm.gmu.edu
Copyright 2007 Sean Takats (email: <a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c9babda8a2a8bdba89aea4bce7acadbc">[email protected]</a>)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
add_filter('the_content', 'coinsify_the_content');
function coinsify_the_content($content)
{
foreach((get_the_category()) as $cat) {
$cats = $cats . "&rft.subject=" . urlencode($cat->cat_name);
} ?>
<span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&rfr_id=info%3Asid%2Focoins.info%3Agenerator&rft.title=<?php echo(urlencode(get_the_title())); ?>&rft.aulast=<?php echo(urlencode(get_the_author_lastname())); ?>&rft.aufirst=<?php echo(urlencode(get_the_author_firstname())); echo $cats; ?>&rft.source=<?php echo(urlencode(get_bloginfo('name'))); ?>&rft.date=<?php the_time('Y-m-d'); ?>&rft.type=blogPost&rft.format=text&rft.identifier=<?php the_permalink(); ?>&rft.language=English"></span>
<?php
return $content;
}
?>
but the plugins causing error with following code
<br /> Deprecated: get_the_author_lastname started <strong> deprecated </strong> since version 2.8.0!
Use get_the_author_meta ('last_name'). in /home/dgrou/wp-includes/functions.php on line 4861 <br />
Mike, <br /> Deprecated: get_the_author_firstname started <strong> deprecated </strong> since version
2.8.0! Use get_the_author_meta ('first_name'). in /home/dgrou//wp-includes/functions.php on line 4861
<br />
Can someone help which line i should replace the deprecated code? or the full fixed code would be nice
thank you
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Note: I’m not simply giving you the full fixed code, but the line in which you need to make the changes is the one with the <span class="Z3988" ...>.
So yes, both get_the_author_firstname() and get_the_author_lastname() have been deprecated and as said in the error, you should instead be using get_the_author_meta().
And in the coinsify_the_content() function, just find and:
-
Replace the
get_the_author_firstname()withget_the_author_meta( 'first_name' ). -
Replace the
get_the_author_lastname()withget_the_author_meta( 'last_name' ).
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0