Viewing 2 replies - 1 through 2 (of 2 total)
  • Matt Wiebe

    (@mattwiebe)

    Kevin: your plugin is making a faulty assumption, leading to bios only being shown to people logged into the WP install. In the KLVisualBiographyEditor::display_filters(), callback, you’re checking for current_user_can(‘contributor’) to use the_content filter on the bio. Problem is, this is not checking if the user whose bio is being displayed is a contributor, but rather, if the person who is currently viewing the site is an editor.

    If you are wanting to make this check, you need to pass the second $user_id parameter from the get_the_author_description filter and check the capability on that user. But I don’t think you even need to bother – what does it matter on the display side?

    Finally, you may want to reconsider merely applying the the_content filters. Many plugins add additional content (such as social media buttons) to that filter, which you’ll wind up with in this case. It would be better to simply see what the relevant functions running on the_content are, and just running them directly. In this case, wptexturize, convert_chars, and wpautop should do the trick.

    Plugin Author Kevinleary.net

    (@kevinlearynet)

    Thanks for the great suggestions Matt,

    I’ve taken this into account and have just rolled out a v1.4 update to the plugin that includes the following changes:

    • Switches the current_user_can('contributor') to current_user_can('edit_posts')
    • Remove the display_filters() function altogether to drop that current_user_can('contributor') call, which was definitely a mistake and shouldn’t have been in there.
    • Replace the filter call to display_filters() with the 3 filters you suggested: wptexturize(), wpautop() and convert_chars()
    • Added a nice shout out thanking you in the readme.txt Changelog section.

    These updates will fix the issues mentioned above by hauntingreview.

    Also, I wanted to mention that a few months ago I used your handy custom post types class from Somadesign.ca. Thanks for taking the time to put that together, and again for the feedback.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Visual Editor Biography] Bio only shows logged in’ is closed to new replies.