Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-22-2013, 06:29 PM
Honourable Honourable is offline
 
Join Date: Oct 2010
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default creating plugin issue

Hi,

I would like

to run this plugin

PHP Code:
$this->registry->db->query_read_slave(("SET CHARACTER SET utf8");
$stream =  $this->registry->db->query_read_slave(("                        
            SELECT stream.*, users.* FROM " 
TABLE_PREFIX "dmods_stream AS stream
            INNER JOIN " 
TABLE_PREFIX "user AS users USING (userid)
            WHERE stream.touserid = 0 || stream.touserid = " 
$this->registry->userinfo['userid'] . "
            ORDER BY stream.dateline DESC  
        "
);

        
$streamHTML "";

while(
$item $this->registry->db->fetch_array($stream)) {

            if (
$item['type'] == 'status') {
                        
            
// Unserialize params
            
$streamdata unserialize($item['parameters']);
            
            
$templater vB_Template::create('lywomen_allstatuses');

            
$templater->register('stream'$streamdata);
            
$templater->register('streaminfo'$item);
            
            
$streamHTML .= $templater->render();

            }
}

vB_Template::preRegister('ad_global_below_navbar', array('streamHTML' => $streamHTML)); 
in this template ad_global_below_navbar

using this

PHP Code:
<ul id="webticker">
{
vb:raw streamHTML}
</
ul
and in this template lywomen_allstatuses which contains the bits

PHP Code:
<li><span class="usersign"><a href="member.php?u={vb:raw streaminfo.userid}">{vb:raw streaminfo.username}</a></span> {vb:raw stream.status}</li

I'm having a problem with the plugin as internal error for whole website once I make it activated I tried to hook the plugin in parse_templates as well as process_templates_complete also loads of hooks but non of them works

some hook places such as procces_templates_complete it does get rid of internal error yet is not doing what it suppose such as displaying data out in ad_global_below_navbar template


any suggestions as I'm makin connection to the database retrieve elements contained within a table then construct out in template

I will be more than happy if I can see any help or hint at least

Many thanks in advance
Reply With Quote
  #2  
Old 06-22-2013, 07:06 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try changing all occurences of $this->registry->db-> to $vbulletin->db-> , and use hook parse_templates.
Reply With Quote
  #3  
Old 06-22-2013, 07:07 PM
Honourable Honourable is offline
 
Join Date: Oct 2010
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

I changed variables names maybe conflict with something else

but it still not working

PHP Code:
$streamxha =  $this->registry->db->query_read_slave(("                        
            SELECT stream.*, users.* FROM " 
TABLE_PREFIX "dmods_stream AS stream
            INNER JOIN " 
TABLE_PREFIX "user AS users USING (userid)
            WHERE stream.touserid = 0 || stream.touserid = " 
$this->registry->userinfo['userid'] . "
            ORDER BY stream.dateline DESC  
        "
);

$streamhtmlxha "";

while(
$itemxha $this->registry->db->fetch_array($streamxha)) {

                        
            
// Unserialize params
            
$streamdataxha unserialize($itemxha['parameters']);
            
            
$templater vB_Template::create('lywomen_allstatuses');

            
$templater->register('streamxha'$streamdataxha);
            
$templater->register('streaminfoxha'$itemxha);
            
            
$streamhtmlxha .= $templater->render();

}

vB_Template::preRegister('ad_global_below_navbar', array('streamhtmlxha' => $streamhtmlxha)); 
looking forward to your help

--------------- Added [DATE]1371931663[/DATE] at [TIME]1371931663[/TIME] ---------------

seconds I will try ur suggestion please dont leave

i will update u in seconds

--------------- Added [DATE]1371931850[/DATE] at [TIME]1371931850[/TIME] ---------------

I changed any occurance of $this->registry->db-> to $vbulletin->db->

adn the hook place to parse_templates

is not working unfurunately

please what do you think?

--------------- Added [DATE]1371931939[/DATE] at [TIME]1371931939[/TIME] ---------------

Also this making a huge conflict as when I browse any registered user with us it tells me
this user is not register once I disable the plugin I can browse users profile with no problem

what do you think?

note the internal error is gone now yet is not display the content that should be retrieved from db
Reply With Quote
  #4  
Old 06-22-2013, 07:18 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can you post again the exact code you're using?
Reply With Quote
  #5  
Old 06-22-2013, 07:19 PM
Honourable Honourable is offline
 
Join Date: Oct 2010
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here u go

PHP Code:
$vbulletin->db->query_read_slave(("SET CHARACTER SET utf8");
$stream =  $vbulletin->db->query_read_slave(("                        
            SELECT stream.*, users.* FROM " 
TABLE_PREFIX "dmods_stream AS stream
            INNER JOIN " 
TABLE_PREFIX "user AS users USING (userid)
            WHERE stream.touserid = 0 || stream.touserid = " 
$this->registry->userinfo['userid'] . "
            ORDER BY stream.dateline DESC  
        "
);

        
$streamHTML "";

while(
$item $vbulletin->db->fetch_array($stream)) {

            if (
$item['type'] == 'status') {
                        
            
// Unserialize params
            
$streamdata unserialize($item['parameters']);
            
            
$templater vB_Template::create('lywomen_allstatuses');

            
$templater->register('stream'$streamdata);
            
$templater->register('streaminfo'$item);
            
            
$streamHTML .= $templater->render();

            }
}

vB_Template::preRegister('ad_global_below_navbar', array('streamHTML' => $streamHTML)); 
Reply With Quote
  #6  
Old 06-22-2013, 07:22 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this:

PHP Code:
$vbulletin->db->query_read_slave("SET CHARACTER SET utf8");
$stream =  $vbulletin->db->query_read_slave("                        
            SELECT stream.*, users.* FROM " 
TABLE_PREFIX "dmods_stream AS stream
            INNER JOIN " 
TABLE_PREFIX "user AS users USING (userid)
            WHERE stream.touserid = 0 || stream.touserid = " 
$vbulletin->userinfo['userid'] . "
            ORDER BY stream.dateline DESC  
        "
);

        
$streamHTML "";

while(
$item $vbulletin->db->fetch_array($stream)) {

            if (
$item['type'] == 'status') {
                        
            
// Unserialize params
            
$streamdata unserialize($item['parameters']);
            
            
$templater vB_Template::create('lywomen_allstatuses');

            
$templater->register('stream'$streamdata);
            
$templater->register('streaminfo'$item);
            
            
$streamHTML .= $templater->render();

            }
}

vB_Template::preRegister('ad_global_below_navbar', array('streamHTML' => $streamHTML)); 
Reply With Quote
  #7  
Old 06-22-2013, 07:23 PM
Honourable Honourable is offline
 
Join Date: Oct 2010
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

still not working???

--------------- Added [DATE]1371932856[/DATE] at [TIME]1371932856[/TIME] ---------------

just to let you know when I delete this bit

PHP Code:
$vbulletin->db->query_read_slave(("SET CHARACTER SET utf8"); 
$stream =  $vbulletin->db->query_read_slave(("                         
            SELECT stream.*, users.* FROM " 
TABLE_PREFIX "dmods_stream AS stream
            INNER JOIN " 
TABLE_PREFIX "user AS users USING (userid) 
            WHERE stream.touserid = 0 || stream.touserid = " 
$vbulletin->userinfo['userid'] . 
            ORDER BY stream.dateline DESC   
        "
); 
I can browse users profile but still not working the sql query seems to me is the issue
as it makes problem in the whole forum if it existed??
Reply With Quote
  #8  
Old 06-22-2013, 07:28 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try the above code again (I just fixed a couple things instead of posting it all again).
Reply With Quote
  #9  
Old 06-22-2013, 07:29 PM
Honourable Honourable is offline
 
Join Date: Oct 2010
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ur last edit works great

please explain to me what was the problem I really want to learn

many thanks in advance
Reply With Quote
  #10  
Old 06-22-2013, 07:31 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, first I should have told you to replace $this->registry with $vbulletin, because there was one that didn't have a ->db on it. $this is used when inside an object method. I guess you copied the code from a class definition, so those had to be changed.

Also, these two lines had extra '(' characters (in red):

Code:
$vbulletin->db->query_read_slave(("SET CHARACTER SET utf8"); 
$stream =  $vbulletin->db->query_read_slave(("
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:26 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04342 seconds
  • Memory Usage 2,316KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (7)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete