vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Post Background Color (https://vborg.vbsupport.ru/showthread.php?t=102339)

Marco van Herwaarden 12-05-2005 10:00 PM

Post Background Color
 
Post Background Color - Version 1.03b

Hack: Post Background Color
Version: v1.03b
Author: MarcoH64

Description
Create Color Schemes, set specific colors for different styles to match the styles colors the best. Give usergroups permissions to attach
a color scheme as background to a post. Great to allow Admins/Moderators to highlight important posts in a thread for example.

Features
- Create Color Schemes
- Override the default color for a Color Scheme for each Style if needed.
- User Usergroup permissions to allow/deny the use of background colors
- On posting/editing, optionally choose a background color
- Choose (vB Options) if you want the background color to be applied to the messagetext, the postbit info, or both.
- Create background images or gradients (thanks to applehat for the idea ;))

Changelog:
17-7-2006 v1.03b
- Fixed uninstall code. Space was missing in the DELETE FROMdatastore.
(if you have currently installed 1.03, then please do an overwrite install with version 1.03b prior to uninstallation. If you are already uninstalling with 1.03 and run into a SQL-error, see post https://vborg.vbsupport.ru/showpost.php?p=1032141&postcount=33 to fix an aborted uninstall)
7-12-2005 v1.03
- Increased size of colorcode in tables to support larger values so we can also use images and gradients
- Changed the postbit from background-color to background style attribute to support the above.
7-12-2005 v1.02
- Removed &nbsp from dropdown menu
- Fixed bug where colorscheme could not be reset to 'None' once a color was set.
5-12-2005 v1.01
- Fixed missing new column for post table in install routines.
5-12-2005 v1.00
- Initial Release

Notes
Copyright ?2005 MarcoH64
This Modification may not be redistributed in whole or significant part or changed without prior agreement of author.
Please don't forget to click Install.
If you like this work and would like to support the author, donations are always welcome at Paypal: Marcoh64 AT gmail.com

Marco van Herwaarden 12-06-2005 01:31 PM

Reserved

Alan @ CIT 12-06-2005 01:33 PM

Nice work mate :)

Flow Fusion 12-06-2005 02:54 PM

Very nice I will install.

Marco van Herwaarden 12-06-2005 04:15 PM

Did you also add some color schemes?

PS I will be gone out of the country in an hour, so i won't be able to give more support until next week.

Marco van Herwaarden 12-06-2005 05:08 PM

Quote:

Originally Posted by applehat
lol, now I get this error..

Database error in vBulletin 3.5.1:

Install code was missing a new column in the post table. Version 1.01 with updated install code released. Just do an overwrite install.
Quote:

Originally Posted by applehat
Also, my dropdowns are showing up as:

&nbspHighlight
&nbspWarning

Sorry no time to look into this anymore. It is probably a left over from an attampt to show the colors in the dropdown (which didn't work, somehow the colors didn't show).

Will remove this when i come back.

apdcanari 12-06-2005 06:03 PM

Error

Code:

$mh_pbc_color_scheme_picker_options .= "<option value=\"$mh_pbc_colorschemeid\" $selected><span style=\"background-color: $colorscheme[colorcode]\">A&nbsp;&nbsp;&nbsp;</span>&nbsp$colorscheme[title]</option>";
Change

Code:

$mh_pbc_color_scheme_picker_options .= "<option value=\"$mh_pbc_colorschemeid\" $selected><span style=\"background-color: $colorscheme[colorcode]\">A&nbsp;&nbsp;&nbsp;</span>$colorscheme[title]</option>";

applehat 12-06-2005 07:07 PM

Attached is the product XML with the above fix done to it.

applehat 12-06-2005 07:17 PM

BUG: If you try and turn it back to NONE, it will not let you.

A Temp. Fix would be to add your alt2 (or alt 1) color as a selection called Default or something to that extent.

Marco van Herwaarden 12-07-2005 06:54 AM

Version 1.02 released:
6-12-2005
- Removed &nbsp from dropdown menu
- Fixed bug where colorscheme could not be reset to 'None' once a color was set.

5-12-2005 v1.01
- Fixed missing new column for post table in install routines.

5-12-2005 v1.00
- Initial Release

(Yes i still have not left for my trip :()

Marco van Herwaarden 12-07-2005 06:54 AM

Oops i got my dates wrong, add 1 day to each date in changelog :D

applehat 12-07-2005 07:03 PM

pfft. No "Thanks Applehat for pointing this out"

haha, jk. Will update now.

Marco van Herwaarden 12-07-2005 07:08 PM

Lol was a bit in a hurry posting the update.

Ofcourse no fixes without people reporting bugs, so thanks applehat (lol what a name).

Marco van Herwaarden 12-07-2005 07:10 PM

Does anybody have an example of a good usage for this hack?

applehat 12-07-2005 07:12 PM

haha....I thought it was cool, but have not used it yet....

Maby to highlight some post? Like I run a board with Indoor Tanning information, and i could use it to highlight usefull posts or something.

Realy dont know, just looked cool :-)

applehat 12-07-2005 07:15 PM

You know what would be a nice add on? Not just being able to set a background color, but being able to set a background image...and how to repeat and align it...

Or can this already be done by doing url("blah")?

applehat 12-07-2005 07:17 PM

Just try'd...nope :-P

applehat 12-07-2005 07:19 PM

Also, this works fine in 3.5.2...so you can update the hack info.

Marco van Herwaarden 12-07-2005 07:35 PM

Quote:

Originally Posted by applehat
haha....I thought it was cool, but have not used it yet....

Maby to highlight some post? Like I run a board with Indoor Tanning information, and i could use it to highlight usefull posts or something.

So you're going to Tan some posts. :D

Lol i made this after someone was requesting/talking about this a couple of weeks ago. More just as an excercise. I can't even find the thread of the user who was once requesting it.

dan35 12-07-2005 07:43 PM

A background image? cool ;)

Marco van Herwaarden 12-07-2005 07:55 PM

Version 1.03 released:
7-12-2005 v1.03
- Increased size of colorcode in tables to support larger values so we can also use images and gradients
- Changed the postbit from background-color to background style attribute to support the above.

To upgrade, simply choose an overwrite install.

Marco van Herwaarden 12-07-2005 07:57 PM

Quote:

Originally Posted by applehat
You know what would be a nice add on? Not just being able to set a background color, but being able to set a background image...and how to repeat and align it...

Or can this already be done by doing url("blah")?

It does now. :D
Install version 1.03 and try for example:
Code:

#869BBF url(images/gradients/gradient_tcat.gif) repeat-x top left
or:
Code:

#869BBF url(images/misc/vbulletin3_logo_grey.gif) repeat-x top left

Reeve of shinra 02-03-2006 01:58 AM

2 stupid questions:

- will this work on the latest version?

- does this mean I can set a different background for usergroups a, b, c & d? Can I prevent the user changing that?

Okay I liked one more:

- I plan to use this with secondary usergroups, how will that work?

Registered = style a
|-- public usergroup b = style b
|-- public usergroup c = style c

Can I have a default in case of conflict like them being part of 2 usergroups?

thanks

hiiped 02-03-2006 03:13 AM

Quote:

Originally Posted by MarcoH64
It does now. :D
Install version 1.03 and try for example:
Code:

#869BBF url(images/gradients/gradient_tcat.gif) repeat-x top left
or:
Code:

#869BBF url(images/misc/vbulletin3_logo_grey.gif) repeat-x top left

??????

is this suppose to allow the allowed usergroup to use an IMaGe instead of colors ?

if so, where are we supposed to add/put this ?
or what needs to be edited to have that option
( make instruction n00b proof ) :)


Thanks in advance

Marco van Herwaarden 02-03-2006 07:16 AM

Quote:

Originally Posted by Reeve of shinra
- will this work on the latest version?

Not tested by me, but i see no reason why not.
Quote:

Originally Posted by Reeve of shinra
- does this mean I can set a different background for usergroups a, b, c & d? Can I prevent the user changing that?

It should merge the permissions to use Color Schemes if using seconday usergroups. Not tested this now since i am not at my development PC.
Quote:

Originally Posted by Reeve of shinra
Can I have a default in case of conflict like them being part of 2 usergroups?

There is no option to force a (default) color. Default is always None, in which case it will be a regular post.
Quote:

Originally Posted by hiiped
is this suppose to allow the allowed usergroup to use an IMaGe instead of colors ?

Yes you can use this to put a simple background color, an image or even a gradient. This is plain HTML, sorry i can't help you much with that since my HTML knowledge is also limited. Maybe someone else can post some nice examples.

hiiped 03-04-2006 01:36 AM

Im trying to edit to allow user to add an image from a URL as background in post

< no success *sighs* >

where are the HTML geeks ? ;)

Nathan2006 07-15-2006 11:52 PM

I have tried installing this but not working for me :(

So after trying to un-install the product I am getting this error:

Code:

Database error in vBulletin 3.5.4:

Invalid SQL:
ALTER TABLE post DROP COLUMN mh_pbc_colorschemeid;

MySQL Error  : Can't DROP 'mh_pbc_colorschemeid'; check that column/key exists
Error Number : 1091
Date        : Saturday, July 15th 2006 @ 08:48:54 PM
Script      : http://www.************.com/admincp/plugin.php
Referrer    : http://www.************.com/admincp/plugin.php?do=productdelete&productid=mh_pbc&s=
IP Address  : ************
Username    : ****
Classname    : vb_database

Thank you for any help :)

chkdgate 07-16-2006 06:57 AM

^^I'm interested in this as well but didn't the author mention that he wasn't sure it worked on the latest version?(3.5.4)

Nathan2006 07-16-2006 01:08 PM

Quote:

Originally Posted by chkdgate
^^I'm interested in this as well but didn't the author mention that he wasn't sure it worked on the latest version?(3.5.4)

Yeah Im not sure but it does not work for me on 3.54 and I cannot remove the product now :(

chkdgate 07-16-2006 04:04 PM

Did you try reverting your templates?

Nathan2006 07-16-2006 04:13 PM

Quote:

Originally Posted by chkdgate
Did you try reverting your templates?

Hi,

before I make any changes to code I always take a full copy of the
code then if I get any problems I just delete all the code from
the template and replace it all with the original code ;)

This is something to do with the uninstall of the product not he templates :(

And because I am not a coder I don't know how to uninstall it :(

chkdgate 07-16-2006 05:45 PM

PM the author of this hack. I don't want to tell you to do something and then mess up your board. Let me know what happens.

Marco van Herwaarden 07-17-2006 12:18 PM

Quote:

Originally Posted by Nathan2006
I have tried installing this but not working for me :(

So after trying to un-install the product I am getting this error:

Code:

Database error in vBulletin 3.5.4:
 
Invalid SQL:
ALTER TABLE post DROP COLUMN mh_pbc_colorschemeid;
 
MySQL Error  : Can't DROP 'mh_pbc_colorschemeid'; check that column/key exists
Error Number : 1091
Date        : Saturday, July 15th 2006 @ 08:48:54 PM
Script      : http://www.************.com/admincp/plugin.php
Referrer    : http://www.************.com/admincp/plugin.php?do=productdelete&productid=mh_pbc&s=
IP Address  : ************
Username    : ****
Classname    : vb_database

Thank you for any help :)

I have looked into this and there is a space missing from one of the uninstall steps causing a SQL-error. The error you quoted however can only happen if you try to uninstall twice. You would have gotten a different error the first time.

To fix your current situation (this only applies if you tried to uninstall twice, will upload a fixed version in a few minutes for those that still have to start uninstallation), do the following:

Go to AdminCP->Plugin System->Manage Products, then:
- Select 'Edit' from the dropdown menu behind the Post Background Color product.
- On the edit page you will find 3 rows with each 2 columns with install/uninstall code.
- The right column contains the uninstall codes
- Change the uninstall for version 1.00 (the first row) to contain only (overwrite the current code):
PHP Code:

// Clean Datastore
$vbulletin->db->query_write("DELETE FROM " TABLE_PREFIX "datastore WHERE title = 'mh_pbc'"); 

- Remove all the code from the version 1.01 uninstall code box (right column, second row)
- Save the product (use the bottom Save button!)

Uninstall again.

Nathan2006 07-17-2006 12:31 PM

Which code do I need to replace?

Uninstall code version 1.00

Code:

// Drop mh_pbc_colorscheme
$vbulletin->db->query_write("DROP TABLE " . TABLE_PREFIX . "mh_pbc_colorscheme");
 
// Drop mh_pbc_stylecolor
$vbulletin->db->query_write("DROP TABLE " . TABLE_PREFIX . "mh_pbc_stylecolor");
 
// Drop usergroup permissions
$vbulletin->db->query_write("ALTER TABLE " . TABLE_PREFIX . "usergroup DROP COLUMN mh_pbc_permissions");
// Clean Datastore
$vbulletin->db->query_write("DELETE FROM" . TABLE_PREFIX . "datastore WHERE title = 'mh_pbc'");

Replace this:
Code:

// Drop mh_pbc_colorscheme
$vbulletin->db->query_write("DROP TABLE " . TABLE_PREFIX . "mh_pbc_colorscheme");

With this: ?
Code:

// Clean Datastore
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "datastore WHERE title = 'mh_pbc'"
); 

If I'm doing it right I get a page cannot be found?

Marco van Herwaarden 07-18-2006 04:38 PM

Quote:

Originally Posted by Marco van Herwaarden
- Change the uninstall for version 1.00 (the first row) to contain only (overwrite the current code):
PHP Code:

// Clean Datastore
$vbulletin->db->query_write("DELETE FROM " TABLE_PREFIX "datastore WHERE title = 'mh_pbc'"); 


- Remove all the code from the version 1.01 uninstall code box (right column, second row)

I don't understand how you can get confused.

When finished, the first row of uninstall code should only contain that delete from datastore, and the second and third unstill rows should be empty.

Nathan2006 07-18-2006 04:54 PM

Quote:

Originally Posted by Marco van Herwaarden
I don't understand how you can get confused.

When finished, the first row of uninstall code should only contain that delete from datastore, and the second and third unstill rows should be empty.

Hi,

I have tried this (Screenshot 1)

Then after clicking save I get this error (Screenshot 2)

Im doing every correct.

What would happen if I installed your updated product
and tried uninstalling?

Thanks for your help :)

Marco van Herwaarden 07-19-2006 02:22 PM

That looks more like a server config problem. What happens if you try to save it without making a change?

Nathan2006 07-19-2006 04:07 PM

Quote:

Originally Posted by Marco van Herwaarden
That looks more like a server config problem. What happens if you try to save it without making a change?

Hi,

I just tried and I receive the same page not found :(

Is there anyway I can fix this?

Thank you for your help

Marco van Herwaarden 07-19-2006 04:18 PM

Then it is very likely that it is a server issue.

Please try first by turning off GZip compression in your vBulletin Options.

Other things that might cause something like this:
- A .htaccess rewrite rule playing games
- mod_security settings if this is installed
- memory settings (doubt it in this case)

I very much doubt that this got anything to do with this modification. Can you (fake) edit other products? Are you having more problems with sometimes getting this kind of errors.

Nathan2006 07-20-2006 08:03 PM

Quote:

Originally Posted by Marco van Herwaarden
Then it is very likely that it is a server issue.

Please try first by turning off GZip compression in your vBulletin Options.

Other things that might cause something like this:
- A .htaccess rewrite rule playing games
- mod_security settings if this is installed
- memory settings (doubt it in this case)

I very much doubt that this got anything to do with this modification. Can you (fake) edit other products? Are you having more problems with sometimes getting this kind of errors.

I got it sorted :)

Its was something to do with the mod_security setup on the server
and they have sorted it all and everything is good :)

Thanks


All times are GMT. The time now is 05:49 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01380 seconds
  • Memory Usage 1,851KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (11)bbcode_code_printable
  • (2)bbcode_php_printable
  • (16)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete