I have this error messag ein watchdog:

Simplenews statistics click called with illegal parameter(s).

CommentFileSizeAuthor
#6 d7_simplenews_statistics_working.patch6.46 KBfago
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

weseze’s picture

The latest dev release has a new engine under the hood that is not compatible with previous dev versions. (see #1775364: Url shortener and encryption for more information on this)

Links in previously sent mails will not work anymore (unless they are not tracked). All new sent mails will (should) work properly.

egarias’s picture

I am sending a new newsletter, but the links are not working.

They are sending me to something like : http://newsletter.alesport.com/sns/click/O1/O2, showing a window showing a completely broken html:


<div class="region region-footer-first">
  <div id="block-devel-execute-php" class="block block-devel contextual-links-region">

      <div class="contextual-links-wrapper"><ul class="contextual-links"><li class="block-configure first last"><a href="/admin/structure/block/manage/devel/execute_php/configure?destination=sns/click/O1/O2">Configurar bloque</a></li>
</ul></div>
  <div class="content">
    <form action="/sns/click/O1/O2" method="post" id="devel-execute-block-form" accept-charset="UTF-8"><div><fieldset class="collapsible collapsed form-wrapper" id="edit-execute"><legend><span class="fieldset-legend">Execute PHP Code</span></legend><div class="fieldset-wrapper"><div class="form-item form-type-textarea form-item-code">
  <label for="edit-code">PHP code to execute </label>
 <div class="form-textarea-wrapper resizable"><textarea id="edit-code" name="code" cols="60" rows="20" class="form-textarea"></textarea></div>
<div class="description">Enter some code. Do not use <code>&lt;?php ?&gt;

tags.




ContentContenidodefault
Content Topdefault
Dashboard (inactive)default
Dashboard (main)default
Dashboard (sidebar)default
Enter some code. Do not use <code>&lt;?php ?&gt;</code> tags.default
ExecuteEjecutardefault
Execute PHP Codedefault
First Bottomdefault
First Sidebardefault
FooterPie de páginadefault
HeaderEncabezadodefault
HelpAyudadefault
LongLargodefault
MediumMediodefault
PHP code to executedefault
Preface firstdefault
Preface lastdefault
Preface middledefault
Second Bottomdefault
ShortCortodefault
Third Bottomdefault

weseze’s picture

It looks to me like there is some other module redirecting to a user login, but doing a poor job at it...

What other modules are you running? Custom modules?

egarias’s picture

Thanks for fast answer
I have: Mail System, Mime Mail, Feeds, and other common modules, tell if you need more detail
I have custom module
here my main hooks

function orca_boletin_menu(){
	$items = array();
  	$items['orca/suscribe'] = array(
    	'page callback' 	=> 'orca_boletin_formulario',
    	'theme callback'	=> 'orca_boletin_tema',
    	'access arguments' 	=> array('access content'), 
    	'type' 				=> MENU_CALLBACK,    	
  	);
  	$items['orca/webversion'] = array(
    	'page callback' 	=> 'orca_boletin_webversion',
    	'theme callback'	=> 'orca_boletin_tema',
    	'access callback' 	=> TRUE, 
    	'type' 				=> MENU_CALLBACK,    	
  	);
  	$items['orca/boletines'] = array(
    	'page callback' 	=> 'orca_ver_boletines',
    	'access callback' 	=> TRUE, 
    	'type' 				=> MENU_NORMAL_ITEM,    	
  	);
  	$items['orca/boletines/view'] = array(
    	'page callback' 	=> 'orca_ver_boletines',
    	'title'				=> 'Lista de Boletines',
    	'access callback' 	=> TRUE, 
    	'type' 				=> MENU_DEFAULT_LOCAL_TASK,    	
  	);
  	$items['node/%node/contenido'] = array(
    	'page callback' 	=> 'orca_ver_contenido',
    	'title'				=> 'Selecciona Artículos',
    	'access callback' 	=> TRUE, 
    	'type' 				=> MENU_LOCAL_TASK,    	
  	);
  	$items['orca/boletines/nueva'] = array(
		'page callback' 	=> 'node_add',
		'page arguments' 	=> array('simplenews'),    	
    	'title'				=> 'Crear Boletin',
    	'access callback' 	=> TRUE, 
    	'type' 				=> MENU_LOCAL_TASK, 
    	'file' 				=> 'node.pages.inc',
    	'file path' 		=> drupal_get_path('module', 'node'),  	
  	);
  	$items['node/%node/webversion'] = array(
		'page callback' 	=> 'orca_boletin_webversion_node',
		'page arguments' 	=> array(1),    	
    	'title'				=> 'Versión Web',
    	'access callback' 	=> TRUE, 
    	'type' 				=> MENU_LOCAL_TASK,  	
  	);								
  	return $items;	
}
function orca_boletin_menu_alter(&$items){

	$items['admin/people/simplenews']['type'] = MENU_LOCAL_TASK;	
	$items['admin/people/simplenews/import']['type'] = MENU_LOCAL_TASK;
	$items['admin/people/simplenews/import']['tab_parent'] = 'admin/people';
	$items['admin/people/simplenews/export']['type'] = MENU_LOCAL_TASK;
	$items['admin/people/simplenews/export']['tab_parent'] = 'admin/people';		
	$items['admin/config/services/simplenews/add']['type'] = MENU_LOCAL_TASK;
	$items['node/%node/simplenews']['title'] = 'Enviar Boletin';	
}
function orca_boletin_form_alter(&$form, &$form_state, $form_id) {

  if ($form_id == 'simplenews_node_form') {
    $form['field_css']['#type'] = 'hidden';
	$form['body']['#type'] = 'hidden';
	$form['actions']['preview']['#type'] = 'hidden';
	dsm($form);
  }
  if ($form_id == 'views_form_noticias_block_2') {
//    $form['#action'] = str_replace('contenido', 'webversion', $form['#action']);
	$form['actions']['submit']['#submit'][] = 'orca_viewform_submit';
  }  
}
function orca_viewform_submit($form, &$form_state){
	preg_match_all('/\/([0-9]*)\//', $form['#action'], $matches);
	$nid = $matches[1][0];
	watchdog('ORCA', 'El nodo: '.$nid. ' Action: '.$form['#action'] , NULL, WATCHDOG_INFO);
	$node = node_load($nid);
	node_save($node);
//	$form['#action'] .= '?destination="/node/' .$nid.'/webversion"';
//    $form['#redirect'] = '/node/'.$nid.'/webversion';
	$message = 'Los cambios han sido guardados.';
	$message .= '</p>Vea su Newsletter en la pestaña ';
	$message .= '<a href="/node/' . $nid . '/webversion"><strong>"Versión Web"</strong></a>';
	drupal_set_message($message);	
}
egarias’s picture

Problem is here:

function simplenews_statistics_click($snid, $urlid)

My $snid and $urlid are numbers but not pass the validation on:

if (!is_int($snid) || !is_int($urlid))

I had to put this dirty:

$snid = $snid+0;
$urlid = $urlid+0;

Now it works

I also had to put a

return FALSE;

after the

drupal_goto($path, $options);

My newsletter link is redirecting to another site and it didn't worked until i inserted the return FALSE

fago’s picture

Status: Active » Needs review
FileSize
6.46 KB

I ran into the same issue. I made it work with the attached patch.

The attached patch fixes the is_int() check to use is_numeric() as well as some other small things. It also fixes the links to continue to work in case a test-mail is sent out by using the snid of "0".

weseze’s picture

Patch looks great, I'll look into it with some more detail and try and commit it. Thanks a bunch!

weseze’s picture

Assigned: Unassigned » weseze
Status: Needs review » Closed (fixed)

OK superpatch. I have comitted it with a bit more comment about what it all does.

egarias’s picture

It worked for me

Thanks!

summerjee’s picture

When clicking on a link it drops me to the front page with this message:
Notice: Undefined variable: url simplenews_statistics_click() row 155

weseze’s picture

@summerjee: should be fixed in latest commit. Updated dev release will be available shortly. (waiting on the d.o cron run for that)