Hi,

I am current using the Profile2 module to display a job applicant's information on his/her profile page; as far as basic profile information is concerned, everything is rendered correctly. However, I would also like to add a list of jobs that this applicant has applied to on his/her profile page. The way I want to implement this is to set up this variable in inside a hook, then pass the argument to be rendered in the corresponding .tpl.php file. I would like to know two things under this circumstance :

1. Which hook to use.
2. How to pass the variable from within the hook to the .tlp.php file.

Thank you.

Comments

blueminds’s picture

You need a preprocess callback not a hook. For example, you have a defined theme my_user_profile with corresponding tpl.php file. So create a function named MY_MODULE_my_user_profile_preprocess(&$variables). Within that function apply the logic that inserts desired data into $variables parameter ($variables['my_data'] = ...). Than in the template file this data is available from a variable named $my_data.