Hi
Thank you.
Clearly I've failed to make any sense at all. I've just looked at the people block and it is absolutely nothing like what I was trying to achieve! The people block is a bit like the new contacts block but nothing like the old user contact block. The new one is more teacher contacting student and the old one was more student contacting the teacher.
I've added an attachment showing what appears on the home page of my moodle. You click the button and it goes to a form. If the user is logged in it pre-populates with their name and email address, if they aren't it puts up a pair of boxes for the user to type into. It then has a subject box and then a message field and then at the bottom we have the reCAPTCHA stuff and a send or cancel button.
We have a dedicated role set up to receive messages from this block.
When I try to use the version 2 one in a Moodle 2.4.3 even before I've edited out the text for an image it fails on the home page with a coding error.
I currently have debug turned on and this is what it says:-
Coding error detected, it must be fixed by a programmer: PHP catchable fatal error
Debug info: Argument 1 passed to get_users_by_capability() must be an instance of context, null given, called in [dirroot]\blocks\user_contact\lib.php on line 32 and defined
Error code: codingerror
Stack trace:
line 406 of \lib\setuplib.php: coding_exception thrown
line 3510 of \lib\accesslib.php: call to default_error_handler()
line 32 of \blocks\user_contact\lib.php: call to get_users_by_capability()
line 84 of \blocks\user_contact\block_user_contact.php: call to user_contact_getallhiddenrecipients()
line 284 of \blocks\moodleblock.class.php: call to block_user_contact->get_content()
line 232 of \blocks\moodleblock.class.php: call to block_base->formatted_contents()
line 953 of \lib\blocklib.php: call to block_base->get_content_for_output()
line 1005 of \lib\blocklib.php: call to block_manager->create_block_contents()
line 353 of \lib\blocklib.php: call to block_manager->ensure_content_created()
line 6 of \theme\boxxie\layout\general.php: call to block_manager->region_has_content()
line 804 of \lib\outputrenderers.php: call to include()
line 734 of \lib\outputrenderers.php: call to core_renderer->render_page_layout()
line ? of unknownfile: call to core_renderer->header()
line 234 of \lib\outputrenderers.php: call to call_user_func_array()
line 313 of \admin\renderer.php: call to plugin_renderer_base->__call()
line 313 of \admin\renderer.php: call to core_admin_renderer->header()
line 488 of \admin\index.php: call to core_admin_renderer->admin_notifications_page()
Line 32 in the lib file is all about hidden users
$hiddenrecipients = get_users_by_capability($blockcontext, 'block/user_contact:hiddenrecipient', 'u.id, u.firstname, u.lastname, u.email, u.mailformat', 'u.lastname ASC','','','','',false);
if ($debug) {
Sadly I'm not a php programmer so I'm lost at the first hurdle.
Hence wondering is there something new that replaces this very old block. If not, well maybe it is time to get started on learning to programme in php, it has been on the list of things to do for ling enough
Thank you.