2015-02-24, 10:27 PM
How do I make the results visible in the template?
I tried "{$post['facebook_id']}" and "$post['yahoo_id']" in the Postbit template, but nothing shows.
I tried "{$post['facebook_id']}" and "$post['yahoo_id']" in the Postbit template, but nothing shows.
$post['facebook_id'] = $post['yahoo_id'] = '';
if(THIS_SCRIPT == 'showthread.php' && (string)$mybb->input['mode'] != 'threaded') // mybb 1.6
{
static $my_custom_cache = null;
if($my_custom_cache === null)
{
global $pids;
$query = $db->query("
SELECT s.uid, s.facebook, s.yahoo
FROM ".TABLE_PREFIX."socialusers s
LEFT JOIN ".TABLE_PREFIX."posts p ON (p.uid=s.uid)
WHERE p.{$pids}
");
while($social = $db->fetch_array($query))
{
$my_custom_cache[$row['uid']] = $row;
print_r($social); //View the arrays
}
}
}
else
{
// do a normal query because there is only one post in the page anyways
// code here should work for postbit_pm, postbit_annoucmenet hooks.
// postbit_prev (hook while editing a post that may not yet exists) may need special handle
// Things get complicated the more you dig into details :P
}
if(isset($my_custom_cache[$post['uid']]))
{
$post['facebook_id'] = htmlspecialchars_uni($my_custom_cache[$post['uid']]['facebook']);
$post['yahoo_id'] = htmlspecialchars_uni($my_custom_cache[$post['uid']]['yahoo']);
}
else
{
// this post has no user/social data? Hmm..
}