![]() |
CES Wiki Conditionals
CES WIKI CONDITIONALS
Version: 1.1.0 Requires vbWiki Pro v1.3 RC3 or later (also unsupported). *** NEWS *** 5/30/2007 - linked first post to a bug fix for vbWiki Pro that prevents this mod from working 5/20/2007 - v1.1.0 released 5/14/2007 - v1.0.3 released on vb.org Products to Install: 1 Plugins Included: 2 Files to Upload: 1 Template Edits: 0 Files to Edit: 0 What It Does: Allows you to use vBulletin template conditionals in MediaWiki articles. HTML Code:
<if condition="code"> ... <else /> ... </if> - Because of some bugs in the MediaWiki parser, nesting <if> tags inside each other will result in unexpected behavior. - Some public versions of vbWiki Pro have a bug where the hooks don't work properly. Until a new build corrects this, use the fix here: https://vborg.vbsupport.ru/showthread.php?p=1257327 - You should NOT be using this mod to hide or show dynamic content based on Usergroup Permissions, since there are holes in the implementation. - We have abandoned most of our other-party-wiki addons since we started our own wiki project for vBulletin called VaultWiki. *** Changelog *** As of Version 1.1.0: - rewrote the parser function to use vBulletin's code - fixed bug where the page would cache As of Version 1.0.3: - finally compatible with public versions of vbWiki Pro As of Version 1.0.2: - uses vBulletin's hook system - else parameter changed to vBulletin's <else /> tag As of Version 1.0.1: - added else parameter |
sweet!
thanks for this! |
Could we have a better description of what this does please?
Template conditionals? |
You can use the <if> ... <else /> tags from vBulletin's template system within wiki articles.
|
I'm really not quite sure on what the intended usage would be. I understand the functionality, but could you give an example where you would use it?
|
Quote:
1) You have a documentation Wiki and want to include additional information for staff members outside of the public eye. 2) You want to leave annotations within an article to the author of the page. 3) You want to show different content based on usergroup. e.g. easily include advertising via a Wiki template for regular members and exclude it for paid members. I am sure there are a million and one things that could be done. |
I guess I could have spent a bit more time in my prior post and been more clear. Mediawiki is a platform designed to be open as possible. Tools like this that attempt to hide or protect content are inherently rife for problems.
Quote:
Quote:
Quote:
Quote:
I did install the code on my running server and expected it to fail some simple 'hack' tests.
I'm not trying be difficult here or harsh, but I don't see this as a good solution for what it could be intended to be used for. Furthermore, this isn't anything against thincom2000, many of the extensions for mediawiki also fail these tests as well. Frankly, mediawiki isn't a platform for dynamically hiding or presenting content based on usergroups (which is really what the three examples above are - just in different flavors). |
Using the new hooks available in vbWiki I should be able to get this to pass your other two tests. I will look into this. :)
And to give you some more ideas, I have used this code to displayed userinfo based on the logged in user. Also, on my site in particular, we run a wiki for editing by higher level Usergroups (when we launched it we pushed it as more of a CMS), and thus this was helpful in show/hiding information from editors, while not showing this content to for example unregistered users. |
On our site we wanted to use teh Wiki to host owners manuals for new products that are coming out. Sure, we can post them in the forum in a hidden forum then reformat everything to post it in the wiki...but why create more work than you have to?
|
Glad this newest version is finally working for you, RedGTiVR6.
|
Quote:
|
Now that I have this installed (after updating everything on our forum with the newest vB release, et. al.)...I'm not sure how to utilize the "condition".
I'm no coder, so I'm a bit lost as to the conditions I would need to use. Can anyone help me and my ignorant self? :) |
What are you trying to accomplish?
A frequently used condition on my own and probably most other forums utilizing this hack is PHP Code:
|
that's what I was looking for!
Thanks! Now, I've put the following at the beginning of this article: Code:
<if condition="is_member_of($bbuserinfo, array(6))"> You can find the article here: http://www.mp3car.com/wiki/index.php/Bit-perfect I'm just using this article as a test since it's a little known article on our forum. I'm trying to block out text to only be seen by admins right now, but it's not working. I'm guessing I'm not using the code properly? |
Well first of all, your </else> should be <else />. Also the condition needs to be wrapped in quotes so the most recent revision is incorrect.
According to your Special:Version page, MediaWiki is not detecting the extension. I had the same problem and released 1.1.0 to fix it, only to realize that the hooks in vbWiki were not parsing. In fact, I should be the only one with a working installation of this currently thanks to a bug in all current versions of vbWiki Pro. You can fix the bug by doing the following: In vbwiki/arcane_vbulletin_core.php, find: PHP Code:
PHP Code:
|
Code:
Warning: require_once(/.../vbulletin/vbWiki/vbConditions.php) [function.require-once]: failed to open stream: No such file or directory in /.../vbulletin/vbWiki/vbWiki.php(38) : eval()'d code on line 1 |
I remember that in the last version you had to change the single quotes to double quotes to get that error to stop. Try that in the vbw_start plugin.
I still have absolutely no idea why this error is isolated to your installation. |
Added the double quotes as you suggested.
The wiki page will come up, but this is at the top of it: Code:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /.../vbulletin/vbWiki/vbWiki.php(38) : eval()'d code on line 1 |
And you do have vbConditions.php in the vbWiki folder?
|
Yes.
if I remove the double quotes, the parse error goes away at the top of the screen but the code still doesn't do anything from within the article. I've also tried completely reinstalling the mod as well, no dice. The mod does show up in the special pages now. |
Okay that's a step in the right direction...
|
btw - I do really appreciate your assistance on this. It is greatly appreciated.
If I used PayPal (I refuse) I would donate. Any other way you suggest? |
I registered and made an edit to the page. It's working. The problem was that the old version of the page was cached, so it wasn't trying to reparse anything after the hook issue was fixed.
Since I made an edit you should probably re-edit to remove the extra text "Only showing to admins..." (don't revert to the last revision). P.S. If you are using the conditions to hide text by Usergroup, I would not recommend letting anyone lower than that edit the page. With the hook vbw_map_permissions, you should be able to lock down certain pages if this isn't already a feature of vbWiki Pro. |
Thanks.
I noticed this change, but I also noticed the <else /> as being still visible when I check the page, but the first part of the code isn't. Also, if I logged in as a non-admin and looked at the page, it showed as desired, but if I went in to edit it, I could see it all. So by your last post... If I have an article that the members of the company are working on but we don't want to be visible by the public yet...we shoud only allow that user group to edit the article. Do I understand that correctly? |
That understanding is correct.
EDIT: I noticed what you said about using <else />. I will fix that for the next build, thanks. |
Thanks for the support! It's greatly appreciated.
I'm off to send an email to the company to let them know about the new ability. |
I'm back...:(
Perhaps this isn't possible, but I cannot figure out how to allow only certain user groups to edit an article. I can see where we can protect it, but there's only the Sysops group that I can choose or the unregistered group. Am I missing something? |
Quote:
integrations like this allow me to lock things down I was pretty clear that you do not want to use this plugin to lock down content. Simply adding your wiki to an rss feed will show any 'protected' content you may have (as well as showing the code you place on the page). You could also show the full content of the page by adding the "raw" option. without worrying about protecting every page. This plugin requires page by page protection since it only works on a per page basis. |
Working on this... How do you view the RSS output of the page? Is this a new feature in MW 1.10?
|
You can get the rss feed of the recent changes which would include any code you add to a page.
RSS Feed: http://www.crackedeggstudios.net/wik...anges&feed=rss (you have disabled the feed presumably to not show the code) Furthermore, you can see the diff history of any page and see the code. This is just too easy to see the 'hidden code' that it is (unfortunately) ineffective at best. For example, see this page: http://www.crackedeggstudios.net/wik...anges&days=100 From there, you can look at this page: http://www.crackedeggstudios.net/wik...293&oldid=2292 This page clearly shows the 'protected content' and the CODE. To make matters worse, you could view the raw page and see the full current page with all of your code and the hidden content: http://www.crackedeggstudios.net/wik...ent&action=raw EDIT: If anyone is going to say something like, "well...this is just to hack or someone who tries to see hidden code" you are fooling yourself. A simple search also shows hidden content. Someone could search for something as simple as the word "links" and show 'hidden content' (since the search engine has no idea it is supposed to be hidden from that user). http://www.crackedeggstudios.net/wik...searchx=Search Again, this mod should NOT be used to hide or protect content under any circumstance. It just doesn't work. If you want to protect or hide content, I would wait until there is an extension that will tie categories or pages to user groups and then use the vbwiki tool to match wiki user groups and vb groups. Seriously, a wiki is not designed or intended to protect or show content. It is a tool to openly share information where everyone can edit it. If you need to hide or protect information, mediawiki is not the tool you are looking for. |
Thanks for the list of holes. Looks like I have a few more plugins to write.:)
|
I find this hack very useful for notifying unregistered users on the benefits of signing up, or notifying other user groups about events or things that need to be accomplished in the wiki.
Don't give up on it! |
Anyone know if this mod will work with 3.7?
|
All times are GMT. The time now is 05:04 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|