The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Plugin - Problems
Hi..
I created a plugin called "foto_post". this plugin is for return de ID of attachment inserted in a post. The code: $foto_post = $db->query_read(" SELECT attachmentid FROM vb_attachment AS vb_attachment LEFT JOIN vb_post AS vb_post ON vb_post.threadid = vb_attachment.contentid AND vb_post.threadid = intval(". $vbulletin->threadinfo(''threadid) .") WHERE vb_attachment.contentid IN(". $vbulletin->postinfo(''postid) .") LIMIT 1 "); In the template: {vb:raw foto_post } When I run this SQL in my database, the return is ok, but in the template dont work. Please, help me.. Best regards.. |
#2
|
||||
|
||||
If you are going to query_read, then you need to then fetch_array in order to get the data. If you are only returning one field (LIMIT 1), then use query_first instead and then you don't need to fetch_array.
|
#3
|
|||
|
|||
Ahh. thanks for the tips..
I will try this. --------------- Added [DATE]1364241814[/DATE] at [TIME]1364241814[/TIME] --------------- Code:
$numericvar1 = intval($vbulletin->treadinfo('threadid')); $numericvar2 = intval($vbulletin->postinfo('postid')); $foto_post = $db->query_first(" SELECT attachmentid FROM vb_attachment AS vb_attachment LEFT JOIN vb_post AS vb_post ON vb_post.threadid = vb_attachment.contentid AND vb_post.threadid = $numericvar1 WHERE vb_attachment.contentid IN ($numericvar2)"); vB_Template::preRegister('activitystream_forum_post',array('foto_post' => $foto_post)); The error in activity stream is Fatal error: Call to a member function treadinfo() on a non-object in /home/fazedore/public_html/forums/vb/activitystream/view.php(166) : eval()'d code on line 1 What you think about it? |
#4
|
||||
|
||||
What are these lines supposed to do? (And I don't believe you spelled threadinfo correctly.)
PHP Code:
|
#5
|
|||
|
|||
Well..
I'm learning Vbulletin I want to show in the activity stream the last attach of the posts. At moment i used a external script in PHP and call him in a IFRAME. But i want to use the functions of the VBulletin to do this. see our site in vbulletin: http://www.fazedoresdechuva.com/ Thanks a lot! |
#6
|
||||
|
||||
What hook location are you using? If one of the postbit_* ones, then the threadid and postid should already be available as $post[threadid] and $post[postid].
|
#7
|
|||
|
|||
activity_view_start is the hook location.
|
#8
|
||||
|
||||
Did you look that hook up in the code - vb/activitystream/view.php ? What are you expecting to get a threadid from at that point? No query has been run, so there isn't anything to get a thread or post id from.
I'm not really familiar with the activitystream code, and I'm about to be off on vacation, so hopefully if you have more questions someone else can help you out. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|