Create ads programmatically
drm - November 2, 2009 - 21:49
| Project: | Advertisement |
| Version: | 6.x-2.1 |
| Component: | ad module |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
We get our affiliate ads via an API from a service that provides ads from its clients. I'm hoping that somebody has an module/function where I can pass the needed content in to create an ad node, so that I don't have to figure out the drupal_execute() call myself.

#1
Ads are nodes, so you can create the node object and call node_save:
http://api.drupal.org/api/function/node_save
Be sure to set $node->title, $node->body, $node->adtype, and any fields required by the ad type (ie $node->url, $node->adheader and $node->adbody if a text ad). Take a look at ad_nodeapi() in ad.module, where $op == 'insert', as well as _adapi() in the appropriate ad_type module.
#2
Hey - I just wanted to get back to you to let you know that I got this working.
#3
Automatically closed -- issue fixed for 2 weeks with no activity.