We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Using Channel Entry API to create a new entry when user is not logged in

Development and Programming

Visiluna's avatar
Visiluna
92 posts
11 years ago
Visiluna's avatar Visiluna

I have an EE template containing a process. The process is run once daily by loading the template in IE using Windows Task Scheduler at a given time each morning.

The process consists of two parts.

Part A uses the Query Module to collect specific channel data and emails them using the “Email-From-Template” plug-in. This part works fine, so ignore it for now.

Part B logs that the email was sent by creating a channel entry in a channel that was created to be an event log.

I am using the Channel Entry API’s

ee()->api_channel_entries->save_entry($data, $channel_id);

to write the entry to the event log channel.

All has worked well in testing when I have loaded the aforementioned template manually. However, when I load the template automatically with IE/Task Scheduler, Part B fails with an error on the front end indicating, “You do not have permission to post to this channel,” or something to that effect.

It works when I’m doing it manually because I’m logged in as a registered site member. When Task Scheduler attempts to open the template in IE, it is doing so as a guest.

So here are my questions:

Is there a way to allow a template being loaded by a “guest” (IE/Task Scheduler) to add entries to a channel using the Channel Entry API?

If not, Is there a way to make IE/Task Scheduler load a template as a logged-in user?

I’m also open to any other suggestions anyone might have.

To clarify, I am not using the API to write an add-on. I am using it in PHP directly in a template.

       
swarm's avatar
swarm
4 posts
9 years ago
swarm's avatar swarm

2 years later and now solution to this problem??

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.