Giorgi625 VIP
Total posts: 655
16 Apr 2017 18:30

I see Cobalt has module Article participants.

I need similar function but to display users who have rated record which is opened now or users who have bookmarked current record.

Is it easy to modify Article participants module to get this function?

Last Modified: 22 Apr 2017


pepperstreet VIP
Total posts: 3,837
18 Apr 2017 02:40

Giorgi625 Is it easy to modify Article participants module to get this function?

Hello Giorgi625, you might be interested in my older related topic:

Module - Article Participants - options - who did what - type of participation

I had created it because of the module's limitations. Unfortunately nothing has changed, yet.

I remember, you had to modify the module's helper file and the respective SQL query. Quite simple, but a "core hack".

To be save on updates, you might create copies of the whole module.
Or even add multiple parameters that are passed to the helper file, instead of hard-coded values.


BTW, thanks for reminding me on that issue! ;)


Sergey
Total posts: 13,748
18 Apr 2017 14:59

It should be easy. All you have to do is change line 22 of modules/mod_cobalt_participants/mod_cobalt_participants.php

$query = "SELECT user_id FROM #__js_res_hits WHERE user_id > 0 AND record_id = {$id} GROUP BY user_id";

to

$query = "SELECT user_id FROM #__js_res_vote WHERE user_id > 0 AND (ref_id = {$id} AND ref_type = 'record') GROUP BY user_id";

Giorgi625 VIP
Total posts: 655
18 Apr 2017 15:24

When I change that module just dissapears :/


Giorgi625 VIP
Total posts: 655
21 Apr 2017 09:17

I have made mistake, it works fine, it displays only user who has rated.

As I guess we can just reaname module files and change in Sergey's suggested code vote field to bookmark field and we will have another module for bookmark participants.


pepperstreet VIP
Total posts: 3,837
22 Apr 2017 00:43

suggestion / idea

Maybe we should collect all possible queries (that make sense for an application),
and we add a module parameter to choose the "type of participation".
Then add a PHP "switch" for the parameter value, and than execute the respective query.
So, we got 1 module for all...

Powered by Cobalt