Step 2 - Defining the Options
Let's create some options to make our add-on a little more customizable. What we will do here is create a cron entrey to move threads with a specific prefix inside a specifc forum to another specifc forum. Hell yeah, it is a bunch of specifc things, I know. So, instead of specify all those info inside the php file of our cron, let's create options for that.
To create an option, we first need to create a group option for our addon, so go to
AdminCp -> Options and click in the
+Add Option Group button. This will bring to you a new page:
Use the information bellow to fill the required fields. We are creating a new option group to hold all our options for this add-on.
- Group ID: MoveThreadCron
- Title: Cron to Move Threads Automatically
- Description: Options to the addon Cron to Move Threads Automatically.
- Display Order: It is your choice, but I always use: 1000000
- Display this group in debug mode only: NOT checked
- Add-on: Cron to Move Threads Automatically
After that, we are now able to create new options. All the new options will be placed inside this recetly created option group. If you've followed my steps, you should be in this page:
To add a new option, click in the
+ Add Option button.
This first option will hold the forum id that we want to get threads from. Follow the info below to fill the required fields.
Option 1
- Option ID: mtcFromForum
- Add-on: Cron to Move Threads Automatically
- Title: Forum to get threads
- Explanation: Insert the Forum ID of the forum you want to get threasd from.
- Edit Format: SpinBox
- Format Parameters:
Min = 1
- Data Type: Unsigned Integer
- ... some other fields in the middle, just let they in blank ...
- Cron to Move Threads Automatically: Checked, value = 10
------------------------------------------------- // ---------------------------------------
Option 2
- Option ID: mtcFromPrefix
- Add-on: Cron to Move Threads Automatically
- Title: Get Threads with this prefix
- Explanation: Insert the Prefix ID of the prefix you want to get threas. The cron will only take ALL threads that have this specific prefix.
- Edit Format: SpinBox
- Format Parameters:
Min = 1
- Data Type: Unsigned Integer
- ... some other fields in the middle, just let they in blank ...
- Cron to Move Threads Automatically: Checked, value = 20
------------------------------------------------- // ---------------------------------------
Option 3
- Option ID: mtcToForum
- Add-on: Cron to Move Threads Automatically
- Title: Destination Forum
- Explanation: Insert the ID of the forum that we will move threads to. This is the destination forum of the threads.
- Edit Format: SpinBox
- Format Parameters:
Min = 1
- Data Type: Unsigned Integer
- ... some other fields in the middle, just let they in blank ...
- Cron to Move Threads Automatically: Checked, value = 30
------------------------------------------------- // ---------------------------------------
Option 4
- Option ID: mtcToPrefix
- Add-on: Cron to Move Threads Automatically
- Title: Destination Prefix
- Explanation: Insert the ID of the prefix that we will set to the moved threads.
- Edit Format: SpinBox
- Format Parameters:
Min = 1
- Data Type: Unsigned Integer
- ... some other fields in the middle, just let they in blank ...
- Cron to Move Threads Automatically: Checked, value = 40
------------------------------------------------- // ---------------------------------------
Option 5
- Option ID: mtcAmmount
- Add-on: Cron to Move Threads Automatically
- Title: Ammount of Threads
- Explanation: This is the ammount of threads that the cron job will look to move to the destination forum.
- Edit Format: SpinBox
- Format Parameters:
Min = 1
- Data Type: Unsigned Integer
- ... some other fields in the middle, just let they in blank ...
- Cron to Move Threads Automatically: Checked, value = 50
After all that, you should end up with this:
As you see each one of the options is self explanatory. It is important to fill the Explanation field correctly so we will now what this option is for.
Since we're in the right place, fill all these options with what you want. It is important too to fill all them correctly.
But where do I get the Prefix or Forum ID?
Go get the forum ID you go to
AdminCP -> Applications -> Display Node Tree and click on the forum to select. Take a look at your URL. It should be something like this:
http://example/example/admin.php?nodes/main-forum.
2/edit
The number
2 is your forum ID.
The same you can do with thread prefixes.
Go to
AdminCP -> Applications -> Thread Prefixes and click on the prefix to select. Take a look at your URL. It should be something like this:
http://example/example/admin.php?thread-prefixes/videos.
1/edit
The number
1 is your prefix ID.