PDA

View Full Version : [Plugin AME] how to force video bbcode parsing ?


developpez.com
03-03-2011, 04:48 PM
Hello everybody,

I am currently working on a php webservice that creates topics in my vbulletin forum.

The webservice is running as

$threaddm = new vB_DataManager_Thread_FirstPost($vbulletin, ERRTYPE_STANDARD);

$threaddm->do_set('forumid', $forumid);
$threaddm->do_set('userid', $user);
$threaddm->do_set('username', $username);
$threaddm->do_set('pagetext', $message);
$threaddm->do_set('title', $subject);
$threaddm->do_set('allowsmilie', $allowsmilie);
$threaddm->do_set('visible', $visible);
$showsignature = true;
$threaddm->do_set("showsignature", $showsignature);

$tid = $threaddm->save();

This works fine, the bbcode inside $message is correctly rendered when I display the created topic.
But ... I'm using the AME plugin (2.5) to display videos in the post messages. A basic youtube url inserted in the message has to be replaced with a youtube block, and it works fine when the message is entered manually in the forum.
If I provide a youtube url in the $message variable in my webservice, it is not converted in a youtube block when displayed. It seems that some vbulletin hooks are not triggered, and something about AME is missing in my code.

I have tried to call directly some AME functions to parse myself the whole bbcode and to write it into the postparsed table but the html rendered is not that well rendered and this idea may be dangerous (I think)
Do I need to trigger a vbulletin hook (even if my code is absolutely not inside a classic vbulletin stream) ? Do I need to add some more code about AME plugin ?

Anyone knows what I did wrong ?
Thanks for your help

BirdOPrey5
03-03-2011, 07:54 PM
With AME installed there is a field added on to each post in the database, AME_Flag I believe (Or something very close to that.) In posts with no AME content it is zero, but in posts with embedded videos it's not zero, on my forum it looks like it's 2 if there is embedded media.

I'm not sure but maybe try to set the flag manually when adding your thread/post.

developpez.com
03-08-2011, 12:20 PM
Adding by myself the [ame] tags around the video urls helped the parsing.