View Full Version : Integration with vBulletin - CES Wiki Conditionals
thincom2000
05-13-2007, 10:00 PM
CES WIKI CONDITIONALS
Version: 1.1.0
Requires vbWiki (https://vborg.vbsupport.ru/showthread.php?t=136242) 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.
<if condition="code"> ... <else /> ... </if>
Known Issues:
- 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: 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
RedGTiVR6
05-14-2007, 06:12 PM
sweet!
thanks for this!
Kiint
05-14-2007, 08:03 PM
Could we have a better description of what this does please?
Template conditionals?
thincom2000
05-15-2007, 01:06 AM
You can use the <if> ... <else /> tags from vBulletin's template system within wiki articles.
majorxp
05-17-2007, 12:17 AM
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?
Wayne Luke
05-17-2007, 12:28 AM
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?
I can think of some examples.
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.
majorxp
05-17-2007, 03:02 AM
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.
1) You have a documentation Wiki and want to include additional information for staff members outside of the public eye....and one bad edit by a user and the private information is shared with everyone. If you allow all users to edit, someone will eventually foul it up. If you don't allow users to edit, why are you using a wiki? Also, see below for ways to get around the code parsing to show the entire page anyway.
2) You want to leave annotations within an article to the author of the page.Isn't that what the discussion page is for?
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.Again, see #1. If you want to include adverts in the wiki (and you are using vbpro as this tool requires) then just edit the vB templates instead to conditionally include them (or add the logic to the template php page).
I am sure there are a million and one things that could be done.This enables strong functionality that is not normally given to regular users of a site. Furthermore, it is easily broken by a bad edit.
I did install the code on my running server and expected it to fail some simple 'hack' tests.
I tried inclusion on pages with code, and the resulting pages also parsed the code. I halfway expected this test to fail, but it didn't. Result = Pass.
I accessed the page using action=raw and I was able to see the raw code as well as all the content (including what should have been hidden from me). Result = Fail.
I searched pages for code "condition" and other code samples that I knew to exist in my test pages in lots of different ways. I seriously expected this to fail, and still can't figure out how exactly it passes, but no matter what I tried, I could not successfully search for code. Result = Pass.
I looked at the rss output of the pages including code and was able to see the fully generated page with all the code in the diffs. No matter how I tried to edit and cover my tracks, it was impossible to hide from rss. Result = Fail.Two out of for test isn't bad. I expected worse. Not to go on a rant here, but additionally... I'm a little weary of giving users the ability to add vB conditionals to wiki pages at their whim. I'm really not sure why, but it is just waiting for someone to take advantage of somehow....
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).
thincom2000
05-18-2007, 04:22 PM
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.
RedGTiVR6
05-18-2007, 05:37 PM
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?
thincom2000
05-18-2007, 06:53 PM
Glad this newest version is finally working for you, RedGTiVR6.
Wayne Luke
05-18-2007, 06:58 PM
This enables strong functionality that is not normally given to regular users of a site. Furthermore, it is easily broken by a bad edit.
Then don't use it. Quite simply, I see a Wiki as simply another form of content management. I may not want the general public to change my content and integrations like this allow me to lock things down without worrying about protecting every page.
RedGTiVR6
05-25-2007, 02:20 PM
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? :)
thincom2000
05-26-2007, 01:11 AM
What are you trying to accomplish?
A frequently used condition on my own and probably most other forums utilizing this hack is
is_member_of($bbuserinfo, array(USER/MEMBERGROUP IDS SEPARATED BY COMMAS))
RedGTiVR6
05-29-2007, 10:02 PM
that's what I was looking for!
Thanks!
Now, I've put the following at the beginning of this article:
<if condition="is_member_of($bbuserinfo, array(6))">
Doesn't work.
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?
thincom2000
05-30-2007, 02:58 AM
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:
function arcane_vb_fetch_hook( $hookname )
{
arcane_vb_enter_vbulletin_mode();
$hook = vBulletinHook::fetch_hook( $hookname );
arcane_vb_leave_vbulletin_mode();
}Replace with:
function arcane_vb_fetch_hook( $hookname )
{
arcane_vb_enter_vbulletin_mode();
$hook = vBulletinHook::fetch_hook( $hookname );
arcane_vb_leave_vbulletin_mode();
return $hook;
}
RedGTiVR6
05-30-2007, 12:59 PM
Warning: require_once(/.../vbulletin/vbWiki/vbConditions.php) [function.require-once (http://www.mp3car.com/wiki/function.require-once)]: failed to open stream: No such file or directory in /.../vbulletin/vbWiki/vbWiki.php(38) : eval()'d code on line 1
Fatal error: require_once() [function.require (http://www.mp3car.com/wiki/function.require)]: Failed opening required '/.../vbulletin/vbWiki/vbConditions.php' (include_path='/.../wiki:/home/mp3car/public_html/wiki/includes:/home/mp3car/public_html/wiki/languages:.:/usr/lib/php:/usr/local/lib/php') in /.../vbulletin/vbWiki/vbWiki.php(38) : eval()'d code on line 1
That's the error I get when I make the change to the code that you suggested.
thincom2000
05-30-2007, 03:38 PM
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.
RedGTiVR6
05-30-2007, 06:07 PM
Added the double quotes as you suggested.
The wiki page will come up, but this is at the top of it:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /.../vbulletin/vbWiki/vbWiki.php(38) : eval()'d code on line 1
thincom2000
05-31-2007, 02:27 AM
And you do have vbConditions.php in the vbWiki folder?
RedGTiVR6
05-31-2007, 02:39 AM
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.
thincom2000
05-31-2007, 02:45 AM
Okay that's a step in the right direction...
RedGTiVR6
05-31-2007, 02:50 AM
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?
thincom2000
05-31-2007, 02:54 AM
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.
RedGTiVR6
05-31-2007, 03:07 AM
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?
thincom2000
05-31-2007, 02:13 PM
That understanding is correct.
EDIT: I noticed what you said about using <else />. I will fix that for the next build, thanks.
RedGTiVR6
05-31-2007, 03:00 PM
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.
RedGTiVR6
05-31-2007, 05:55 PM
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?
majorxp
05-31-2007, 06:06 PM
Then don't use it. Quite simply, I see a Wiki as simply another form of content management. I may not want the general public to change my content and integrations like this allow me to lock things down without worrying about protecting every page.
I'm incredibly confused by this message.
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.
thincom2000
05-31-2007, 11:02 PM
Working on this... How do you view the RSS output of the page? Is this a new feature in MW 1.10?
majorxp
06-01-2007, 02:54 PM
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/wiki.php?egg=Special:Recentchanges&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/wiki.php?egg=Special:Recentchanges&days=100
From there, you can look at this page:
http://www.crackedeggstudios.net/wiki.php?title=In_Development&diff=2293&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/wiki.php?egg=In_Development&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/wiki.php?Special:Search?ns0=1&search=links&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.
thincom2000
06-01-2007, 03:39 PM
Thanks for the list of holes. Looks like I have a few more plugins to write.:)
sub_ubi
02-21-2008, 03:52 AM
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!
RedGTiVR6
02-27-2008, 06:21 PM
Anyone know if this mod will work with 3.7?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.