Hai I have modules called sites/all/module/dashboard and sites/all/module/userpoints

I need to display userpoints in inside the dashboard. There is a hook in sites/all/module/userpoints/userpoints.module called userpoints_block() to display the userpoints . Can i access this hook userpoints_block() in sites/all/module/dashboard/dashboard.module . How to do this?


Use module_invoke() to call the functions in other module

  • Could you please tell me that where i have to put this module_invoke – iLaYa ツ Feb 22 '12 at 8:57
  • Thanks sathish. Its worked for me after i put this code $block = module_invoke('userpoints', 'block', 'view',1); print $block['content']; – iLaYa ツ Feb 22 '12 at 9:28

module_invoke seems to be a very handy option for this

(ex) To get content of the Most Recent Poll (core module's block) content

module_invoke('poll', 'block', 'view', '0');

The first argument is the name of the module, second being hook, third and fourth are the params for the hook namely condition ('view') and block delta value (0). The return value is an array of block subject and content.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.