I guess I could run some sql request in posts table, where date of post > n. That will give me total number of posts. I remember that there is "count" or something, that would give me an array with usernames as keys and post count as value.
Can you help with this please?
Hi,
I'd like to make a post on my forum to list and thank members who were the most active last year. Can anybody suggest how to find them?
It's easy for new members who registered in 2023. In ACP -> Users I can filter by the registration period and then sort them by posts number or received...
I'm re-reading again "Let's build an add-on" and it looks like I may be have to add a class extension for XF\Admin\Controller\User ?
But do I really have to do it if in Setup.ph I indicated setDefault(0) for both custom columns? Shouldn't the system just put 0 in both fields without any...
no, not fetching one to update. sorry for my english. )
I mean maybe there is something like 'updater' (like finder) in xenForo. something like
$user = \XF::updater('XF:User')
->where('user_id', $userId)
->update('av-aw-processed', $someData);
$user->save();
)))
Hey Kirby! I too built myself an add-on that hides from guests all those links to 301 redirects to posts. However i guess google still visit them as they are already in their index. Did you use some way to ask google to drop those posts from the index?
Oops ... It looks like I missed something. Did I have to modify some standard method like memberCreate or memberSave or something like that?
I see an error in ACP
MySQL statement prepare error [1054]: Unknown column 'av_aw_processed' in 'field list'
Today at 7:22 AM...
I have cache and pageCache enabled (Redis) in my config file. And when I test pages with a tool like GMetrix I see that the second run shows better results. So it's not a question that cached pages are loaded faster.
Here is what I'm thinking about. My forum has about 1k visits and 2k pageviews...
I added a custom column av-aw-processed into xf-user table. I want to be able to 'mark' users by updating the field (overwrite with the current timestamp).
Is there some built in xF way to do it, like fetching with a finder? Or I should run a usual SQL query like
public function...
Hmm... but then again... Let's say I "processed" a user and marked him as "Processed" in my add-on. Timestamp got written into av_aw_processed. But if later I'll edit this user profile in ACP the value in av_aw_processed will be overwriten to 0?
I'll lose the "mark" that he was already...
Oh, wait... I just understood.
$structure->columns['av_aw_processed'] = ['type' => Entity::UINT, 'default' => time()];
'default' => time() means that whenever a user will be edited (not with my add-on) the current timestamp will be written into 'av_aw_processed'? That's not what I was...
Thank you very much!
I ended up with this. Do hope nothing will explode. )
<?php
namespace AV\ActivityWatcher;
use XF\Mvc\Entity\Entity;
class Listener
{
public static function userEntityStructure(\XF\Mvc\Entity\Manager $em, \XF\Mvc\Entity\Structure &$structure)
{...