Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Users posts Details »»
Users posts
Version: 1.2, by becafuel becafuel is offline
Developer Last Online: May 2008 Show Printable Version Email this Page

Category: Mini Mods - Version: 3.6.2 Rating:
Released: 12-09-2006 Last Update: Never Installs: 27
Uses Plugins
Additional Files  
No support by the author.

This small mod will tell you some small stats about where a member is posting : in which forums and what it represents against his total number of messages (see screenshot below. sorry it's a french screenshot ).
It respects your forums ordering and groups them by category, with a total by category.

Php code to place in the "modcp" dir, filename "usermess.php" :
PHP Code:
<?php
// ######################## usermess.php ###########################
//
// Quick stats for member's number of messages.
//
// Auteur : Bec ? Fuel
// Date   : December, 10 2006
// Version : 1.2

// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
@
set_time_limit(0);
 
// #################### PRE-CACHE TEMPLATES AND DATA ######################
$phrasegroups = array('style','cpuser','user','forum','search');
$specialtemplates = array('products');

// ########################## REQUIRE BACK-END ############################
require_once('./global.php');
require_once(
DIR '/includes/functions.php');

$phrase_percentage "Par rapport au total";

print_cp_header($vbphrase['user_manager']);
print_form_header('usermess','usermess',false,true);
print_table_header($vbphrase['search_users']);
print_input_row($vbphrase['username'],'membre',$membre,true);
print_submit_row($vbphrase['find']);  

if (
$_REQUEST['do'] == 'usermess')
  {
    
$membre $vbulletin->input->clean_gpc('p''membre'TYPE_STR);
    
$result $db->query_read("SELECT userid, username FROM "TABLE_PREFIX ."user WHERE username='".$membre."'");
    if (!
$db->num_rows($result) > 0)
      {
        
define('CP_REDIRECT''usermess.php');
        
print_stop_message('no_users_matched_your_query');
      }
    else
      {
        
print_table_footer();
        
print_form_header('usermess','usermess',false,true);
        
$r $db->fetch_array($result);
        
$userid $r['userid'];
        
print_table_break();
        
print_table_header($vbphrase['posts_made_by'].' '.$r['username'].' (id:'.$userid.')',4);
        
$total = array();
        
$tabparent = array();
        
$totalstr = array();
        
$result $db->query_read ("SELECT parentlist,title_clean,forumid FROM "TABLE_PREFIX ."forum WHERE parentid=-1 ORDER BY forumid");
        while (
$r $db->fetch_array($result))
          {
            
$tabparent[] = '%,'.$r['parentlist'];
            
$totalstr[] = $r['title_clean'];
          }
        
$totalgen 0;
        
$result $db->query_read ("SELECT COUNT(postid) AS nbmess FROM "TABLE_PREFIX ."post WHERE visible=1 AND userid=".$userid." GROUP BY userid");
        
$r $db->fetch_array($result);
        
$totalcalc $r['nbmess'] ? $r['nbmess'] : 1;
        
        
$forums = array();
        foreach (
$vbulletin->forumcache AS $forumid => $forum)
          {
            
$forums["$forum[forumid]"] = construct_depth_mark($forum['depth']-1'- - ') . ' ' $forum['title'];
          }
        
$tab2 = array();
        foreach (
$vbulletin->forumcache AS $key => $forum)
          {
            if (
$forum['parentid'] == -1) { $tab2[] = $forum['title']; }
          }
        
$i 0;
        foreach (
$vbulletin->forumcache AS $key => $forum)
          {
            if (
$forum['parentid'] == -1)
              {
                if (
$i 0) { print_cells_row(array('',$vbphrase['category']." : <q>".$tab2[$i-1]."</q>".$last,vb_number_format($total[$i-1],0,false,',',' ')."</span>",vb_number_format($total[$i-1]/$totalcalc*100,2,false,',',' ')." %"),true);  }
                
print_table_break();
                
$totalgen += $total[$i-1];
                
$i++;
                
$total[$i] = 0;
                
print_cells_row(array($vbphrase['forum'],'',$vbphrase['messages'],$phrase_percentage),1);
              }
            else
              {
                
$result $db->query_read ("SELECT "TABLE_PREFIX ."forum.parentid,"TABLE_PREFIX ."forum.title, COUNT("TABLE_PREFIX ."post.postid) AS nbmess
                                    FROM "
TABLE_PREFIX ."post
                                    LEFT JOIN "
TABLE_PREFIX ."thread ON ("TABLE_PREFIX ."post.threadid="TABLE_PREFIX ."thread.threadid)
                                    LEFT JOIN "
TABLE_PREFIX ."forum ON ("TABLE_PREFIX ."forum.forumid="TABLE_PREFIX ."thread.forumid)
                                    WHERE "
TABLE_PREFIX ."post.visible=1 and userid=".$userid." AND "TABLE_PREFIX ."forum.forumid=".$forum['forumid']."
                                    GROUP BY "
TABLE_PREFIX ."thread.forumid");
                
$r $db->fetch_array($result);
                if (
$r['parentid'] == -1) {  $last $forum['title']; }
                
$total[$i-1] += $r['nbmess'];         

                
$cell = array();
                
$cell[] = construct_depth_mark($forum['depth']-1'- - ') . $forum[title];
                
$cell[] = '';
                
$cell[] = vb_number_format($r['nbmess'],0,false,',',' ');
                
$cell[] = vb_number_format($r['nbmess']/$totalcalc*100,2,false,',',' ')." %";

                
print_cells_row($cell,false,false,0,'top',false,true);
              }
          }
        
print_cells_row(array('',$vbphrase['category']." : <q>".$tab2[$i-1]."</q>",vb_number_format($total[$i-1],0,false,',',' '),vb_number_format($total[$i-1]/$totalcalc*100,2,false,',',' ')." %"),true);
        
print_table_break();
        
$totalgen += $total[$i-1];
        
print_table_header($vbphrase['total_posts'].' : '.vb_number_format($totalgen,0,false,',',' '),4);     
        
        
print_cp_footer();
      }
  }
?>
Module to create using "mod_index_navigation" hook (choose a name you like for this module) :
PHP Code:
construct_nav_spacer();
construct_nav_option('Number of messages''usermess.php?');
construct_nav_group('Menu title'); 
I hope you will enjoy this. It's not a great mod, but I think it can be useful or at least handy, though.

Last changes :
v1.2
  • Forum list correctly ordered to reflect layout order
  • Now showing forum with no messages
  • Added new variable for a non-translated text


v1.1
  • Replace some hardcoded string with vbphrases
  • Correct division by 0 for forums with no posts
  • Added cosmetics to display categories headers & footers

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #52  
Old 12-14-2009, 02:33 PM
Cercle Cercle is offline
 
Join Date: Apr 2007
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry Lynne. I´m not a coder and my knowledge is very limited.

I have created an activated the plugin with the short code (Hook location: Ajax_start)

I have created a php file with the large code and renamed it as usermess.php in the modcp directory.

Which permissions do you mean?

Thank you in advance.
Reply With Quote
  #53  
Old 12-14-2009, 03:37 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Cercle View Post
I have created an activated the plugin with the short code (Hook location: Ajax_start)
This is what is in the first post regarding the plugin:
Quote:
Module to create using "mod_index_navigation" hook (choose a name you like for this module) :
He says to use the mod_index_navigation hook, not the ajax_start hook.
Reply With Quote
  #54  
Old 12-14-2009, 03:51 PM
Cercle Cercle is offline
 
Join Date: Apr 2007
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
This is what is in the first post regarding the plugin:

He says to use the mod_index_navigation hook, not the ajax_start hook.
Ok. Now it?s changed., sorry for this mistake. I have have re-uploaded in ASCii mode de files and I can see now on de mocp:

Menu title
Number of messages.

But clicking on Number of messages, I?m getting the error 404 The requested URL /forum/modcp/usermess.php was not found on this server.


What am I doing wrong?.

Thank you
Reply With Quote
  #55  
Old 12-14-2009, 03:55 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Cercle View Post
But clicking on Number of messages, I?m getting the error 404 The requested URL /forum/modcp/usermess.php was not found on this server.


What am I doing wrong?.

Thank you
If you ftp to your site and go to /forum/modcp, is there a usermess.php file in there?
Reply With Quote
  #56  
Old 12-14-2009, 03:59 PM
Cercle Cercle is offline
 
Join Date: Apr 2007
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
If you ftp to your site and go to /forum/modcp, is there a usermess.php file in there?
Yes.

I have created this file because it?s wasn?t there, renamed it from txt to .php, the entire code copy and paste and then uploaded to forum/modcp.
Reply With Quote
  #57  
Old 12-14-2009, 04:23 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Cercle View Post
Yes.

I have created this file because it?s wasn?t there, renamed it from txt to .php, the entire code copy and paste and then uploaded to forum/modcp.
Check the permissions on it and chmod to 644 (I don't know your ftp client, so you'll have to figure out how to do that yourself).

As a side comment, I just looked in my files and I have this in my admin cp folder. I'm not sure if I just modified the mod, or what, but mine is there, the mod points to it there, and it works just fine.
Reply With Quote
  #58  
Old 12-14-2009, 05:17 PM
Cercle Cercle is offline
 
Join Date: Apr 2007
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

By clicking in properties I´m getting the code 644, then I think that this is correct.

How can I check these permisions on?

Thank you for your help.
Reply With Quote
  #59  
Old 12-14-2009, 06:50 PM
Cercle Cercle is offline
 
Join Date: Apr 2007
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Maybe I do something wrong.

To make a php file what I did is:

txt file with the code and rename the .txt to .php extension (final name: usermess.php), then uploaded it via ftp to forum/modcp/usermess.php

I hope that this is the correct way.

I?m the all day trying to solve this problem with no solution at the moment. I?m really fustrated
Reply With Quote
  #60  
Old 12-14-2009, 06:52 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If the permissions are correct on the file and the file is in the correct place and you created the plugin using the correct hook and it is active, then I don't know what the problem is. I suppose you can check your error_logs (if you don't know where they are, ask your host) and see if anything is in there.

As for creating a file.... I just create a file and when I go to save it, I save it as name.php. I don't save it as a text file and then rename it. That could be your problem - I really don't know.
Reply With Quote
  #61  
Old 12-14-2009, 06:57 PM
Cercle Cercle is offline
 
Join Date: Apr 2007
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
If the permissions are correct on the file and the file is in the correct place and you created the plugin using the correct hook and it is active, then I don't know what the problem is. I suppose you can check your error_logs (if you don't know where they are, ask your host) and see if anything is in there.

As for creating a file.... I just create a file and when I go to save it, I save it as name.php. I don't save it as a text file and then rename it. That could be your problem - I really don't know.
Ok, thank you very much Lynne. One more question only.

How do you create a file then? which program do you use?

I copy the code...but where if not in a txt?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:41 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.13129 seconds
  • Memory Usage 2,388KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_php
  • (7)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete