The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
So desperate: writing a plugin for bbcode_parse_start
i spent so much time and can't find the last piece of puzzle
i am writing a plugin which enables on bbcode_parse_start. i'm hiding specific bbtags based on the user permissions, but that doesn't matter now: for that i need to access user id variable, so i can look for the privileges (privileges of the user who wrote the post, not the viewer). but those vary in every place of the vbulletin. cms, blog, forums, pm, . . . is is a complete mess for forum posts it's $post['userid'], sometimes it's $postinfo['userid'], inside pms it's $pm['fromuserid'], inside blogposts it's inside $this->parse_userinfo['userid'] (talk about consistency..) but the only thing that i haven't been able to find is: the cms article comments, i looked into specifications, searched the hell out of google nothing how do i access user id inside the cms article comments? |
#2
|
||||
|
||||
According to the template, vbcms_postbit, the $post variable is being used.
|
#3
|
|||
|
|||
nope..
global $post; print_r($post); ..empty string i think that postbit are different than the article comments. i tried erasing the whole vbcms_postbit and the comments stayed edit: okay, i did print_r($GLOBALS); and there is absolutely no trace about the posts. it must be in some object. but what object? it's not inside $this --------------- Added [DATE]1285801868[/DATE] at [TIME]1285801868[/TIME] --------------- i found that it is using vbcms_postbit_legacy. it shows a lot of {vb:raw post...} but calling global $post simply does not work is this a bug? can someone confirm this? calling global $post inside bbcode_parse_start on the article comments page gives you empty $post, while it should provide the post data? can please someone confirm this bug also, there is "postbit_start" hook on the beginning of the template, but no option for it inside the plugin manager |
#4
|
||||
|
||||
Are you even sure that function (and thus the hook) is called in the CMS? If you look at package/vbcms/bbcode/html.php, it does call the class_bbcode.php file, however it doesn't ever use the function parse from that file. I looked on a few cms pages (articles, edit articles, create articles) and that hook location never shows up as being called at all.
Quote:
|
#5
|
|||
|
|||
yep, the plugin hook is being called
when you create a dummy bbcode_parse_start, and include something like echo('test');, it will appear in the output (you must have some comments on an article first, of course) you can even do something like this: write something bold in an article commentary, then paste this into your bbcode_parse_start enabled hook: Code:
$this->tag_list['no_option']['b'] = array( 'html' => "i got called", 'strip_empty' => true ); so, while you can access the bbcode inside the post, you can't seem to access the poster's info like userid try it |
#6
|
|||
|
|||
If the $post is inside a function where there's no "global $post", using "global $post" somewhere else won't make it available. But of course if there's a hook inside that function before the bbcode parser is called you could make it available via a global. (And if there's no hook you could always just change the code if you're that desperate).
|
#7
|
||||
|
||||
Are you getting it to do anything with the post username in other areas (not cms comments)? It just doesn't look like the info gets passed there except for the $text itself.
|
#8
|
|||
|
|||
yes, all the other areas work. regular forum posts for example
(btw it's userid that's interesting, not username) do you think that this bug has to do something with the fact that the user comments are handled as new posts inside hidden forum called "vBCms Comments"? |
#9
|
||||
|
||||
I really don't know as I have not done anything with bbcode parsing before.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|