After ad is saved (when creating or editing) input format is changed to 0 in database (table node_revisions) and can be changed only by editing in database.

No such problem with other content types.

Advertisement 6.x-2.1
Drupal 6.13
PHP 5.2.10
MySQL 5.0.77
Apache/1.3.37 (Unix) PHP/5.2.10 mod_perl/1.30

CommentFileSizeAuthor
#21 ad_format.patch433 bytesjenlampton

Comments

simpsonetti’s picture

I think i have the same probem.
image_ad is working fine, html_ad won't be shown. and "format" in database was 0. i changed it to 1, 2 and 3 but the ad won't be shown.
Which value do you have set ?

grzegorz.bartman’s picture

I have the same probem.

dpopov’s picture

i changed it to 1, 2 and 3 but the ad won't be shown.
Which value do you have set ?

Number 4 – it's my own input format with all filters removed. But in my case number 3 (PHP code) works too.

tetramentis’s picture

Same problem here, using both Raw and javascript methods, using both block and embedded display. I'm trying to show this simple fragment:

<iframe src="http://www.ubuntu.com/files/countdown/904/countdown-9.04-1/countdown.html" width="180" height="150" frameborder="0" scrolling="no" name="ubuntucountdown"><a href="http://www.ubuntu.com/"><img src="http://www.ubuntu.com/files/countdown/904/countdown-9.04-1/00.png" alt="Ubuntu 9.04 - on desktops, netbooks, servers and in the cloud" width="180" height="150" border="0" /></a></iframe>

Inspecting resulting page HTML code:

<div id="ad-1631" class="html-advertisement"><p><a href="http://www.ubuntu.com/"/></p></div>

Clearly, original HTML is just filtered. When editing the ad, original source is in place.

Using the debug=2 GET parameter:

ad_dir: '(...)/sites/all/modules/ad'
debug: '2'
adcache: 'none'
nids: ''
tids: ''
hostid: ''
url: 'node/1626'
quantity: '1'
aid: '0'
ad_display: 'javascript'
--> Time mark: 14:46:11
Memory usage: 707.508 K
Drupal bootstrap '0'.
Drupal bootstrap complete.
Root drupal directory detected as '(...)'.

(...)/sites/all/modules/ad/serve.php: // $Id: serve.php,v 1.1.2.2.2.1.2.1 2009/02/23 22:39:02 jeremy Exp $
(...)/sites/all/modules/ad/adserve.inc: // $Id: adserve.inc,v 1.1.2.31.2.8.2.8 2009/05/07 13:52:13 jeremy Exp $
(...)/sites/all/modules/ad/adcache.inc:
(...)/sites/all/modules/ad/ad.module: // $Id: ad.module,v 1.2.2.29.2.83.2.16.2.26 2009/08/05 00:13:36 jeremy Exp $
(...)/sites/all/modules/ad/ad.install: // $Id: ad.install,v 1.2.2.4.2.27.2.7.2.4 2009/04/03 17:01:02 jeremy Exp $

adserve_cache function(get_ad_ids)
Cache function 'ad_cache_none_get_ad_ids' does not exist.
Memory usage: 723.000 K
Invoking cache function 'adserve_cache_get_ad_ids'.
Entering default adserve_display.
adserve_cache function(open)
Cache function 'ad_cache_none_open' does not exist.
Memory usage: 723.320 K
Invoking cache function 'adserve_cache_open'.
Drupal bootstrap '8'.
Drupal bootstrap complete.
Hostid: 'none'.
adserve_invoke_hook hook(init) action(first)
adserve_cache function(hook)
Cache function 'ad_cache_none_hook' does not exist.
Memory usage: 23,112.492 K
Invoking cache function 'adserve_cache_hook'.
adserve_cache function(get_cache)
Cache function 'ad_cache_none_get_cache' does not exist.
Memory usage: 23,112.930 K
Invoking cache function 'adserve_cache_get_cache'.
adserve_cache function(build_hooks)
Cache function 'ad_cache_none_build_hooks' does not exist.
Memory usage: 23,123.984 K
Invoking cache function 'adserve_cache_build_hooks'.
Did not find hook 'init'.
Function 'adserve_hook_init' does not exist.
adserve_cache function(id)
Cache function 'ad_cache_none_id' does not exist.
Memory usage: 23,128.094 K
Invoking cache function 'adserve_cache_id'.
Unsupported type 'host'.
Searching default: 0
adserve_cache function(id)
Memory usage: 23,128.094 K
Invoking cache function 'adserve_cache_id'.
Total ads: '2'.
Already displayed: 0
adserve_cache function(validate)
Cache function 'ad_cache_none_validate' does not exist.
Memory usage: 23,128.359 K
Invoking cache function 'adserve_cache_validate'.
Validated ads: '2'.
adserve_invoke_hook hook(filter) action(intersect)
adserve_cache function(hook)
Memory usage: 23,128.594 K
Invoking cache function 'adserve_cache_hook'.
Invoking hook 'filter'.
Including file: '(...)/sites/all/modules/ad/channel/ad_channel.inc'.
Invoking 'ad_channel_cache_filter'.
ad_channel_cache: adserve_cache_filter
adserve_cache function(get_cache)
Memory usage: 23,220.508 K
Invoking cache function 'adserve_cache_get_cache'.
ad_channel_cache: checking aid(1631)
ad_channel_cache: aid(1631) has no channel info, nochannel_display(0)
ad_channel_cache: non-channel aid(1631) is valid if no valid ads are assigned to current channel
ad_channel_cache: checking aid(1630)
ad_channel_cache: aid(1630) has no channel info, nochannel_display(0)
ad_channel_cache: non-channel aid(1630) is valid if no valid ads are assigned to current channel
ad_channel_cache: using ads with no channel info
adserve_cache function(get_cache)
Memory usage: 23,222.641 K
Invoking cache function 'adserve_cache_get_cache'.
ad_channel_cache: aid(1631) is not a premiere advertisement
ad_channel_cache: aid(1630) is not a premiere advertisement
ad_channel_cache: returning non-premiere advertisements from randomly selected channel 0
ad_channel_enforce_inventory_level: not needed for channel(0)
Filtered ads: '2'.
adserve_invoke_hook hook(weight) action(first)
adserve_cache function(hook)
Memory usage: 23,224.203 K
Invoking cache function 'adserve_cache_hook'.
Invoking hook 'weight'.
Including file: '(...)/sites/all/modules/ad/weight/probability/ad_weight_probability.inc'.
Invoking 'ad_weight_probability_cache_filter'.
adserve_cache function(get_cache)
Memory usage: 23,240.961 K
Invoking cache function 'adserve_cache_get_cache'.
ad_weight_probability cache_filter gcd(100)
ad_weight_probability cache_filter aid(1631) weight(2)
ad_weight_probability cache_filter aid(1630) weight(1)
Weighted ads: '3'.
adserve_invoke_hook hook(select) action(first)
adserve_cache function(hook)
Memory usage: 23,241.172 K
Invoking cache function 'adserve_cache_hook'.
Did not find hook 'select'.
Invoking 'adserve_hook_select'.
Randomly selecting ad 1 of 1.
Randomly selected ID: 1631.
adserve_cache function(validate)
Memory usage: 23,242.266 K
Invoking cache function 'adserve_cache_validate'.
Selected ads: '1'.
adserve_cache function(display)
Cache function 'ad_cache_none_display' does not exist.
Memory usage: 23,243.578 K
Invoking cache function 'adserve_cache_display'.
adserve_cache function(display_ad)
Cache function 'ad_cache_none_display_ad' does not exist.
Memory usage: 23,243.578 K
Invoking cache function 'adserve_cache_display_ad'.
Ad type 'html', loading module 'sites/all/modules/ad/html/ad_html.module'
ad: <div class="html-advertisement" id="ad-1631"><p><a href="http://www.ubuntu.com/"></a></p> </div>
adserve_cache function(increment)
Cache function 'ad_cache_none_increment' does not exist.
Memory usage: 33,498.852 K
Invoking cache function 'adserve_cache_increment'.
adserve_cache_increment action(view) aid(1631) hostid()
Drupal bootstrap '8'.
Drupal bootstrap complete.
adserve_invoke_hook hook(increment_extra) action(merge)
adserve_cache function(hook)
Memory usage: 33,498.852 K
Invoking cache function 'adserve_cache_hook'.
Did not find hook 'increment_extra'.
Function 'adserve_hook_increment_extra' does not exist.
adserve_cache_increment extra()
adserve_cache function(close)
Cache function 'ad_cache_none_close' does not exist.
Cache function 'adserve_cache_close' does not exist.
adserve_invoke_hook hook(init_text) action(append)
adserve_cache function(hook)
Memory usage: 33,500.148 K
Invoking cache function 'adserve_cache_hook'.
Did not find hook 'init_text'.
Function 'adserve_hook_init_text' does not exist.
adserve_invoke_hook hook(exit_text) action(append)
adserve_cache function(hook)
Memory usage: 33,500.148 K
Invoking cache function 'adserve_cache_hook'.
Did not find hook 'exit_text'.
Function 'adserve_hook_exit_text' does not exist.
Memory usage: 33,500.148 K
document.write('\x3cdiv class=\"html-advertisement\" id=\"ad-1631\"\x3e\x3cp\x3e\x3ca href=\"http://www.ubuntu.com/\"\x3e\x3c/a\x3e\x3c/p\x3e\n\x3c/div\x3e');

Note line ad: <div class="html-advertisement" id="ad-1631"><p><a href="http://www.ubuntu.com/"></a></p> </div>.

Could someone suggest how to fix this?

javamandk’s picture

I have the same probem.

simpsonetti’s picture

i chaged it now to 2 (manualy, fullhtml) and it is partial working:
one ad works, one not.
but the code i get from my partner is with comments (

) and this will be filtered and shown above the ad.
Why ?

simpsonetti’s picture

it is strange. Now i lokk to my ads and there were again at "filtered html" ??
i solved it like this: html i need was put into "filtered html" and this works.

modulist’s picture

I was trying to create an ad with

Only local images are allowed. and
tags in it. I had to add these to the list of tags accepted as filtered HTML. For a large community site with user-submitted content, that makes me really nervous.

there must be abetter way to have full HTML enabled for HTML ads.

tetramentis’s picture

another workaround/hack is:
- locate function theme_ad_html_ad($ad) in ad/html/ad_html.module file
- replace this code

if (isset($ad->html) && isset($ad->format)) {
  $output .= check_markup($ad->html, $ad->format, FALSE);
}

with

if (isset($ad->html) && isset($ad->format)) {
  $ad->format = 2;
  $output .= check_markup($ad->html, $ad->format, FALSE);
}

This forces all ads of type 'HTML' to be treated as Full HTML.

One could also completely bypass markup checking by replacing the output line with a simple $output .= $ad->html;

tetramentis’s picture

If someone wants to proceed with fixing this issue properly: ad edit form is in function ad_form(&$node, &$form_state) in file ad/ad.module (took me several minutes to find); actual processing takes place in function ad_nodeapi(&$node, $op, $teaser, $page).

jeremy’s picture

Status: Active » Fixed

It took me a disturbingly long time to track down this bug. Fix committed. (Essentially, if $form['body'] isn't set, then $form['filter'] is erased.)

tetramentis’s picture

Thank you!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

reubenavery’s picture

Priority: Normal » Critical
Status: Closed (fixed) » Active

I'm sorry to say that this problem is still present. I'm using the 6.x-dev build as of 2009-Oct-08, and am experiencing the behavior that whenever an ad node is saved, the 'format' column is set to 0 in node_revisions, regardless of what is selected on the front end. Going into the db and manually changing this value, the change is lost and goes back to 0 if the node is edited.

jeremy’s picture

Priority: Critical » Normal

I am unable to duplicate. Can anyone else duplicate this?

theunraveler’s picture

Subscribing.

jaron’s picture

Subscribing. Having the same issue.

jeremy’s picture

Status: Active » Postponed (maintainer needs more info)

Please try 6.x-2.2-rc1, this bug should now be fixed:
http://drupal.org/node/640980

jeremy’s picture

Status: Postponed (maintainer needs more info) » Fixed

I retested with the latest release and am unable to duplicate. Marking as fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jenlampton’s picture

Version: 6.x-2.1 » 6.x-2.2
Status: Closed (fixed) » Needs review
StatusFileSize
new433 bytes

This fix did not make it into the latest release. Patch re-rolled agains 6.x-2.2 version.
Jen

tetramentis’s picture

Jen, that doesn't look like a permanent fix - rather like a quick-hack.
Have you had a look at the diff of Jeremy's fix? If that doesn't work for you - maybe you could find out why.

kewlguy’s picture

subscribing

charlie-s’s picture

Has this been implemented into a current release or do I need to patch to have this functionality?

jenlampton’s picture

Title: Input format is changed to 0 » HTML ads not using Full HTML input format (so HTML get stripped from the ad)
Status: Needs review » Fixed

@csdco This fix does seem to be working in the latest version of the module, just be sure you remember to change the Input format to Full HTML or your Ad's HTML will be still be removed. You can set the input format *above* the HTML fieldset on the form.

I've also opened a few additional issues to help clear up the usability issues with the current solution :) (sorry Jeremy!) short term we could do #1349738: Input format should default to Full HTML, and input format form element should appear below Ad HTML element and longer term, maybe we can do #1349730: Use Body field instad of custom "Ad HTML" field on node

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.