vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   add plug-in, can't submit (https://vborg.vbsupport.ru/showthread.php?t=291515)

Easy5s.net 11-23-2012 01:44 PM

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

kh99 11-23-2012 01:59 PM

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']);
        }
}


kh99 11-23-2012 02:16 PM

Now that I look at it again, I might have messed up your str_replace() line, you probably had it right.

Easy5s.net 11-23-2012 02:25 PM

remains unchanged, can not submit :(

You can view here
http://www.youtube.com/watch?v=sNtKvZ90Ews

kh99 11-23-2012 03:42 PM

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"?

Lynne 11-23-2012 03:42 PM

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

Easy5s.net 11-23-2012 03:53 PM

Quote:

Originally Posted by kh99 (Post 2384226)
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

kh99 11-23-2012 03:55 PM

Quote:

Originally Posted by Easy5s.net (Post 2384234)
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.

Easy5s.net 11-23-2012 04:17 PM

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>


Lynne 11-23-2012 04:43 PM

Any way we can actually see the results of your plugin on a page?


All times are GMT. The time now is 04:15 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.01195 seconds
  • Memory Usage 1,757KB
  • 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
  • (6)bbcode_code_printable
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete