Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Jotade29 on April 20, 2024, 07:57:41 PM

Title: Clarifiction about function
Post by: Jotade29 on April 20, 2024, 07:57:41 PM
V: 2.0.19

Hello, i want a clarification about two functions of removetopic.php.

These are RemoveTopic2 (which i think is the one called when deleting a topic with the moderation button in topics), and the removeTopics function, which I don't know in what cases it is used. The notes that this function has are: ("// Removes the passed id_topic's. (permissions are NOT checked here!)")

I thought that the function to delete topics was only one, but checking i found these two, and i need to know where removeTopics() is used

Thank you!!
Title: Re: Clarifiction about function
Post by: Diego Andrés on April 20, 2024, 10:29:47 PM
RemoveTopic2 finds the information about the topic and it's only ever called directly using a URL to the action. It's essentially just a 'helper' function for deleting an individual topic because the URL is always exposed (?action=removetopic2;topic=x). So if you wanted to remove a single topic, you'd just use that URL and be done with it.

removeTopics actually removes the topics, it assumes you already checked what needs to be checked like permissions, the topic existing, etc. Can be useful if you have a list of topics, you check the topics are real, etc and send the array to the function.