View Full Version : add plug-in, can't submit
Easy5s.net
11-23-2012, 01:44 PM
Hello,
I have a plug-in:
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
You have a few typos in there. Try this:
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']);
}
}
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
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:
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?
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
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:
if ($vbulletin->options['enable'] AND (THIS_SCRIPT=='newthread'))
shouldn't it be 'enable_forumid'?
Edit: also, is your table named "testting"?
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
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 :(
<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?
Easy5s.net
11-23-2012, 04:48 PM
Anyway we can actually see the results of your plugin on a page?
This is MAIN SCRIPT and one plug-in https://vborg.vbsupport.ru/showpost.php?p=2384206&postcount=1
if (!$vbulletin->options['enable'])
{
eval(standard_error(fetch_error('enable')));
}
if ($vbulletin->userinfo['userid']==0)
{
print_no_permission();
}
$navbits[''] = 'Posting System';
$navbits = construct_navbits($navbits);
$navbar = render_navbar_template($navbits);
$templater = vB_Template::create('page_main');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('mytest', $mytest);
print_output($templater->render());
Lynne
11-23-2012, 04:55 PM
Your plugin shouldn't look like the one in the first post any longer after the changes.
I was wondering if we can see this actually working on your site.
Easy5s.net
11-23-2012, 05:03 PM
Your plugin shouldn't look like the one in the first post any longer after the changes.
I was wondering if we can see this actually working on your site.
now I'm just working on localhost, no website. You can view video again
http://www.youtube.com/watch?v=sNtKvZ90Ews
nhawk
11-23-2012, 05:12 PM
Sometimes it's the obvious that will kill you.
Newthread editor is a form and you can't have a form inside of a form like you have now.
Just add the <div> sections without the form attributes.
<vb:if condition="$show['member'] AND $vboptions['enable']">
<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>
</vb:if>
Easy5s.net
11-24-2012, 12:54 AM
Sometimes it's the obvious that will kill you.
Newthread editor is a form and you can't have a form inside of a form like you have now.
Just add the <div> sections without the form attributes.
<vb:if condition="$show['member'] AND $vboptions['enable']">
<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>
</vb:if>
But change with code above, i can't Select ThreadID To Post, because it is not show value.
In temp, line:
<form name="threadid" action="javascript:get(document.getElementById('threadid') );" id="threadid" method="POST">
error:
Parse error: syntax error, unexpected T_STRING in C:\server\htdocs\testvb4\includes\class_core.php(4 633) : eval()'d code on line 82
(I have to leave it temporarily is no value to be free from defects)
--------------- Added 1353760275 at 1353760275 ---------------
pls help me fix :(
--------------- Added 1353771301 at 1353771301 ---------------
bump bump
Lynne
11-24-2012, 05:05 PM
I can't help since I can't see the problem, sorry. I need to be able to view source code and such to see what is up.
Easy5s.net
11-25-2012, 01:50 AM
I can't help since I can't see the problem, sorry. I need to be able to view source code and such to see what is up.
this is plugin and temp, pls view attach file.
Lynne
11-25-2012, 01:56 AM
You don't actually have the <?php at the beginning of the plugin, right?
The code doesn't help me since I can't install it on my site - I have no table vcardposting so I get no results.
Easy5s.net
11-25-2012, 02:06 AM
You don't actually have the <?php at the beginning of the plugin, right?
The code doesn't help me since I can't install it on my site - I have no table vcardposting so I get no results.
pls check again
Easy5s.net
11-25-2012, 01:17 PM
Who can help me, pls :(
What nhawk said before is true - you cannot use the <form> tags. What problem are you having now? I didn't understand the error message you posted above, maybe because I don't understand exactly what the javascript is trying to do.
Easy5s.net
11-25-2012, 03:16 PM
What nhawk said before is true - you cannot use the <form> tags. What problem are you having now? I didn't understand the error message you posted above, maybe because I don't understand exactly what the javascript is trying to do.
I did as nhawk said, but not work, and in VB3 it still works fine :(.
This is file .js
Lynne
11-25-2012, 03:22 PM
This line in your plugin:
$templater->register('mylist', $mylist);
You have no variable $mylist, so why are you registering it for use? Don't you mean $mylistcardposted ? If so, you also need to change that variable name in the template too.
I did as nhawk said, but not work, and in VB3 it still works fine :(.
Oh, I missed the part where it works in vb3. Maybe that will work then, I'm not sure.
Easy5s.net
11-25-2012, 03:28 PM
This line in your plugin:
$templater->register('mylist', $mylist);
You have no variable $mylist, so why are you registering it for use? Don't you mean $mylistcardposted ? If so, you also need to change that variable name in the template too.
I changed it to sync, but it is only current issues show up temp (or can add temp by hand).The problem I'm interested in is this plug in it can not submit thread.
Please review video once more options has been shown on newthread but cannot be submit
You can add my plugin to attach and test.
Lynne
11-25-2012, 04:13 PM
I cannot test something that is incorrect. You CANNOT have <form> tags in your template. You CANNOT put a form within a form or it WILL NOT WORK. Take a look at your page source - you have a form within a form. That WILL NOT WORK.
Easy5s.net
11-25-2012, 04:37 PM
I tried again and it worked, thank for all :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.