Hi,

I am trying to use a themename_alpha_hook() function (in particular, hook=user-register-form), and it is not working. If I place this preprocess function in my template.php, it works without a hitch.

I created a file called "preprocess-user-register-form.inc" in my preprocess folder, and the following are it's contents:

<?php 
/**
 * Implements hook_preprocess_user_register_form(&vars);
 * Used to override default registration form.
 */
 
function themename_alpha_preprocess_user_register_form(&$vars) {
     kpr($vars);
	 $vars['intro_text'] = t('This is my super awesome registration form.');
}

This does work in my template.php file. Furthermore, this is what I had in my template.php file:

/**
 * Implements hook_theme()
 * Used to customize the user registration page.
 * @return items array
 */

function themename_theme($existing, $type, $theme, $path) {
	$items = array();
	$tpl_path = drupal_get_path('theme', 'themename') . '/templates';
	
	$items['user_register_form'] = array(
			'render element' => 'form',
			'path' => $tpl_path,
			'template' => 'user-register-form',
			'preprocess functions' => array(
					'themename_alpha_preprocess_user_register_form'
					),
			);
	
	return $items;
}

Could it be because of the preprocess function within the themename_theme()?

Regardless, I saw that many users were having similar issues and figured that I would ask here for support.

Thanks in advance!

Comments

Elijah Lynn’s picture

Confirmed, same here.

candelas’s picture

same here

candelas’s picture

Category: support » bug
candelas’s picture

Category: bug » support

i kept reading and searching and it looks that if you have context module, the preprocess-node.inc or preprocess-page.inc will not work.
https://drupal.org/node/1317110

so i am going to try in the template.tpl.php since i have all the site already made...

candelas’s picture

Version: 7.x-3.1 » 7.x-3.0-rc2
candelas’s picture

Version: 7.x-3.0-rc2 » 7.x-3.1
candelas’s picture

Title: Preprocess functions not being called from the preprocess folder. » Preprocess functions dont work with $variables

hello and sorry for my bad english :)

i just realize that must be something with the $varibables scope because if i make print, it is made.

what i pretend to do is to hide the nodes from the taxonomy/term/tid

function crag_alpha_preprocess_page(&$vars){
  if (arg(0) == 'taxonomy' && arg(1) == 'term'  && is_numeric(arg(2))){
    //dpm($vars, "vars") ;    
    unset($vars['page']['content']['system_main']['nodes']);
    unset($vars['page']['content']['system_main']['pager']);
    unset($vars['page']['content']['system_main']['no_content']);
    //print "hola";
  }
}

if i uncoment print "hola"; it gets printed.
if i uncoment //dpm($vars, "vars") ;
i see that it shows $vars['page']['content']['content']['system_main']['nodes']

i have tried also (with and without the extra ['content']) with not success

    hide($vars['page']['content']['system_main']['nodes']);
    $variables['page']['content']['system_main']['nodes'] = null;

i have disable context i this happens also. so i think this module it is not the reason...

do you have any clue about this, please? or how can i find the reason?
at the moment i have resolved the nodes with the node.tpl.php and with css the pager and no_content, but i would like to be able to use theme functions of this kind (other functions that doesnt use $variables work).

thanks :)

candelas’s picture

more on it :) (thinking in other people having this problem)

i found that if i am not logged, it works with

unset($variables['page']['content']['content']['system_main']['nodes']);
//or
unset($vars['page']['content']['content']['system_main']['nodes']);

but not if i am logged
so some module its making me crazy :(