vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Plugin for Postbil_legacy - show number of custom photo records for each member (https://vborg.vbsupport.ru/showthread.php?t=188213)

fabioski 08-15-2008 12:34 PM

Plugin for Postbil_legacy - show number of custom photo records for each member
 
In my forum each member can post photos with a customized page. I save in a Database table photo infos (member who upload photo, title, kb of photo, etc).

I want to display under avatar a link to personal member photo page. I am able to do this with this plugin created for postbit_display_complete:
Code:

// Utente di riferimento del post
$obj_userid = $post[userid];
$obj_username = $post[musername];

$testo_libri .= "<div><a title=\"Libreria personale utente $obj_username\" href=\"http://www.forumlibri.com/libri/my-$obj_userid/index.html\">Libreria personale $obj_username</a></div>";

I also want to show in the link THE NUMBER OF UPLOAD PHOTO for each member.
I try to use this query in the same plug-in:
Code:

// calcolo il numero di libri nella libreria personale
$numerolibri = $db->query_first_slave("
    SELECT *
    FROM tab_mylib
    WHERE myl_userid = '1'
");

But VBulletin show me this error:
Quote:

Fatal error: Call to a member function query_first_slave() on a non-object in /var/www/web157/html/forum/includes/class_postbit.php(293) : eval()'d code on line 8
How can I obtain the number of uploaded photos for each member and show it under the avatars space?

Opserty 08-15-2008 02:31 PM

Instead of $db try $this->dbobject

fabioski 08-15-2008 03:54 PM

This query works:
$this->registry->db->query_read("
SELECT COUNT(*) AS numerolibri
FROM tab_mylib
WHERE myl_userid = '1'
");

but don't work this line:

$testo_libri .= "$this[numerolibri]";

WHY?
Many thanks

Opserty 08-15-2008 08:53 PM

You need it like this:
PHP Code:


$numerolibri 
$this->registry->db->query_first("
SELECT COUNT(*) AS numerolibri
FROM tab_mylib
WHERE myl_userid = '1'
"
);

$testo_libri .= $numerolibri['numerolibri']; 



All times are GMT. The time now is 03:50 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.02459 seconds
  • Memory Usage 1,720KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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