hook in if ?
Xander Offline
Junior Member
**
Posts: 6
Joined: Aug 2013
Post: #1
hook in if ?
Hi Smile

np

PHP Code:
1
2
3
4
5
6
7
8
	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

08-17-2013 08:32 AM
Find all posts by this user Quote this message in a reply
Seabody Offline
Member
***
Posts: 54
Joined: Aug 2012
Post: #2
RE: hook in if ?
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?
08-17-2013 07:46 PM
Find all posts by this user Quote this message in a reply
Xander Offline
Junior Member
**
Posts: 6
Joined: Aug 2013
Post: #3
RE: hook in if ?
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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
	 $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

(This post was last modified: 08-17-2013 08:34 PM by Xander.)
08-17-2013 08:23 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #4
RE: hook in if ?
(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.

My Blog
08-19-2013 10:27 AM
Find all posts by this user Quote this message in a reply
Xander Offline
Junior Member
**
Posts: 6
Joined: Aug 2013
Post: #5
RE: hook in if ?
I add global mybb; and work
08-20-2013 02:13 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: