PDA

View Full Version : Social Groups - Post Count


Brandy-Dw
02-19-2011, 07:52 PM
I'm currently using vbulletin version 4.1.0

And i'm curious how to make it so that social group posts add to a members post count and how social group posts add to the forum post count.

Would be very helpful if someone could help me with this...

thank you

--------------- Added 1298222000 at 1298222000 ---------------

anyone?... please..

induslady
08-18-2011, 02:47 AM
Hello,

As am too interested in this feature? Any ideas?

Badshah93
08-18-2011, 03:39 AM
To count social group posts in user total posts

Create New Plugin

HooK: group_message_post_complete

Title: ur wish

Code

$db->query_write("UPDATE ".TABLE_PREFIX."user set posts = posts+1
where userid = ".$vbulletin->userinfo['userid']."");


and don't forgot to make plugin active.

induslady
08-18-2011, 02:49 PM
Hello Sherif,

Thanks for sharing the plugin code.

After activating this plugin do I need to run "Maintenance>Update Counters > Update Post Counts"?

Badshah93
08-18-2011, 02:53 PM
Hello Sherif,

Thanks for sharing the plugin code.

After activating this plugin do I need to run "Maintenance>Update Counters > Update Post Counts"?

no it will count the social group post as main post from now onwards..

induslady
08-18-2011, 04:10 PM
Hello,

Can you tell me SQL query that I could run it one time so that the user's post count includes the social group messages prior to this plugin?

Mooff
08-18-2011, 05:08 PM
Wouldn't 'Update Post Counts' remove all +1 numbers the plugin added?

Lynne
08-18-2011, 08:45 PM
Wouldn't 'Update Post Counts' remove all +1 numbers the plugin added?
Yep.

If you wanted to really do this right, you would create a new field in the user table to keep track of the number of group posts. Then just add them together for the template. That will be a bit more involved though and won't just be a couple of little plugins.

induslady
08-19-2011, 04:22 PM
Hi Lynne, I tried this plugin :


Hook Location : postbit_display_start

code:
$usersid = $this->post['userid'];
$fpost = $this->post['posts'];
$gmessage = mysql_query("SELECT gmid FROM " . TABLE_PREFIX . "groupmessage WHERE postuserid='$usersid' AND state='visible'");
$gpost = mysql_num_rows($gmessage);
$totalpost = $fpost + $gpost;

Here post.posts is the total post count of user from forum postings and the query gets the post count from social group message an both are added.
Used this variable totalpost in the postbit template but not getting the desired result.

Can you let me know how to fix this.

Lynne
08-19-2011, 10:15 PM
What exactly seems to be the problem?

You do realize that that will create one additional query per post per page, correct?

induslady
08-20-2011, 05:09 AM
Hi Lynne,

When I use the below in postbit template:

{vb: raw totalpost}

It gives blank output.

Lynne
08-20-2011, 02:55 PM
And is that variable registered for use in the template?

induslady
08-21-2011, 10:47 AM
How do I register the variable - totalpost - to be used in the template - postbit?

Lynne
08-21-2011, 04:10 PM
Something like:
vB_Template::preRegister('postbit', array('totalpost' => $totalpost));

Cellarius wrote a really good article that you may be interested in - [vB4] Rendering templates and registering variables - a short guide (https://vborg.vbsupport.ru/showthread.php?t=228078)