b2evolution: Widget visibility hack (English)
Note
The patch for b2evolution 2.4.2 can be found in the b2evolution forums.
I’m new to b2evolution and have just migrated another blog from Wordpress to b2evo. Since I’ve closed my old blog at tblue.de (I wanted to start blogging from scratch and the server was really slow, too) I decided to set up a new blog based on b2evo.
Now I’ve read this thread in the b2evo support forums. I was bored so I tried to implement the requested feature (toggle the visibility of a single widget). Of course I had to mess around with the b2evo code (no, the code is great, but I had to understand the relations etc.) but finally I managed it to write this little hack. Maybe the code I’ve written isn’t perfect, so please give me feedback… I also think the icon I used isn’t the right one (it’s the icon for enabling/disabling plugins), could someone offer me a better one? :)
Notes:
- This hack was tested only by me so far - so don’t be surprised if something does not work as expected.
- It was tested with b2evolution 2.4.1.
- Legal stuff: This hack has no warranty for correct operation. I’m not responsible for any damage that can occur due to the use of this hack.
OK, here are the install instructions:
Make a backup of your b2evo files and the database.
Download the patch file (for b2evo 2.4.1) and patch your files. The patch command has to be executed in the b2evolution root directory (the directory which holds the folders inc, conf etc.). The command you would use under Linux is:
patch -p1 < path/to/the/patch-file
Execute the following SQL command in your b2evo database (you can use a tool like PHPMyAdmin to do this):
ALTER TABLE `evo_widget` ADD `wi_show` BOOL NOT NULL DEFAULT '1' COMMENT 'visibility hack' AFTER `wi_order`;
Try the hack and report problems! You can use the comment function of this blog to do that. ;)
Have fun.
P. S.: If my English isn’t the best I’m sorry - I’m not a native English speaker.
Comment by Daniel
Instead of “wi_show” for the field name, I’d suggest “wi_enabled”, like it’s being used in T_locales and T_pluginevents.