Is it possible to change a weblog entry’s status without going into the Control Panel?
For instance, if the weblog entry title contains ‘foo’, close this weblog entry.
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
February 25, 2010 6:28pm
Subscribe [3]#1 / Feb 25, 2010 6:28pm
Is it possible to change a weblog entry’s status without going into the Control Panel?
For instance, if the weblog entry title contains ‘foo’, close this weblog entry.
#2 / Feb 25, 2010 8:58pm
Do you mean from the front end of the site?
Not really. I usually put “edit” links next to all of my entries on the front-end, and show them only to super-admins, so things are just a click away.
#3 / Feb 25, 2010 10:42pm
I do have the “edit” links available for admins but I’d like to get everything as automated as possible. I’m not proficient with PHP but I’ve managed a plugin which deletes the weblog entry. (next best thing to closing the entry)
Example:
if weblog entry title contains ‘foo’, delete the weblog entry.
$DB->query( "DELETE FROM exp_weblog_data WHERE entry_id = '".$DB->escape_str($entry)."'");This seems to work ok but the weblog entry is still listed in the weblog entries list, only with no data. When I click on it, I get “You have tried to access a weblog that does not exist.”
Is there a SQL command to completely delete a weblog entry so it no longer appears in the edit weblog entries list?
THANKS 😊
#4 / Feb 26, 2010 12:26am
Got it to work. Deletes the weblog entry if criteria is met…
if (CRITERIA ! MET) {
$DB->query( "DELETE exp_weblog_data, exp_weblog_titles FROM exp_weblog_data INNER JOIN exp_weblog_titles WHERE exp_weblog_data.entry_id = '".$DB->escape_str($entry)."' AND exp_weblog_titles.entry_id = '".$DB->escape_str($entry)."'");
$this->return_data = "deleted entry # " . $entry;
return $this->return_data;
}Good to go. 😊
#5 / Feb 26, 2010 3:12am
Patrick,
Glad you are up and running. Feel free to start a new thread if you have any more questions.