 Welcome back to the channel, today I'm going to show you how to utilize a classic press new security page that has been put there to handle all things that are security in terms of the different reasons. So some of my favorite plugins are Sukuri and Wad Fence and they always create their own sub menu which ends up clutters up my whole dashboard in that main site. So classic press has decided that all plugins that deal with security should put all their menu pages here so that people don't miss out on making the settings right. Some of the bonus points that do come with activating that setting for the security page of classic press is that you get a little icon here that talks about security and that when someone clicks on it they actually go to your security page. So when we go to the classic press security default the default page which gives you the instructions we can see that one of the plugins we installed which is called CP Bruteforce Login Protection already has its settings page already listed here so CP by default once you add that the add security page setting in your plugin it picks up all those details and it will throw this your plugin right there for you. So we can go to the developer side and see what's available for us there. So we have an overview of how this particular functions. So what I'm going to do here is that I'm going to just copy this particular piece of code and I'm going to open a new plugin page in our plugins folder. So I'll just create a new page and I'll call it a CP security demo plugin and I'm just going to drag and drop this in my visual studio code editor and when I drop it there my visual studio code I'm now ready to code. So what I'm doing is open a new file which I'll just play the same thing okay I call it CP security demo the PHP. Now I'll quickly open up my PHP and then I'll use a shortcut for I'll start my plugin now this shortcut comes from a little extension that I wrote for my visual studio code and it's called a classic press snippets which is downloadable you can download it by just searching classic press snippets and metal completions. So that allows me to always plug in the plugins quickly. So we call this a CP. Let's just go back to our folder we call this CP security demo and then we just click and add and then we just quickly change this out and we just give it a simple rampo.com and then this plugin does one does that's good. So for now we shall just give it a preview of CP security in demo. So once that is done we are now ready to start writing our plugin settings. So some of the things that we copied earlier from the developer page here is this functionality and what we're going to do is just come back to our page here and press it so it's going to look for whether the function exists and this function only exists in classic press. So what I'm going to do is it's going to add my plugin which I'm going to call the awesome security plugin something this is a little bit cheesy but let's just allow the things to go on we call it awesome seg and then of course we give this our city back security plug demo because that's our our particular this is what we demo file here and then of course I will give this a proper function and I'll call it my output function. So of course we quickly copy this here and then we will start the function that will echo that out and what we're going to do is that the range is the default our range is some default styling and html that we can use in our classic press so php now what I'm going to do here is I'm just going to echo a view with a class of wrap I'm using emet that allows me to do that and then I'm going to put in an f1 tag which I'll call awesome security page settings and then I first I'll add an hr tag there and I'll go for a paragraph tag and I'll say this is where my security settings are going to be and I'll save this so what I'm going to do now is just go back to my plugins so I'll go to plugins here in scroll plugins so what I'm going to do is I'm going to activate my security demo here and then when we go to our security here we do not see this coming up now I've found a big issue with just having this particular piece of code in here and there's something on the in the in the documentation of the security page that talks about the menu slug of course is the menu slug and they advise you to use this they say this is one of the biggest brochures that are there so what you do is you can just use this particular point here so what I'll do is that I will add it into my function and that will allow me to use this slug right here as a variable and just drop it here in my code and save that so we have the function now you say that we need so we need to register this using the add admin and we need to use the add admin hook so what I'm going to do is we're going to add action which is the hook and then I will add add menu comma and then we'll add a new function which we shall call cp security settings uh so we'll call it just that and then what we're going to do is just call this function and then I'm going to close off that function here so we have an if statement that's saying once we start the admin menu let's call this function and if we will check if the security page is available uh if this function is available then we'll call our function to the classic page and if it's not then we'll use traditionally how we go is added our pages so you'll use something like add menu page blah blah blah so this functionality is actually only in classic version 1.0 that we have here now so if I reload my plugins page here and come back to security again see that we have a awesome secure awesome sec plugin listed among security and then when we click it we have our page that we started here I'm just going to go back to the plugins again and you'll see that our demo plugin actually has this little icon that is ready that for that it's our security and it still takes us to the same page and then if we go to the security of classic security the default page that is there you'll find that it's listed even my plugin here so when you click it we immediately go to the settings that are available now what now I'm going to try to refactor one of the the plugins that we do up here and I'm going to use uh the security security so I'll just open up this and go to security scanner which is the plugin I'll just add it to my vf code here and then I'm going to do a quick search for where we add that functionality so I'm just going to use the inbuilt search function uh that that is in vf code so I'm going to find in files so what I'm going to do is I'm going to look for add menu page that's a functionality we are looking for looking for add menu page that's a functionality we are looking for in our in our pages and we'll find it that it is actually here so this is a functionality that we are looking for and what I'm going to do is just introduce actually our classic press setting here so what I'm going to do is just come back here copy this if function and the else else statement and then I'm just going to come back here to globals and what I'm going to do is just come here dump this function and then say we know what if we are not in classic press I don't need to we don't need to to duplicate what is already there we're just going to rename and have this here but outside of what's happening here we're going to just have this same content here so so and then copy this and then just come and drag it here so we have our function that we need to open we don't need the manage options because this has already been set by default in our classic press so the other thing that we need to do is just add our menu slug however I have a feeling this is not going to work because it's going to be detecting a different page so what we're going to do is we're going to use a global which I'll call menu slug we're going to just use a global I'll cut this and save this then I'll come back to our main page which is a secreted PHP and then immediately after all these things that are happening I'm also going to create another definition any definition I'm just going to put I'm going to define our menu slug here so we have our function there and I'm going to call this maybe secret slug secret slug I'll just copy this again save this here come back to the logos here and I'll change this menu slug into what we call secret slug so I'll paste that and then save now we'll go back to our page and reload and I see something is working let's just if we have a look at what's happening so we've got this right this is well closed we have that we just got to the global page and look at if the function is there okay then we save this and then go back to our page and reload and we have our security page loading and now we have our sukuri here and then we have sukuri also being listed in the plugin security settings so when I click on it we actually have all our settings working just fine we can go to the different things we can go to the dashboard we can go to the firewall we can go to the settings we can go to settings and we see that but just look here it's now looking a lot cleaner we don't have that much clutter so if I was if I also did the same thing to work friends and just went and add an if statement and added my security page on the settings uh we'll be able to have the proper cleaner dashboard without using any other plugins so that's the beauty of using the add security page in classic press and your code will function very well if you don't have this if you're using wordpress and this function definitely doesn't exist since it's only in classic press version 1.10 um your code will run normally here so give it a try out convert your plugin today and make it classic press friendly thank you for watching bye bye