alexis

Content recount for collabs

Recommended Posts

When moving topics between collabs or collabs and forums, the members' post count keeps to be unchangeable, as the posts are counted separately for each collab.

Is there any way to recount member posts count for each certain collab?

I've tried to use Rules with the following different php codes:

1)
$collab = \IPS\collab\Collab::load( 1 );
$member->recountContent( $collab );
return "content recounted for " . $member->name;
2)
$collab = \IPS\collab\Collab::load( 1 );
$member->recountCollabContent( $collab );
3)
$collab = \IPS\collab\Collab::load( 1 );
$member->get_collab_count( $collab );

But no one helped me :( 

"Recount collab stats" button in the ACP settings doesn't touch the member posts counts at all.

Share this post


Link to post
Share on other sites

The following method is hooked onto the IPS\Member class so it is the correct method to use to cause the content to be recounted for a user given a specific collab.

/**
 * Recounts content for this member for a specific collab
 *
 * @return void
 */
public function recountCollabContent( \IPS\collab\Collab $collab )

If it isn't working, then your problem is somewhere else. From the info you have provided, I can't even guess. Sorry.

Share this post


Link to post
Share on other sites

Yes, I've seen that code in the ipsMember.php, and I tested it as mentioned above.
The issue is easy to test: 
1) Create a topic on the main forum, leave some posts there,Move the topic to a collab;
2) Create a custom action with a "Any Member" object argument;
3) Attach a rule to it with a php Action:

$collab = \IPS\collab\Collab::load( 1 );
$member->recountCollabContent( $collab );
return "content recounted for " . $member->name;

4) Run the custom action manually on that user, who left posts in those moved topic.

5) You should see, that the rule works, but the post count of that user isn't recounted. :( > it will be equal to 0 {zero}.

Share this post


Link to post
Share on other sites
17 hours ago, Kevin Carwile said:

Ok. Please try using this patch file and see if you have a different result.

./applications/collab/hooks/ipsMember.php

ipsMember.php

wow, you made so many changes in that file.

Thank you, it works without problem now.

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.