Enable and Disable module from external php file?

General questions relating to Joomla! 2.5. Note: All 1.6 and 1.7 releases have reached end of life and should be updated to 2.5. There are other boards for more specific help on Joomla! features and extensions.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Locked
rijotech
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Tue Sep 10, 2013 7:40 pm

Enable and Disable module from external php file?

Post by rijotech » Fri Jan 26, 2018 9:53 pm

Hi, I was wondering how can i disable and enable a module from a html button and external php file without having to go to the back end, can anybody please give me an example of how to do this?


I have figure something out but still not working

Code: Select all

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$sql = "UPDATE yos_modules SET published='1' WHERE id=178";

if ($conn->query($sql) === TRUE) {
    echo "Record updated successfully";
} else {
    echo "Error updating record: " . $conn->error;
}

$conn->close();
?> 

rijotech
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Tue Sep 10, 2013 7:40 pm

Re: Enable and Disable module from external php file?

Post by rijotech » Fri Jan 26, 2018 11:16 pm

Never mind it does work i had the wrong id number.


Locked

Return to “General Questions/New to Joomla! 2.5”