vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Design and Graphics Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=253)
-   -   Plugin - Problems (https://vborg.vbsupport.ru/showthread.php?t=296487)

CesarMcd 03-25-2013 10:46 AM

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..:confused:

Lynne 03-25-2013 03:57 PM

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.

CesarMcd 03-25-2013 07:49 PM

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));

This is intire code of my plugin. but don't work. :(

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?

Lynne 03-26-2013 12:23 AM

What are these lines supposed to do? (And I don't believe you spelled threadinfo correctly.)

PHP Code:

$numericvar1 intval($vbulletin->treadinfo('threadid'));
$numericvar2 intval($vbulletin->postinfo('postid')); 


CesarMcd 03-26-2013 12:50 PM

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!

Lynne 03-26-2013 05:38 PM

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].

CesarMcd 03-26-2013 06:32 PM

activity_view_start is the hook location.

Lynne 03-26-2013 09:47 PM

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.


All times are GMT. The time now is 08:16 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00996 seconds
  • Memory Usage 1,727KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete