Steps I take to get the info you're wanting:
* open up PhpStorm with the jamroom codebase project open and run a search for 'item_share_modal.tpl'
That returns 3 locations where that template is used, one is a comment, the other is the birthday module, so im 95% sure the one Im after is the one in the jrAction module.
I open that search result and see this function:
function view_jrAction_share_msg($_post, $_user, $_conf)
{
jrUser_session_require_login();
jrUser_check_quota_access('jrAction');
if (!isset($_post['_1']) || !jrCore_module_is_active($_post['_1'])) {
return 'error: invalid module';
}
if (!isset($_post['_2']) || !jrCore_checktype($_post['_2'], 'number_nz')) {
return 'error: invalid item_id';
}
$_temp = $_post;
$_temp['module'] = $_post['_1'];
$_temp['item_id'] = (int) $_post['_2'];
$_temp['template'] = false;
if (is_file(APP_DIR . "/modules/{$_post['_1']}/templates/item_share.tpl")) {
$_temp['template'] = 'item_share.tpl';
}
return jrCore_parse_template('item_share_modal.tpl', $_temp, 'jrAction');
}
At the bottom of that function is the location where $template could possibly be set, its this piece of code:
if (is_file(APP_DIR . "/modules/{$_post['_1']}/templates/item_share.tpl")) {
$_temp['template'] = 'item_share.tpl';
}
That piece of code reads:
"If the current module which is active from the url contains an item_share.tpl file then use that file"
So the answer to your question is: If the module being shared has provided its own template, then that is used.
--
Modules that provide their own item_share.tpl files can be found again with phpstorm. It tells us that currently only 2 modules do provide that template, they are the jrGallery module and the jrComment module.