PDA

View Full Version : v3 Articles, How many Articles a user made (in postbit)


Guy G
12-29-2004, 10:00 PM
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 (https://vborg.vbsupport.ru/showthread.php?t=65934)
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:
// insert new article
$DB_site->query("INSERT INTO " . TABLE_PREFIX . "article
(articleid,title,firstpostid,categoryid,open,artic leusername,articleuserid,dateline,iconid,articleha sh)
VALUES (NULL,'" . addslashes($title) . "',
0,
$c,
$open,
'" . addslashes($bbuserinfo['username']) . "',
'$bbuserinfo[userid]',
" . TIMENOW . ",
$iconid,
'" . addslashes($posthash) . "')");
$newarticleid = $DB_site->insert_id();

under it add:

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


Now run this query through PhpMyAdmin or something...

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:

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

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

<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! (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=73482) :]

cinq
12-29-2004, 11:28 PM
I don't use this hack, but just wondering how did you call

$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
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
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
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 "articles written : 0" all over my site..

kall
03-14-2005, 05:04 PM
Probably

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

:)

Polo
03-14-2005, 05:34 PM
Probably

<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
<if condition="$post[user_article_count]">Articles Written: $post[user_article_count]</if>

if that wont work than this might


<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 :)