Enable/Disable Option

Status
Not open for further replies.

Stormraven

Trusted Member
Joined
Oct 24, 2010
Messages
1,836
Hi guys,

I've created a small hook with a setting called 'Enabled'. This is the setup of the option:

enable.png

Although it doesn't seem to working. According to a friend, it's best to learn by looking through the way other addons work. So this is what I've been doing. I can't figure out if I should include this option, being as addons can be enabled or disabled on the main admin page, and even if it can be used, I can't figure out why it's not working. Do I need to put something in the template?

Can someone help me out please? Sorry if this is a bit confusing, it's been a very long day.

EDIT: I added this to the Listener.php but it's still not working:

Code:
$options = XenForo_Application::get('options');
 

Floris

I'm just me :) Hi.
Staff member
Joined
Jan 1, 2001
Messages
60,189
Do you want to check against enabled/disabled option in the PHP file, or in the template?

in PHP file after your public { line ..

$options = XenForo_Application::get('options'); // lets get the options
// let's check if the plugin is set to enabled or not
if ($options->iestyn_profile_notice_enabled == 1)
{
// when enabled = 1, we wanna do something
}

in template you can use:

<xen:if is="{$xenOptions.iestyn_profile_notice_enabled} == 1">
..
</xen:if>


Do you have a code event listener for that class, that public static function?
 

Stormraven

Trusted Member
Joined
Oct 24, 2010
Messages
1,836
Yes I do :) I have another quick question when you define:

Code:
$xenfans_profilepc_hook

Where do you get the '_hook' from? I know we are using a template hook, but my IDE tells me that the above code is not used anywhere :) I just want to be able to understand everything as I'm going along.

This is going so well, I've learnt so much!
 

Floris

I'm just me :) Hi.
Staff member
Joined
Jan 1, 2001
Messages
60,189
That's a string I made.
I populate it based on the selection from the admin option.
This way I can differentiate between top/bottom, OR separate location.
Normally you wouldn't need this.

And you just use the right hook, like member_view_sidebar_start
 

Stormraven

Trusted Member
Joined
Oct 24, 2010
Messages
1,836
That's a string I made.
I populate it based on the selection from the admin option.
This way I can differentiate between top/bottom, OR separate location.
Normally you wouldn't need this.

And you just use the right hook, like member_view_sidebar_start

Brilliant, thank you very much :) Now to figure out why options aren't showing up. Thanks for the help Floris.
 
Status
Not open for further replies.
Top