WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Quotes Collection] Patch, for Display All by Author

[Plugin: Quotes Collection] Patch, for Display All by Author

  • I was hoping to find a way to display all of my quotes but listing them by author instead of by quote. To solve the problem I made a patch that creates a new shortcode option [quote|allbyauthor]

    I have tested the code and have it working on my site if you want to check it out here: http://www.rockerssoft.org/brockers/vault-quotes

    Here is the patch:

    --- quotes-collection/quotes-collection.php	2010-12-02 22:52:35.000000000 -0600
    +++ quotes-collection-new/quotes-collection.php	2011-03-17 10:15:22.510093789 -0500
    @@ -801,9 +801,12 @@
     	if(!$source) {
     		$sql .= "ORDER BY quote";
     	}
    -	else if($source == "Anonymous" || $source == "anonymous") {
    +	elseif($source == "Anonymous" || $source == "anonymous") {
     		$sql .= "AND (author IS NULL OR author = '' OR author ='Anonymous')";
     	}
    +	elseif($source == "ALLBYAUTHORS") {
    +		$sql .= "ORDER BY author";
    +	}
     	else {
     		$sql .= "AND (source = '{$source}' OR author = '{$source}')";
     	}
    @@ -877,6 +880,10 @@
       if ($start !== FALSE) {
         $text = preg_replace( "/\[quote\|all\]/ie", "quotescollection_displayquotes()", $text );
       }
    +	$start = strpos($text,"[quote|allbyauthor]");
    +  if ($start !== FALSE) {
    +    $text = preg_replace( "/\[quote\|allbyauthor\]/ie", "quotescollection_displayquotes(\"ALLBYAUTHORS\")", $text );
    +  }
     	$start = strpos($text,"[quote|author=");
     	if($start !== FALSE) {
     		$text = preg_replace("/\[quote\|author=(.{1,})?\]/ie", "quotescollection_displayquotes(\"\\1\")", $text);
    @@ -888,7 +895,8 @@
     	$start = strpos($text,"[quote|tags=");
     	if($start !== FALSE) {
     		$text = preg_replace("/\[quote\|tags=(.{1,})?\]/ie", "quotescollection_displayquotes_tags(\"\\1\")", $text);
    -	}	return $text;
    +	}
    +	return $text;
     }
    
     function quotescollection_css_head()

    or you can download the patch here: http://www.rockerssoft.org/brockers/Documents/allbyauthor.patch

    Hopefully someone else will find this useful. Quotes Collection is one WP plugin I simply cannot live without.

    Thanks again SriniG!!

    Bobby

    http://wordpress.org/extend/plugins/quotes-collection/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Srini G

    @srinig

    Bobby, thanks for using the plugin, and thanks for the patch. Hope someone will find this useful.

    The good news is that the upcoming version of the plugin will use the WP shortcode APIs, and there will be an option to specify the order.

    brockers

    @brockers

    Thanks Srini, the new shortcode API works great!

    Bobby

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Quotes Collection] Patch, for Display All by Author’ is closed to new replies.