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 11-23-2012, 01:44 PM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default add plug-in, can't submit

Hello,
I have a plug-in:
Code:
if ($vbulletin->options['enable'] AND (THIS_SCRIPT=='newthread'))
{
	if (in_array($forumid, explode(",", $vbulletin->options[enable_forumid'])))
	{
		$getinfos = $vbulletin->db->query_read("
			SELECT postuserid, threadid, postdate 
			FROM " . TABLE_PREFIX . "testting
			WHERE postuserid = " . $vbulletin->userinfo['userid'] . "
			GROUP BY threadid
			ORDER BY threadid ASC
		");	
		$count = $vbulletin->db->num_rows($getinfos);
		if ($count = 0)
		{
			$mytest = '<option value="0" selected="selected">0</option>';
			while ($getinfo = $vbulletin->db->fetch_array($get_infos))
			{
				$mytest = '<option value="' . $getinfo[threadid] . '">'. $getinfo[threadid] . '</option>';
			}
		}

	}
}
I put it in hook newthread_start, but when I click submit it does not work (can not new thread). Pls help me.
Thank

This is video: http://www.youtube.com/watch?v=sNtKvZ90Ews
Reply With Quote
  #2  
Old 11-23-2012, 01:59 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You have a few typos in there. Try this:

Code:
if ($vbulletin->options['enable'] AND (THIS_SCRIPT=='newthread'))
{
	if (in_array($forumid, explode(",", $vbulletin->options['enable_forumid'])))
	{
		$getinfos = $vbulletin->db->query_read("
			SELECT postuserid, threadid, postdate 
			FROM " . TABLE_PREFIX . "testting
			WHERE postuserid = " . $vbulletin->userinfo['userid'] . "
			GROUP BY threadid
			ORDER BY threadid ASC
		");	
		$count = $vbulletin->db->num_rows($getinfos);
		if ($count > 0)
		{
			$mytest = '<option value="0" selected="selected">0</option>';
			while ($getinfo = $vbulletin->db->fetch_array($get_infos))
			{
				$mytest = '<option value="' . $getinfo[threadid] . '">'. $getinfo[threadid] . '</option>';
			}
		}
			$templater = vB_Template::create('test_newthread');
				$templater->register('mytest', $mytest);
			$out .= $templater->render();
		
		$vbulletin->templatecache['newthread'] = str_replace('\'' . $messagearea . '\'', '<div class="blockrow">' . $out . '</div>\'' . $messagearea . '\'', $vbulletin->templatecache['newthread']);
	}
}
Reply With Quote
  #3  
Old 11-23-2012, 02:16 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Now that I look at it again, I might have messed up your str_replace() line, you probably had it right.
Reply With Quote
  #4  
Old 11-23-2012, 02:25 PM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

remains unchanged, can not submit

You can view here
http://www.youtube.com/watch?v=sNtKvZ90Ews
Reply With Quote
  #5  
Old 11-23-2012, 03:42 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

And that problem goes away if you disable your plugin? It must be another problem with the plugin (I guess that's obvious ). I notice on the first line you have this:

Code:
if ($vbulletin->options['enable'] AND (THIS_SCRIPT=='newthread'))

shouldn't it be 'enable_forumid'?

Edit: also, is your table named "testting"?
Reply With Quote
  #6  
Old 11-23-2012, 03:42 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Don't you want it to be like this?


PHP Code:
while ($getinfo $vbulletin->db->fetch_array($get_infos))
            {
                
$mytest .= '<option value="' $getinfo[threadid] . '">'$getinfo[threadid] . '</option>';
            } 
(Note the .= instead of just = )
Reply With Quote
Благодарность от:
kh99
  #7  
Old 11-23-2012, 03:53 PM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
And that problem goes away if you disable your plugin? It must be another problem with the plugin (I guess that's obvious ). I notice on the first line you have this:

Code:
if ($vbulletin->options['enable'] AND (THIS_SCRIPT=='newthread'))

shouldn't it be 'enable_forumid'?

Edit: also, is your table named "testting"?
Code:
if ($vbulletin->options['enable'] AND (THIS_SCRIPT=='newthread'))
in iframe retrieve data from a table testting and

if ($vbulletin->options['enable'] = if enable
THIS_SCRIPT=='newthread' = show only new thread
Reply With Quote
  #8  
Old 11-23-2012, 03:55 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Easy5s.net View Post
if ($vbulletin->options['enable'] = if enable
OK, if your enable/disable option varname is 'enable', that's fine. ETA: but normally you'd want to choose something less common (like adding a unique prefix), because if everyone just used "enable" you wouldn't be able to install more than one mod without a conflict. But I don't see how that could cause your problem, even if there was a comflict.
Reply With Quote
  #9  
Old 11-23-2012, 04:17 PM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this is my templater

Code:
<vb:if condition="$show['member'] AND $vboptions['enable']">
<form name="threadid" action="javascript:get(this.parentNode);" id="threadid" method="post">
	<input type="hidden" id="s" name="s" value="{vb:raw session.sessionhash}" />
	<input type="hidden" id="securitytoken" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
	<div>Select ThreadID To Post: 
		<select id="threadid" name="threadid" onChange="javascript:get(this.parentNode);">
<option value="0" selected="selected">0</option>
			{vb:raw mytest}
		</select>
	</div>
	<div id="threadid"></div>
</form>
</vb:if>
Reply With Quote
  #10  
Old 11-23-2012, 04:43 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Any way we can actually see the results of your plugin on a page?
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 06:49 PM.


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.04291 seconds
  • Memory Usage 2,272KB
  • Queries Executed 13 (?)
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
  • (6)bbcode_code
  • (1)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (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_postinfo_query
  • fetch_postinfo
  • 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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete