Author box description from incorrect user
-
When using Simple author box (SAB) as a widget, the description of the author is always the current post author’s description, even when the widget has a different user selected.
For example, consider the following situation:
User ID | Display Name | Description
1 | John | I am the editor of this publication.
2 | Mary | A freelancer interested in technology
3 | Jane | Enviromental journalistIf John is the author of a article, where Mary and Jane are contribute and therefore we want to have their author boxes on the page, and make it via the SAB widget (SiteOrigin or similar), the resulting author boxes are something like:
—
[Picture of Mary]
Mary
I am the editor of this publication.
—
[Picture of Jane]
Jane
I am the editor of this publication.
—
Of course Mary and Jane should have their own descriptions shown.The problem is in the file “template-sab.php” on line 28:
$author_description = apply_filters( 'sab_user_description', get_the_author_meta( 'description' ), $sabox_author_id );
where the function get_the_author_meta() should have another attribute $sabox_author_id. The correct row would be$author_description = apply_filters( 'sab_user_description', get_the_author_meta( 'description' , $sabox_author_id ), $sabox_author_id );
I made a temporary fix with this line of code in my functions.php:
add_filter( 'sab_user_description', 'my_fix_simple_author_box_description_fix', 5 , 2); function my_fix_simple_author_box_description_fix($description, $user_id = false) { if ( !$user_id ) return $description; return get_the_author_meta( 'description' , $user_id); }
I am using the PRO version of the plugin, but I think this involves also the free version.
Hopefully this helps other users and the developers.
- The topic ‘Author box description from incorrect user’ is closed to new replies.