MyBB Hacks

Full Version: hook in if ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi Smile

np

PHP Code:
	if ($mybb->settings['aa'] == 'aa' )
	{
        $plugins->add_hook('index_start', 'cr');
	}
         else
         {

          }


What I must do to the this code will start work ?
Sory for bad English Smile

Set $mybb->settings['aa'] to 'aa' in the Admin CP, and create a function called "cr" in the plugin file. No different to normal. Why, is it not working?
I don't know but is not work
maybe because of the beginning of the plugin does not have
$db or $plugin
Frown

In on word I wony a run s hook whenn setting os on

PHP Code:
	 $options = 'select\nss_redirect=' . $lang->setting_1 . '\n';
     $options .= 'ss_simple=' . $lang->setting_2 . '\n';
     $options .= 'ss_simple_and_redirect=' . $lang->setting_1_and_2;
	
	$setting = array( // not work
		"sid"			=> NULL,
		"name"			=> 'setting_options',
		"title"		=> $db->escape_string($lang->setting_options),
		"description"	=> $db->escape_string($lang->setting_options_desc),
		"optionscode"	=> $options,
		"value"			=> 'ss_simple_and_redirect',
		'disporder'		=> $disporder++,
		'gid'			=> $gid
	);
	$db->insert_query("settings", $setting);


options 1 want to launch hook 1
options 2 want to launch hook 2
options 3 wont to launch hook 1 and 2

(08-17-2013 08:23 PM)Xander Wrote: [ -> ]maybe because of the beginning of the plugin does not have
$db or $plugin
So have you tried that?

Also, the code you posted contains obvious errors.  I recommend you touch up on your PHP skills before attempting to write working code.
I add global mybb; and work
Reference URL's