I am using api_channel_structure I want to correctly set up the uninstall function. To delete a channel I'm creating, I'm calling delete_channel. It requires a channel_id. Fine, but I only have a channel_name.

Is there an inbuilt function to get the id from name.. or is it stored in some session/object that I'm not aware of?

I need to get channel_id for uninstalling a module.

  • 1
    Because I'm creating several channels per module, I wrote this function to find all with the same part name: private function get_channel_id_from_name($name = null) { if ($name != null) { $get_id = $this->EE->db->query('SELECT channel_id from exp_channels WHERE channel_name LIKE "' . $name . '%"')->result_array(); return $get_id; } else { return false; } } – Beertastic Aug 1 '14 at 11:35
  • Please mark this question as closed or answer it and accept your answer – Johnathan Waters Aug 1 '14 at 12:02
  • Well, I can't believe that I had to create that function. I'm still hoping that someone will point me into the 'proper' answer. I'm noticing that I've had to create several DB calls to fill in the gaps that the APi misses.. I'm really hoping I'm just missing some functions as they seem like they should be standard. – Beertastic Aug 1 '14 at 15:10

Your Answer

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

Browse other questions tagged or ask your own question.