WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: Co-Authors Plus] Real-Time Search to Add Authors Platform Compatibility?

[Resolved] [Plugin: Co-Authors Plus] Real-Time Search to Add Authors Platform Compatibility?

  • First of all, really great work – using an author taxonomy is a very nice design. And the real-time search is definitely an improvement over the dropdown.

    The bad news: it only works on some installations — not others. I’ve tested this plugin on several installs with the most current version of WordPress (3.2.1) all default JS files and all other plugins turned off with the same exact theme running. All the other function calls work well with the plugin.

    The only variance I can see is the LAMP Stack. Here’s what works and what doesn’t:

    1) Commercial Host: WORKS
    PHP: 5.2.17
    MySQL: 5.0.92

    2) MAMP localhost: DOESN’T WORK
    PHP: 5.2.6
    MySQL: 5.0.41

    3) Windows NT: DOESN’T WORK
    PHP: 5.2.6
    MySQL: 5.0.51a

    Wondering if the plugin needs MySQL 5.0.92 for it to run OR an older version of PHP?

    Would really like to understand the variance and happy to help troubleshoot.

    Thanks!

    http://wordpress.org/extend/plugins/co-authors-plus/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Actually, it doesn’t seem to be a LAMP configuration.

    After looking around a bit it doesn’t appear that all of the users are added to the author taxonomy on activation so, the search index is incomplete.

    Guys, any thoughts on that? It looks like the activation hook is empty.

    Ah. it looks like if you have a custom user role the search won’t pull that user even if they have the capability to publish or edit posts.

    looks like a limitation of get_users() — can I suggest a modification that I tested and seems to work?

    remove the ‘who’ parameter of get_users(), loop through the returned array and check for a particular capability like ‘edit_posts’ using user_can().

    not particularly elegant but here’s my edit to search_authors():

    if ( function_exists( 'get_users' ) ) {
    	$search = sprintf( '*%s*',  $search ); // Enable wildcard searching
    	$temp_authors = get_users( array( 'search' => $search, 'fields' => $author_fields ) );
    	foreach ( $temp_authors as $author ) {
    		if ( user_can( $author->ID, 'edit_posts' ) ) {
    			$authors[] = $author;
    		}
    	}
    }

    even if it doesn’t make it into the plugin, I hope this helps someone mod the plugin for custom roles.

    Plugin Author Daniel Bachhuber

    @danielbachhuber

    @havahula Apologies on the late response, we’ve been somewhat lax on the development aspect of this.

    Ah. it looks like if you have a custom user role the search won’t pull that user even if they have the capability to publish or edit posts.

    looks like a limitation of get_users() — can I suggest a modification that I tested and seems to work?

    remove the ‘who’ parameter of get_users(), loop through the returned array and check for a particular capability like ‘edit_posts’ using user_can().

    I’ve created a Trac ticket for improve the AJAX search: #1434. Want to take a swing at preparing a patch?

    hey Daniel,

    thanks for getting back to me. no worries — sorry for my delay in getting back to you as well. sure, i’ll take a swing — i had done some work already to modify it for the situation i was working through.

    Plugin Author Daniel Bachhuber

    @danielbachhuber

    Sounds great. I closed the other ticket so feel free to open a new one for it. Let me know if you have any questions or want feedback.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] [Plugin: Co-Authors Plus] Real-Time Search to Add Authors Platform Compatibility?’ is closed to new replies.