MyBB Community Forums

Full Version: Index Ads
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey Guys,

How can I edit the code or whatnot to change the advert header in the plugin 'Index Ads'.

[Image: HEasdJ.png]
are you referring to index ads plugin ? can you elaborate what is required ...
(2011-12-28, 11:24 AM)ranjani Wrote: [ -> ]are you referring to index ads plugin ? can you elaborate what is required ...

Yes, that plugin exactly.
The bit in the screenshot that says 'Index Ads' how can I change that to say: 'Sponsored Link' or something?
just open it in notepad and change text
open ./inc/languages/english/iad.lang.php in a editor (eg. notepad++)
find below code AND change "Index Ads" to whatever you want ; save file & re-upload ..
$l['iad'] = "Index Ads";


(2011-12-28, 05:42 PM)ranjani Wrote: [ -> ]open ./inc/languages/english/iad.lang.php in a editor (eg. notepad++)
find below code AND change "Index Ads" to whatever you want ; save file & re-upload ..
$l['iad'] = "Index Ads";

Am I being blind? I cannot see it anywhere..

<?php
/***************************************************************************
 *
 *  Author: Seyed Vahid Rezaei  
 *  Website: http://30pu.net
 *
 ***************************************************************************/
 
 /****************************************************************************
	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
	
	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/

//Add hook for index header ads
$plugins->add_hook('index_start', 'iad');

//info for index header ads
function iad_info()
{
	return array(
		'name'			=> 'Index Ads',
		'description'	=> 'Insert ADS table in your header/footer of community forum',
		'website'		=> 'http://MyBBhelp.ir',
		'author'		=> 'Persis',
		'authorsite'	=> 'http://30pu.net',
		'version'		=> '1.1',
		'guid'          => '73bed691939b975431755b272f89cfb7',
		'compatibility' => '16*,14*'
	);
}

//actition for index header ads
function iad_activate()
{
    require MYBB_ROOT.'/inc/adminfunctions_templates.php';
    global $db,$mybb;
    $query = $db->simple_select("settinggroups","COUNT(*) as rows");
	$rows = $db->fetch_field($query,"rows");
    $iad_group = array('name' => 'iad','title' => 'Index Ad','description' => 'Settings for Index Ads Plugin','disporder' =>$rows + 1,'isdefault' => '0',);
    $db->insert_query('settinggroups',$iad_group);
	$gid = $db->insert_id();
    $iad_setting_1 = array('name' => 'show','title' =>'On/Off','description' =>'Display Index Ads in Index?','optionscode' => 'onoff','value' => '1','disporder' => 1,'gid' => intval($gid),);
    $iad_setting_2 = array('name' => 'position','title' =>'Position ','description' =>'Where do you want to display Index Ads?','optionscode' => 'select\nheader=Header\nfooter=Footer','value' => 'header','disporder' => 2,'gid' => intval($gid),);
    $iad_setting_3 = array('name' => 'banner','title' =>'Custom text or banner','description' =>'You can enter text or arbitrary code for displayed in below Index Ads.','optionscode' => 'textarea','value' => '','disporder' => 3,'gid' => intval($gid),);
    $db->insert_query('settings',$iad_setting_1);
    $db->insert_query('settings',$iad_setting_2);
    $db->insert_query('settings',$iad_setting_3);
    rebuildsettings();
    $iad_template = array(
		"title"		=> 'iad',
		"template"	=> $db->escape_string('<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<td class="thead" colspan="4" align="center"><strong>{$lang->iad}</strong></td>
<tr>{$banner}</tr>
</table>
<br />'),
		"sid"		=> "-1",
		"version"	=> "1.0",
		"dateline"	=> "1157735635",
	);
	$db->insert_query("templates", $iad_template);
    find_replace_templatesets("index", '#{\$boardstats}#', "{\$iadf}\n{\$boardstats}");
    find_replace_templatesets("index", '#{\$header}#', "{\$header}\n{\$iadh}");
}

//Deactive index header ads
function iad_deactivate()
{
    require MYBB_ROOT.'/inc/adminfunctions_templates.php';
    global $db;
    $db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='iad'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN('show', 'iad')");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN('position', 'iad')");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN('banner', 'iad')");
    $db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='iad'");
    rebuildsettings();
    find_replace_templatesets("index", '#'.preg_quote('{$iadf}').'#', '',0);
    find_replace_templatesets("index", '#'.preg_quote('{$iadh}').'#', '',0);
    
}

//Function of index header ads
function iad()
{
    global $db, $theme, $mybb, $templates, $lang, $iadf, $iadh,$iad;
    $lang->load("iad");
    if($mybb->settings['show'] != 0)
    {
        //check banner
        if($mybb->settings['banner'] != '')
        {
            $banner = '<tr><td colspan="4" class="trow1" align="center">'.$mybb->settings['banner'].'</td></tr>';
        }
        //get template
        if($mybb->settings['position'] == 'header')
        {
            eval("\$iadh = \"".$templates->get("iad")."\";");
            $iadf = "";
        }
        else
        {     
            eval("\$iadf = \"".$templates->get("iad")."\";");
            $iadh = "";
        }
    }
}
?>
Is that the iad.php file or the iad.lang.php file?
Thank you so much. I'm surprised ranjini isn't Mod yet!
how to put the code for banner in this index ads

I tried everything and that will not be displayed.

is there any suggestion what could be?