I am preparing for a Halloween surprise for my members and I know that my "666" theme for June 6th, 2006 really upset a lot of members and there was no way for the members to OPT-OUT of my special styles so I have worked out a simple mechanism to allow my members to OPT-OUT of special styles as shown by this script.
Step 1: Create a New User Profile Field
Title: Use Special Event Styles
Description: Do you wish to see special Holiday Website Styles.
Options:
Quote:
yes
no
Set Default = yes
Field Required = yes, always
Field Editable by User = yes
Private Field = no
Field Searchable on Members List = no
Show on Members List
Allow user to input their own value for this option = no
Display Page: Options: other
IMPORTANT - After you save this you need to look in the User Profile Field Managed and find the "name" of this new profile. On my site it is "field6"! the firections that follow you need to change the "YOUR-CUSOM-FIELD-ID" with YOUR field name! Make sure you don't mess this up in teh next step or you can overwrite something you don't want overwritten!
Step 2: Run a Mysql Query to update ALL values in your database!
IMPORTANT - Remember to check your PREFIX and use YOUR userprofile field!
If you mess this up, there is NO WAY TO UNDO IT so I suggest a database backup!
PHP Code:
UPDATE `PREFIXuserfield` SET
`YOUR-CUSOM-FIELD-ID` ='yes'
Step 3: Modify your plugin:
Open Plugin: [Holiday/Event/Birthday Style Manager]
Above first Line of Code Add:
PHP Code:
if ($vbulletin->userinfo['userid'] > '0' AND $vbulletin->userinfo['YOUR-CUSOM-FIELD-ID'] == 'yes'){
After LAST line Add:
PHP Code:
}
Now What?
That is it, now users can go into their Options and change the value from yes to no and disable the style as shown on their birthday, holiday, or any other special day that this hack is used to redefine the style!
That is it, now users can go into their Options and change the value from yes to no and disable the style as shown on their birthday, holiday, or any other special day that this hack is used to redefine the style!
Hey, thanks for what you posted, but, I have a question. Wouldn't your modification of this also disable the holiday system for guests?
Wouldn't it be wise to add something like:
Code:
else if ($vbulletin->userinfo['userid'] == '0'){
And then paste all of the original code again, and then add another } at the end?
There might be an easier way to do this, or I might just be mistaken, but, I'm pretty sure this would turn it off for guests, and I don't want that.
Is there any way to make this (more specific just the birthday style) show up for just the user who is having the birthday? Or does this do that? Reason being is if you have a large group the style will always be up more then the default. Not only that people may tire of the birthday theme really quick if it applies to all users.
Is there any way to make this (more specific just the birthday style) show up for just the user who is having the birthday? Or does this do that? Reason being is if you have a large group the style will always be up more then the default. Not only that people may tire of the birthday theme really quick if it applies to all users.
The birthday style only shows up for the person whose birthday it is. Unless you have it set to a particular date or event or something.
I installed this and it's great. The plus side is if a poster wants to resume from a normal style, he can change it, but the point of wishing him a happy birthday has been made. Love this hack, and thanks for the info lilbill.
I installed this and it's great. The plus side is if a poster wants to resume from a normal style, he can change it, but the point of wishing him a happy birthday has been made. Love this hack, and thanks for the info lilbill.
No problem.
And as for my post above, I was thinking only the holiday portion of the code should be re-added outside of the conditional tags, because guests wouldn't have birthdays in the database.