vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   v3 Articles, How many Articles a user made (in postbit) (https://vborg.vbsupport.ru/showthread.php?t=73482)

Guy G 12-29-2004 10:00 PM

v3 Articles, How many Articles a user made (in postbit)
 
This is my first hack so please be nice to me :P
This is an addon for the v3Article hack which can be found HERE
Anyway, this hack will add a field in the postbit for how many articles a user has posted.

Specs:
Templates Edited:1
Queries added: 1 during new article post.
File Edits: 1
Tables Changed: 1
Installation Time: 3min

So, first of all open Article.php and find the following code:
PHP Code:

// insert new article
    
$DB_site->query("INSERT INTO " TABLE_PREFIX "article
    (articleid,title,firstpostid,categoryid,open,articleusername,articleuserid,dateline,iconid,articlehash)
    VALUES (NULL,'" 
addslashes($title) . "',
    0,
    
$c,
    
$open,
    '" 
addslashes($bbuserinfo['username']) . "',
    '
$bbuserinfo[userid]',
    " 
TIMENOW ",
    
$iconid,
    '" 
addslashes($posthash) . "')");
    
$newarticleid $DB_site->insert_id(); 

under it add:
PHP Code:

        $DB_site->query("UPDATE " TABLE_PREFIX "user 
        SET user_article_count = user_article_count+1 "
); 

Now run this query through PhpMyAdmin or something...
PHP Code:

ALTER TABLE vb3_user` ADD `user_article_count` INT(10) UNSIGNED DEFAULT '0' NOT NULL; 

note that "vb3" should be your table prefix!

now after you done that its time for template editing..
go to postbit_legacy (for me) and search for this line:
PHP Code:

$vbphrase[posts]:</span$post[posts]</div

directly under it add this(customize colors as you want..):
PHP Code:

<div class="postbit" align="left"">
                    <span style="
color#8B9DB0; font-weight: bold">Articles Written:</span> $post[user_article_count]</div> 

note: if you already created articles than it will not update your status, you will need to manually add the numbers to the ppl who posted articles.

Feel free to comment and enhance this hack by any way.

Thats it! your done Click Install! :]

cinq 12-29-2004 11:28 PM

I don't use this hack, but just wondering how did you call
PHP Code:

$post[user_article_count

without amending showthread.php ?

Also, instead of creating a new column in the user table, why not just query the article table for count(articleuserid) ?

:)

Guy G 12-29-2004 11:33 PM

1. $post[user_article_count] uses the existing array that the showthread.php uses, so all i had to do is echo it.. showthread.php already SELECT * from vb3_user ...

2.you could do that, but it would be better to have 1 additional query used whenever posting a new article than adding an additional query to showthread.php which is excuted alot more times, therfore better performance :]

cinq 12-30-2004 12:07 AM

Ic. Thanks for the clarification,Zorobz :D

BarHopper 12-30-2004 09:03 AM

Im gonna defaintly use this, excellant. :) Also, on your screenshot, i see the boxes around the fields, in the postbit. How do you do that?

Guy G 12-30-2004 12:37 PM

thats just part of the style...

Guy G 12-30-2004 10:15 PM

Update hopefully coming soon...

trackpads 01-03-2005 10:02 AM

Excellent, gonna use for sure!

KTBleeding 01-11-2005 04:58 AM

Question: Is there an easy way to get this to link to all the articles submitted by the user? Rather than just listing how many they have posted, could it also link to them? Thanks.

Guy G 01-13-2005 06:38 PM

Quote:

Originally Posted by KTBleeding
Question: Is there an easy way to get this to link to all the articles submitted by the user? Rather than just listing how many they have posted, could it also link to them? Thanks.

Possible of course...

Ill see what i can do.

Amavisca 01-16-2005 04:31 AM

Quote:

Originally Posted by Guy G
Possible of course...

Ill see what i can do.

Ya plz do it, I was gonna have the same question 4 u

Guy G 01-17-2005 06:59 PM

Quote:

Originally Posted by Amavisca
Ya plz do it, I was gonna have the same question 4 u

Ok im not sure this gonna happen, a new article system came out, a better one...

Polo 03-14-2005 03:39 PM

Is there a way so that the number of articles written is shown only if the members has 1 article or more? not many of my members post articles and I would not like to see a bunch of
Quote:

"articles written : 0"
all over my site..

kall 03-14-2005 05:04 PM

Probably
PHP Code:

<if condition="$post[user_article_count]">Articles Written$post[user_article_count]</if> 

:)

Polo 03-14-2005 05:34 PM

Quote:

Originally Posted by kall
Probably
PHP Code:

<if condition="$post[user_article_count]">Articles Written$post[user_article_count]</if> 

:)

thanks kall... I will give it a try ;)

Guy G 03-15-2005 09:40 AM

Quote:

Originally Posted by kall
<if condition="$post[user_article_count]">Articles Written: $post[user_article_count]</if>

if that wont work than this might

HTML Code:

<if condition="$post[user_article_count] >= 1">
<div class="postbit" align="left"">
                    <span style="color: #8B9DB0; font-weight: bold">
Articles Written:</span> $post[user_article_count]</div>
[/if]


Polo 03-15-2005 12:16 PM

I'm starting to have some problems with v3articles :( .... now I'm almost in the 130th article and it seems like the system just cant handle more articles... so I think I will start looking into other options :ermm:

thank you for the help anyways, I really appreciate it...

commTRU 08-26-2005 01:14 PM

This is a really useful add-on.. Sadly I can't seem to get it to work. In the post bit it says that everyone has posted a article when I have :\

Its a really good idea though :)


All times are GMT. The time now is 04:40 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01512 seconds
  • Memory Usage 1,772KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_html_printable
  • (8)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (18)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete