MyBB Community Forums

Full Version: accountswitcher_attached_postcount Not Showing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello!

As indicated by the title, I have the Account Switcher installed and am trying to make the post count of the attached (IC) accounts show up on the Main (OOC) account. For some reason, it is not working.

Here is an example of how it isn't working. There should be a number before 'IC Posts' on my postbit profile.

[Image: 84b92cb1800b03311ea914ad7d20f5fd.png]


Here is my postbit_author_user code:
<!-- THIS IS THE MINI-AVATAR --> 
 <center><img src="http://blood-ties.net/rp/images/groupbadge/{$post['fid2']}.png" title="{$post['fid2']}" height="90px"></center>
<!-- END OF MINI-AVATAR -->

<!-- THIS IS THE LINE BREAK -->
<!-- <h1></h1> -->
<!-- END OF LINE BREAK -->

<div style="padding-left: 10px;">

<!-- PROFILE FIELDS - USE pb_full
  FOR A FIELD THAT SPANS THE
  WIDTH OF THE ENTIRE PROFILE,
  USE pb_half FOR A FIELD THAT 
  SPANS ONLY HALF -->
<div class="pb_full">{$post['fid3']}</div>
<div class="pb_full">Registered: {$post['userregdate']}</div>
<div class="pb_full">{$post['postnum']} OOC Posts</div>
<template accountswitcher_attached_postcount>
<!-- END OF PROFILE FIELDS -->

</div>
<!-- THIS IS THE LINE BREAK -->
<h1></h1>
<!-- END OF LINE BREAK -->

<div style="padding-left: 10px;">
<!-- PROFILE LINKS -->
<div class="pb_full"><b><u>Discord</u></b><br /><if in_array($GLOBALS['mybb']->user['usergroup'], array(2,3,4,5,6,8,13,14,16,17,18,19,22,23,24,25,26,27,28)) then>{$post['fid4']}
<else> 
{please sign in}</if></div>
<!-- END PROFILE LINKS -->

</div>

<!-- THIS IS THE LINE BREAK -->
<h1></h1>
<!-- END OF LINE BREAK -->

<div class="pb_player">

<!-- PLAYER NAME -->
{$post['fid1']}

<!-- END PLAYER NAME -->
</div>

<div class="pb_box">{$post['fid5']}</div>

Here is the accountswitcher_attached_postcount code:
<div class="pb_full">{$as_postcount} IC Posts</div>

Here is the original accountswitcher_attached_postcount code:
<span class="attached_postcount">{$lang->aj_attached_post_count}{$as_postcount}</span>

It shows up and works on the Default profile:
[Image: 5142fd8c433ee1fe9688123b533acce9.png]

And appears to be a part of the {$post['user_details']} -- however, on my default postbit_author_user, there is nothing there to call it? But it vanishes when I delete the {$post['user_details']} from the postbit_classic template.

 {$lang->postbit_posts} {$post['postnum']}<br />
 {$lang->postbit_threads} {$post['threadnum']}<br />
{$lang->postbit_joined} {$post['userregdate']}
{$post['replink']}{$post['profilefield']}{$post['warninglevel']}

You can view it in action here

Any assistance with this would be outstanding, because I'm absolutely befuddled!
Giving this a bump, because I'm still completely befuddled :)
If all the accountswitcher templates are all in Global Templates, then it continues to be a mystery.
Otherwise check that template differences between Default and Revenge themes are as expected.
Since there are conditions in the templates, they may cause problems not easily discerned by simply looking for typos.
Guest account cannot switch themes.

Very creative mods, good job there.
It doesn't work in "postbit_author_user" because the template is rendered before the "postbit" hook is called and the variable is created.
You could only try to "cheat" by searching in inc/plugins/accountswitcher/as_functions.php for:
$post['user_details'] .= $attached_post_count;


replace it with:
$post['attached_post_count'] .= $attached_post_count;
eval("\$post['user_details'] = \"".$templates->get("postbit_author_user")."\";");

and use the variable {$post['attached_post_count']} in your "postbit_author_user" template. {$post['attached_post_count']} contains the content of the "accountswitcher_attached_postcount" template.
Thank you!! That worked perfectly Big Grin