Hey ozzy, can you instruct me on how to fix this for displaying in the announcements portion of the forum?
I feel so close... lol
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<product productid="ozzy_new_thread_button" active="1">
<title><![CDATA[[Ozzy47] Post New Thread Button In Posts]]></title>
<description>This mod adds a Post New Thread button to posts</description>
<version>1.0.0</version>
<url>https://vborg.vbsupport.ru/showthread.php?t=301929</url>
<versioncheckurl><![CDATA[https://vborg.vbsupport.ru/misc.php?do=productcheck&pid=ozzy_new_thread_button]]></versioncheckurl>
<dependencies>
</dependencies>
<codes>
</codes>
<templates>
</templates>
<stylevardfns>
</stylevardfns>
<stylevars>
</stylevars>
<plugins>
<plugin active="1" executionorder="5">
<title>Usergroups Allowed To See The Buttons</title>
<hookname>admin_options_processing</hookname>
<phpcode><![CDATA[if (is_array($settings['ozzy_new_thread_button_groups']))
{
$settings['ozzy_new_thread_button_groups'] = implode(',', $settings['ozzy_new_thread_button_groups']);
}]]></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>Add Buttons To The Post</title>
<hookname>parse_templates</hookname>
<phpcode><![CDATA[// ##################### DEFINE IMPORTANT CONSTANTS #######################
global $vbulletin, $vbphrase;
//set the session
$sessionurl = $session['sessionurl'];
//set the phrase
$post_new_thread = $vbphrase['post_new_thread'];
//get forum
$forumid = $GLOBALS['forumid'];
// #############################################################################
// ########################### START MAIN SCRIPT ###############################
// #############################################################################
do
{
if (!$vbulletin->options['ozzy_new_thread_button_active'])
{
// Product is inactive
break;
}
if (THIS_SCRIPT != 'announcement')
{
// Only run on announcement
break;
}
if (!is_member_of($vbulletin->userinfo, explode(',', $vbulletin->options['ozzy_new_thread_button_groups'])))
{
// Ensure not to run if user in not in allowed usergroup
break;
}
//Set the button and link
$new_thread_button = '<div style="padding-left:145px; position: relative"><a href="newthread.php?' . $sessionurl . 'do=newthread&f=' . $forumid . '" rel="nofollow" class="newcontent_textcontrol" id="new_thread_button" style="margin-left:10px;"><span>+</span> ' . $post_new_thread . '</a></div>';
//Show button on top
if ($vbulletin->options['ozzy_new_thread_button_above'])
{
$find = '<div id="announcementlist">"';
$replace = $new_thread_button.$find;
$vbulletin->templatecache['announcement'] = str_replace($find, $replace, $vbulletin->templatecache['announcement']);
}
//Show button below
if ($vbulletin->options['ozzy_new_thread_button_below'])
{
$find = '{vb:raw forumjump}"';
$replace = $new_thread_button.$find;
$vbulletin->templatecache['announcement'] = str_replace($find, $replace, $vbulletin->templatecache['announcement']);
}
}
while (false);]]></phpcode>
</plugin>
</plugins>
<phrases>
<phrasetype name="vBulletin Settings" fieldname="vbsettings">
<phrase name="setting_ozzy_new_thread_button_above_desc" date="1378432022" username="ozzy47" version="1.0.0"><![CDATA[Set this to "Yes" to show the button above the posts.]]></phrase>
<phrase name="setting_ozzy_new_thread_button_above_title" date="1378432022" username="ozzy47" version="1.0.0"><![CDATA[Show The Button Above The Posts]]></phrase>
<phrase name="setting_ozzy_new_thread_button_active_desc" date="1378431927" username="ozzy47" version="1.0.0"><![CDATA[Set this to "Yes" to show a new thread button in posts.]]></phrase>
<phrase name="setting_ozzy_new_thread_button_active_title" date="1378431927" username="ozzy47" version="1.0.0"><![CDATA[New Thread Button Active]]></phrase>
<phrase name="setting_ozzy_new_thread_button_below_desc" date="1378432076" username="ozzy47" version="1.0.0"><![CDATA[Set this to "Yes" to show the button below the posts.]]></phrase>
<phrase name="setting_ozzy_new_thread_button_below_title" date="1378432076" username="ozzy47" version="1.0.0"><![CDATA[Show The Button Below The Posts]]></phrase>
<phrase name="setting_ozzy_new_thread_button_groups_desc" date="1378432183" username="ozzy47" version="1.0.0"><![CDATA[Select which usergroups are allowed to see the Post New Thread button.]]></phrase>
<phrase name="setting_ozzy_new_thread_button_groups_title" date="1378432183" username="ozzy47" version="1.0.0"><![CDATA[Usergroups Allowed To See The Buttons]]></phrase>
<phrase name="settinggroup_ozzy_new_thread_button_settings" date="1378431843" username="ozzy47" version="1.0.0"><![CDATA[Ozzy: New Thread Button Settings]]></phrase>
</phrasetype>
</phrases>
<options>
<settinggroup name="ozzy_new_thread_button_settings" displayorder="65535">
<setting varname="ozzy_new_thread_button_active" displayorder="10">
<datatype>boolean</datatype>
<optioncode>yesno</optioncode>
<defaultvalue>1</defaultvalue>
</setting>
<setting varname="ozzy_new_thread_button_above" displayorder="20">
<datatype>boolean</datatype>
<optioncode>yesno</optioncode>
<defaultvalue>1</defaultvalue>
</setting>
<setting varname="ozzy_new_thread_button_below" displayorder="30">
<datatype>boolean</datatype>
<optioncode>yesno</optioncode>
<defaultvalue>1</defaultvalue>
</setting>
<setting varname="ozzy_new_thread_button_groups" displayorder="40">
<datatype>free</datatype>
<optioncode><![CDATA[" . eval('$options = "";
foreach($vbulletin->usergroupcache AS $usergroupid => $usergroup)
{
$options .= "\\t\\t</b><div class=\\"smallfont\\" style=\\"width: 50%; float: left;\\"><label for=\\"setting[$setting[varname]]$usergroupid\\"><input type=\\"checkbox\\" name=\\"setting[$setting[varname]]"."[]\\" id=\\"setting[$setting[varname]]$usergroupid\\" value=\\"$usergroupid\\"" . iif(strpos(",$setting[value],", ",$usergroupid,") !== false, \' checked="checked"\') . iif($vbulletin->debug, " title=\\"name="setting[$setting[varname]]"\\"") . " tabindex=\\"1\\" />$usergroup[title]</label></div>\\n";
}
return "<span class=\\"smallfont\\">\\n$options\\t</span>";') . "<input type=\"hidden\" name=\"setting[$setting[varname]][]\" value=\"-1\" />]]></optioncode>
<defaultvalue>5,6,7</defaultvalue>
</setting>
</settinggroup>
</options>
<helptopics>
</helptopics>
<cronentries>
</cronentries>
<faqentries>
</faqentries>
<navigation>
</navigation>
</product>