XmasB Quotes

August 4th, 2010

This plugin/widget lets you add and show random quotes to your WordPress blog with ease. The plugin uses MySQL to store quotes.
You can specify an image for each quote, default image for quotes, and the option to disable images altogether.

Installation

This section describes how to install the plugin and get it working.

1. Upload directory “xmasb_quotes” to the `/wp-content/plugins/` directory
2. Activate the plugin through the ‘Plugins’ menu in WordPress
3. Add the widget to your sidebar
4. That’s it!

By default the plugin looks for an image in the folder named “images” with a name that matches the author and extension “.gif”, eg. if the author is “Bart”, the plugin will look for the file named “bart.gif”. If an image is found it is used, else the quotes is shown without an image or default image if specified.

You can add, edit and delete quotes under Edit – XmasB Quotes.
The options for each quote:

Quote – The actual quote.
Author – The author of the quote. This is optional.
Image – The image to be used. If left blank, the name of the author will be used to search for an image. If not found, and default image is specified, the default image will be used.
Visible – Set this to “No” if you want to hide a quote without deleting it.

Set more general options under “Options – XmasB Quotes”.
Options available:

Show Images – Uncheck this to disable images shown with quotes.
Default Image – If specified this image will be used if no image is found for author or specified image for quote. If left blank, quotes without images will not show an image.
Show link to author – Shows a link to xmasb.com and my plugin in the widget. Turn off if you want to.

The title for the Widget is set directly in the Widget under “Presentation – Widgets”.
Title – The title to show with the Widget. Default is XmasB Quotes.

For easier management of version and statistics the plugin is hosted at WordPress.org.

This blog is using the Widget as you can see to the right.

Stumble it!


(Klikk her for å få den norske versjonen.)

  1. January 21st, 2008 at 15:06 | #1

    Hi XmasB,

    Just getting started with the plugin and my site. I was wondering if you’ve encountered a situtation where the plugin text bleeds over the margins of the column (click on my website to see it). Any advice would be appreciated – my layout it widget ready. Thanks for creating such a great tool!

  2. January 21st, 2008 at 15:34 | #2

    Hi Davin,

    your stylesheet has the sidebar set to 334px in width. This is more than you need, which causes the text to bleed over the margins on the right. Try setting it to 250px, I think that looks good on your site (I have already tried this using Firebug on your site).

    Also, I think it would look better if you add 12px to the left padding of the classes “xmasb_quotes_quote”, “xmasb_quotes_author” and “xmasb_quotes_link” (or just leave the link out by selecting it away in the options page).

    Here’s a preview of the changes:
    XmasB went overboard on The Perfect Silence

    I might have gone overboard in this. Kinda slow in the office today…

  3. January 21st, 2008 at 16:32 | #3

    XMasB,

    Thank you so much for the very quick advice! Much appreciated!! I was also going to float the image to have the text wrap around it – seems a little more natural that way. WHen I do this, all the widgets and text in the sidebar keep floating too. Any suggestions for getting just the image to float?

  4. January 23rd, 2008 at 07:44 | #4

    I believe you could just set “float: left/right” on the class “xmasb_quotes_image”. I think that would work. As you can see on my site, I prefer to have it above and centered.

  5. Peach
    February 10th, 2008 at 05:21 | #5

    I really like this plugin. When I started looking for a quotes plugin I was worried I’d have to write my own, but this is exactly what I wanted. Thanks so much!

    Minor bug: in xmasb_quotes_get_quote, the htmlbeforeauthor and htmlafterauthor variables are not used. Instead, you have strong tags hard coded around the author. I’ve had to fix it twice now ;) But it is an easy fix.

    Thanks again for a great plugin!

  6. February 11th, 2008 at 06:35 | #6

    Thanks for letting me know, Peach. I will try to fix this as soon as possible. And thanks for using the plugin.

  7. February 16th, 2008 at 16:25 | #7

    hello i have your nice plugin activated in the side bar, I would like to add a link called “next” that will refresh only the plugin and give another quote,
    i ‘m a little confused, anyhelp would be appreciated…
    thanks

  8. February 16th, 2008 at 22:56 | #8

    I have been thinking about that feature, jerry. Today, this is not possible with the current plugin (v 1.1.2). I’m planning to rewrite the plugin to improve the code. I will add several new features when I do this, and also plan on supporting ajax (which lets me do what you request) for smoother visuals.

    I’m way behind in my plans for this plugin, but will hopefully find time to work on it soon. For the time being, a newborn and my work takes up pretty much all of my time. :)

  9. February 18th, 2008 at 18:57 | #9

    ok then I hope you will get time for this release.
    I will check from time to time.

  10. February 18th, 2008 at 21:18 | #10

    Thanks for trying out this plugin, jerry. I will try to find the time.

  11. sonden
    March 8th, 2008 at 16:29 | #11

    Hello,

    I just installed your promising plugin but when i try to add a quote in manage/Xmas BQuote it doesn’t show up in the statistics section saying “No quotes found”. Any idea what could be the problem?

    cheers

    sonden

  12. March 8th, 2008 at 17:24 | #12

    Hi Sonden,

    the last 5 quotes added should be available in “Edit – XmasB Quotes” in your WordPress dashboard. If you have added the quote properly it should show up there right after being added. If it’s not there, there is a chance an error has occured.

    If nothing shows up, look for an error when adding the quote. Any errors should appear just below the menuline.

  13. sonden
    March 8th, 2008 at 18:49 | #13

    Hello again,
    Thank you for your quick reply!
    I reuploaded and reactivated the plugin and it does exactly the same thing as before. When adding and saving a new quote they are not showing up – neither in the dashboard nor in the statistics section. There is also no error message.

    Is it maybe the version of wordpress i am using (2.3.3) that is incompatible?

    Best Regards

    sonden

  14. March 9th, 2008 at 19:58 | #14

    This sounds strange. Do you get the message saying the quote has been added?

    I’m using WordPress 2.3.3 as well without any problems.

  15. March 31st, 2008 at 04:29 | #15

    I just installed the newest version on WordPress 2.5 and am seeing the same thing as sonden. There is no message saying the quote has been added, and there is no error message. I checked my database — the xmasb_quotes table has been added, but is empty even though I’ve added half a dozen quotes.

  16. March 31st, 2008 at 04:31 | #16

    I just noticed that the table is named ‘xmasb_quotes’ — that is, it isn’t using the prefix, even though I see that according to your code, it should be.

  17. March 31st, 2008 at 09:01 | #17

    Thanks for letting me know, Stephanie.

    I have tested against my testblog that I have upgraded to WordPress 2.5. Everything works fine there. I suspect that the problem occurs when creating the table for the plugin, but I have not yet tested this. I will look into this as soon as I can. I will email you when I find an answer, as well as post a comment here.

  18. April 1st, 2008 at 09:59 | #18

    Found a bug introduced with WordPress 2.5 that caused the prefix to be dropped when creating the table. It has been fixed. I have tested and everything works fine.

  19. April 2nd, 2008 at 07:28 | #19

    Thanks! Deactivated, reactivated, and now it’s working.

  20. April 2nd, 2008 at 09:01 | #20

    Good to hear, Stephanie.

    Thanks for pointing out the errors for me. I will be sure to tribute you on my page for this plugin.

  21. April 4th, 2008 at 17:49 | #21

    My database was not created. I went into phpMyAdmin and tried to create the table manually. Got the following error message “#1101 – BLOB column ‘author’ can’t have a default value”. TINYTEXT is a type of TEXT column, which is a type of BLOB. They cannot have default values. http://dev.mysql.com/doc/refman/4.1/en/blob.html

    This is probably why the database doesn’t get created. The easiest way to “fix” this is to just get rid of the DEFAULT clause of the SQL create statement since the PHP code already makes sure that spaces ‘ ‘ are put into those fields if they weren’t specified in the management form.

  22. April 5th, 2008 at 10:12 | #22

    Thanks Don. I have not heard any reports of this being a problem before, but the documentation on mysql is clear. You are probably not te first one experiencing this. I have removed the default value for the table in version 1.1.6.

  23. Rick
    April 9th, 2008 at 22:37 | #23

    Using 1.1.6 and wodrpress 2.5

    It shows no quotes found on activation. When I add one, it accepts it, but still shows no quotes found.

  24. April 10th, 2008 at 22:18 | #24

    Thanks for letting me know, Rick. Could you please tell me what version of PHP and MySQL you are using as well? I will look into this as soon as I can.

  25. Rick
    April 12th, 2008 at 02:55 | #25

    Operating system Linux
    Service Status Click to View
    Kernel version 2.4.21-32.ELsmp
    Machine Type i686
    Apache version 2.0.63
    PHP version 5.2.5
    MySQL version 4.0.27-standard

  26. April 14th, 2008 at 00:42 | #26

    Shouldn’t be a problem as far as I can see there. I will look more into this tomorrow. So far you are the only one reporting this problem, but that doesn’t mean that there is no bug. Nobody’s perfect. :)

    Have you checked if the table has been created correctly? The name of the table should follow your default settings, typically starting with “wp_”. If that is the case, the table should be called “wp_xmasb_quotes”. See if the name is similar to your other tables from WordPress.

  27. May 8th, 2008 at 00:39 | #27

    hi there .thanks for plugin:

    Does anybody know if tis script is compatible with WordPress 2.5.1 ?

    Thanks in advance for any help on this!

    best regards

  28. May 8th, 2008 at 10:58 | #28

    Hi baron,

    I use the plugin on this site (powered by WordPress 2.5.1). It is compatible with this version.

  29. EdB
    May 20th, 2008 at 03:21 | #29

    Hi,
    I’m having the “table not created” problem with WordPress v2.3.3 and XmasB quotes 1.2.0. I’ve read most of the posts here, but still can’t figure out the problem. Here are the messages appearing at the bottom of the page when I try to add a quote:

    WordPress database error: [Table 'db217842681.wp_xmasb_quotes' doesn't exist]
    SELECT * FROM wp_xmasb_quotes order by id desc limit 5
    No quotes found

    WordPress database error: [Table 'db217842681.wp_xmasb_quotes' doesn't exist]
    SELECT quote FROM wp_xmasb_quotes GROUP by quote HAVING COUNT(quote)>1

    There are similar messages at the top of the screen but without “no quotes found”.

    Thanks for any thoughts.
    Ed

  30. May 20th, 2008 at 09:03 | #30

    Hmmm. I was sure I was rid of that error in version 1.1.6.

    Can you check if a table has been created just the name “xmasb_quotes”? The prefix should be added, but earlier that has been the problem. I use the prefix set in the configuration file of your WordPress installation, but there could be a bug in that process that causes this.

  31. EdB
    May 21st, 2008 at 08:04 | #31

    I’m no SQL expert so I’m not sure how to check for tables. I did go into the database for my blog and looked around, and I saw nothing with “XmasB” in it, with or without the “wp_” prefix. I can tell you that I’m using WP 2.3.3, mySQL 4.0, and though probably not relevant, Windows XP SP2. My host is 1and1 Internet.

    If there’s no easy solution then no worries. Thanks for your time.
    Ed

  32. May 21st, 2008 at 09:01 | #32

    Ok. I will try some testing with the version of WordPress you are using, to see if that could be the problem. It could also be the version of php that is too old. Do you know which version 1and1 are using?

    I will look into this (it could be a problem for others as well, although I have not heard from anyone else). I will post an update here if I find a solution.

  33. EdB
    May 21st, 2008 at 17:12 | #33

    The PhP version 1and1 uses is phpMyAdmin 2.6.4-pl3.

    If I’m the only one with this problem, then please don’t spend all your time on it. I appreciate the effort you and others make in putting out these widgets as freeware but I certainly don’t expect 24/7 support!

    Ed

  34. May 21st, 2008 at 17:30 | #34

    No problem, EdB. I haven’t tested with your WordPress version yet, but will try do so soon. If I find out that the version is not supported I will update the requirements for my plugin.

  35. EdB
    May 22nd, 2008 at 03:57 | #35

    I’m probably going to “bite the bullet” and just upgrade my WordPress. It always makes me nervous, but it’s time. That should solve the issue. I’ll let you know. –Ed

  36. May 22nd, 2008 at 06:48 | #36

    Great. Sounds like a good idea for many other reasons as well. Good luck!

  37. stef
    May 31st, 2008 at 22:15 | #37

    Hi,
    I like the plugins, however is that any possibility to include quote on fix date instead of random?

    regards,
    stef

  38. June 2nd, 2008 at 08:11 | #38

    Not at he moment, stef. I have been planning to implement a few new functionalities to this plugin, and timestamp to allow for quote to be shown on specific dates is one of them. I will try to add this in a future version, but can’t maky any promises on when I’m afraid.

  39. Stefanus
    June 2nd, 2008 at 15:50 | #39

    Hi,
    I just moved my site to another domain name.
    I have copy all the xmasb-quotes to the plugins directory, but when I checked the quote in wp-admin, I did not find any.
    Pls let me know, how to restrore the quote. Where do you store the database?

    regards,
    stef

  40. June 2nd, 2008 at 20:17 | #40

    The table used is called wp_xmasb_quotes by default. The prefix (default “wp_”) is the same as your other WordPress tables. If you move this table wiht your installation, you should be fine.

    I am planning to include an option to export and import to file, but haven’t found the time for this yet.

  41. stef
    June 4th, 2008 at 02:13 | #41

    Hi,

    Where is the location of: wp_xmasb_quotes?
    I have tried to find the file, but it is not there.

  42. June 4th, 2008 at 08:49 | #42

    The wp_xmasb_quotes should be located within your WordPress database, together with your other wp_ tables. If you have chosen another prefix during the installation of WordPress, this will also be the prefix of xmasb_quotes.

    You are not looking for a file, but a table within you MySQL database used by WordPress. Typically you will have to access this through your domain control panel.

    I will release a new version with the option to export and import quotes (perfect for this kind of operation) soon. Hopefully, I will have this ready by next week.

  43. June 8th, 2008 at 23:12 | #43

    I have the problem with “No quotes found”
    On “localhost” I have WP v2.3.3 and XmasB Quotes v1.1.6 with 152quotes, it’s works fine.
    When I install WP v2.5.1 – still works fine. And when I install XmasB Quotes v1.2.2 – works fine, I see quotes on “localhost” site.
    But when I upload files from localhost to my site I get error “No quotes found” – in admin page I see all quotes, but when I open site – error.

    Localhost:
    PHP: 5.2.1
    MySQL: 5.0.33

    Site:
    PHP: 5.2.6
    MySQL: 5.0.45

    Can you help me?
    And I’m sorry for my English.

  44. June 9th, 2008 at 11:35 | #44

    So you see all the quotes in the admin page, but get an error when viewing you blog? Are you sure the quotes are set to visible? (probably a stupid question…)

    And you have of course added the quotes on your site as well? The quotes are stored in the mysql table wp_xmasb_quotes in your database. If you have copied the table from localhost, be sure that the prefix is the same as the other tables used by WordPress.

    Please let me now if this helps or not.

  45. June 10th, 2008 at 11:16 | #45

    Very hard for me describe the problem with my poor English, I’m sorry.

    So I have WP v.2.5.1 and XmasB Quotes v1.1.6 – works fine on my blog (www.flector.ru)
    I de-activated XmasB Quotes v1.1.6 and deleted folder xmasb_quotes from plugins folder in wordpress. I uploaded new version 1.2.2 on site and activated it in admin\plugins page. I get error “No quotes found” when I viewing blog.

    Just see screenshot – http://www.flector.ru/quotes.png

    But on “localhost” with WP 2.5.1 and XmasB Quotes v1.2.2 – I can see quotes. I cannot understand the difference between localhost and hosting. Problem with different versions of MySQL and PHP?

  46. June 10th, 2008 at 12:02 | #46

    I find error in error_log of server

    [Tue Jun 10 12:51:07 2008] [error] WordPress database error You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘SELECT FLOOR(MAX(ID)*RAND()) AS ID FROM wp_xmasb_quotes) AS x O for query SELECT * FROM wp_xmasb_quotes T JOIN (SELECT FLOOR(MAX(ID)*RAND()) AS ID FROM wp_xmasb_quotes) AS x ON T.ID >= x.ID and visible = 1 LIMIT 1 made by xmasb_get_random_quote

    can you fix it?

  47. June 11th, 2008 at 22:59 | #47

    I’m a bit puzzled by this. I have tried to find a solution, but so far Ive got nothing I’m afraid. The very query that you get an error or works in my MySQL (version 4.1.21). I copied the query from your comment, just in case. The query works just fine on my database.

    One workaround can be to replace the line that causes this error in the plugin. Find the query in the file xmasbquotes.php (line 99) and comment it out by adding to slashes before the line. Uncomment the line before (with the old query). Please note that the old query is not as efficient with large tables (mine has about 15000 quotes in it).

    I will try to find out what exactly causes your problem. Hopefully, you can use he workaround until then. Thanks for telling me about your problems with it. I need feedback to improve it.

  48. June 21st, 2008 at 13:22 | #48

    It would be great if you could apply a refresh feature with AJAX, to enable the possibility of viewing more quotes without refreshing the page.

  49. June 22nd, 2008 at 20:43 | #49

    I have planned to include this in a future release, Alvaro. Hopefully I will find time to implement it soon.

  50. stefanus
    July 10th, 2008 at 18:04 | #50

    HI,
    Is there a way to put the plugins in PHP file instead from the widget? What is the code I need to put in?

Comment pages
  1. May 14th, 2008 at 21:29 | #1
  2. May 26th, 2008 at 18:07 | #2
  3. June 1st, 2008 at 19:00 | #3
  4. July 2nd, 2008 at 11:54 | #4
  5. July 11th, 2008 at 03:34 | #5
  6. July 13th, 2008 at 03:44 | #6
  7. July 14th, 2008 at 13:48 | #7
  8. July 16th, 2008 at 12:57 | #8
  9. August 12th, 2008 at 04:15 | #9
  10. August 12th, 2008 at 09:50 | #10
  11. August 16th, 2008 at 01:21 | #11
  12. September 1st, 2008 at 14:56 | #12
  13. September 19th, 2008 at 19:51 | #13
  14. September 25th, 2008 at 05:48 | #14
  15. December 31st, 2008 at 08:53 | #15
  16. February 14th, 2009 at 13:55 | #16
  17. March 1st, 2009 at 19:55 | #17
  18. March 20th, 2010 at 02:28 | #18
  19. March 31st, 2010 at 02:07 | #19