MyBB Community Forums

Full Version: Postbit_author_user template hooking
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Seems I am having a tough time adding the mypsdisplay directly into the "postbit_author_user" template. It displays nothing.

function myps_display(&$post)
{
      global $mybb, $db, $lang, $plugins, $post;

    $plugins->run_hooks("myps_display_start");

    $language = $mybb->settings['bblanguage'];
    $lang->load("myps");
    $lang->set_language($mybb->settings['bblanguage']);

if ($mybb->settings['myps_status'] != "off" && $post['uid'] != 0){

    $result = $db->query("SELECT * FROM `".TABLE_PREFIX."users` WHERE uid='".$post['uid']."'");
    $show = $db->fetch_array($result);
    $myps = round($show['myps'],$mybb->settings['myps_decimal']);
    $post['mypsdisplay'] = $mybb->settings['myps_name'].": <a href=\"myps.php?action=donate&username=". $post['username']. "\">$myps</a>";

  if($mybb->user['usergroup'] == "4" && $mybb->settings['myps_allowmod'] == 'mypspermadmin') {
    $post['mypsdisplay'] .= "(<a href=\"myps.php?action=moderate&username=". $post['username']. "\">". $lang->myps_edit. "</a>)";
    }

  if(($mybb->user['usergroup'] == "3" || $mybb->user['usergroup'] == "4") && ($mybb->settings['myps_allowmod'] == 'mypspermsmods')) {
    $post['mypsdisplay'] .= "(<a href=\"myps.php?action=moderate&username=". $post['username']. "\">". $lang->myps_edit. "</a>)";
    }

  if((is_moderator($fid) == "yes") && ($mybb->settings['myps_allowmod'] == 'mypspermall')) {
    $post['mypsdisplay'] .= "(<a href=\"myps.php?action=moderate&username=". $post['username']. "\">". $lang->myps_edit. "</a>)";
    }

  }

    $plugins->run_hooks("myps_display_end");
	

}

I can add $post['mypsdisplay'] directly to postbit but not inside postbit_author_user which of course makes more sense for it to be. Anyone know why?

EDIT: OK...looking deeper into it there are no hooks before the eval of the template. I may have to use a more universal hook. This is an oversight and it should be corrected. The postbit template isn't good enough since it doesn't display any author info in the PM area which is what I want. A hook before that template eval would be nice.
* LeX- also wants a new hook ! =P
I wanted to do the same thing with my plugin, but I quickly found this out too...

I would also like a better hook for deleting threads/posts Toungue as well as a hook to add code during an add/edit user. I guess hooking has it's limits though.
Delete Post = delete_post
Delete Thread = delete_thread
Add/Edit User ACP = admin_users_add | admin_users_do_add / admin_users_edit | admin_users_do_edit
Those work well though =P
Glad I wasn't the only one. Seems an oversight not to have a hook into a template used so often in various places.