4

THE SHORT: I am looking for the sql query I need to run in order to change the status of an entry. Any help would be appreciated.

THE LONG: I have two sperate channels and they are NOT linked via a relationship field, however if the status of an entry in Channel A is closed and a field in Channel A matches a field in Channel B I need to update the status of the entry in Channel B. I plan on running this via a cron to automatically update these entries and I dont want to require my users manually change the entries.

Thanks.

  • If there isn't a relationship field, how do you know which entry in Channel B to compare to the entry in Channel A? – Erik Reagan Jan 17 '13 at 4:31
  • The field is generated from an existing field from a different channel using stash. It's wonky - but works for what i needed without creating a relationship field. – Mike McBrien Jan 17 '13 at 18:52
  • A trigger is more elegant in this case than a cron job. – Steve Buzonas Feb 13 '15 at 22:09
2

Your question asks for a query to change the status of an entry. This is the code you'd use to change the status for a specific entry_id:

 UPDATE exp_channel_titles t 
 SET t.status = 'pending' 
 WHERE t.status = 'open'
 AND t.entry_id = "1"

I suspect you need something more complicated though. If that's the case, you'll need to update your questions with more specific detail.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.