Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
OK, I've worked with drupal for only a couple of days so don't know precisely where the problem originates, but the fact is that post count does not show in author pane.
if I put
<?php print user_stats_get_stats('post_count', $account_id) >
directly in advf-author-pane.tpl.php , the number shows up, but the way advaced forum does that:
<?php if (isset($user_stats_posts)): ?>
<div class="author-pane-line author-posts">
<span class="author-pane-label"><?php print t('Posts'); ?>:</span> <?php print $user_stats_posts; ?>
</div>
<?php endif; ?>
does not work for me, $user_stats_posts
is not set. I would continue the investigation, but I don't know who is responsible for setting this variable, advanced forum or user_stats?
Comments
Comment #1
MichelleYou're sure you have the view statistics permission set? Also, please confirm that you are, in fact, using alpha 13 and not the dev as I know for sure this isn't working in the dev as none of the contrib integration works currently.
Michelle
Comment #2
sniegs CreditAttribution: sniegs commentedYes, 6.x-1.0-alpha13 (double checked in admin/build/modules).
Yes, "view statistics" permission is set for authenticated user both in statistics and in user_stats modules in admin/user/permissions (even if it was not, I guess user 1 as a superadmin would still be able to view post count?)…
Comment #3
MichelleHmm... This is a toughie. Can you put in some debugging code into user-stats.forum.inc and make sure the variable is getting set there?
Michelle
Comment #4
sniegs CreditAttribution: sniegs commentedI already did that and IMHO function
user_stats_preprocess_author_pane
is not being called (who is responsible for that? I don't know drupal architecture yet unfortunately).If I put the contents of this function (including permission checks) in
advf-author-pane.tpl.php
, everything works though. So this definitely is not a permission problem.Comment #5
MichelleDrupal should be calling that, provided the file is getting included properly. Try putting a deliberate typo in that file, but outside of the function and clear the cache. If it doesn't choke on the error, then the problem is with the include code.
Is the contact link showing up, assuming you use that module?
Michelle
Comment #6
sniegs CreditAttribution: sniegs commentedOK, will try.
The same problem is with
privatemsg
.Contact , join date and online/offline status work flawlessly.
Comment #7
MichelleHmm... That is really bizarre. The join date and on/offline status are in the .module not in .inc files but contact is done via the hook just like contrib.
Just to be sure, in advanced_forum/modules, you have privatemsg.forum.inc and user_stats.forum.inc, correct?
Sorry for all the questions but this is working just fine for me so it's hard for me to guess what might be wrong.
Michelle
Comment #8
sniegs CreditAttribution: sniegs commentedI put a bunch of echos both in
user_stats_preprocess_author_pane
function and outside it. None showed up.But cleaning the cache solved everything! All echos were displayed as well as post count and privatemsg.
Removed my own code from everywhere and everything works now. Cache was set to Normal, don't know why it would interfere…
Anyway, thanks and sorry for wasting your time Michelle!
Comment #9
MichelleStrange. Those files are cached but they should all have been cached at once when the module was enabled. Anyway, glad you got it working. :)
Michelle
Comment #10
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #11
maki124 CreditAttribution: maki124 commentedI'm afraid I have the same problem, but with 5.x-1.0-alpha16.
print user_stats_get_stats('post_count', $account_id)
works, but the Advanced forum code returns nothing. For now I'm using the above to display post counts. (I've tried flushing the cache, and the usual debugging methods like echoing the variables, as above too. $user_stats_posts is not set.)
Maybe I'm missing something, but I don't see a user-stats.forum.inc file anywhere. Is this 6.x specific? Should it have been included in the alpha-16 package?
Thank you so much for this module in any case. It's helped me get a forum up within Drupal in record time without resorting to a 3rd party forum. I opened the forum on Thursday and it's already getting hit hard (which is a good thing). You can see it in action here: http://justbento.com/forum .
Comment #12
MichelleThe user stats hook is included in user stats itself. Make sure you're using the dev version and clear your cache after installing.
Michelle
Comment #14
McSukkelaar CreditAttribution: McSukkelaar commentedThanks a lot, Michelle #1. I was working around this for way too long when you're comment made me realize that i dit not set permissions for this. D'oh!