Giorgi625 VIP
Total posts: 655
24 Nov 2021 12:19

I need to show records of current user in Records module so it should display records created by user who is viewing this page.

I selected in what to show created, but it does not display anything.

When I select in what to show bookmark it shows only records I have bookmarked.

How can I show items I created when I am viewing page with records module and when other user is viewing his created records?

Last Modified: 28 Nov 2021


Giorgi625 VIP
Total posts: 655
27 Nov 2021 16:34

I was able to solve this problem.

So first step is to add option to What to show dropdown using mod_cobalt_records xml file of module

I added this:

second step is to run specific query when this option is set in module settings.

in mod_cobalt_records php file I added this code

php
if($params->get('view_what', 'all') == 'author')
{
    $query = $db->getQuery(TRUE);
    $query->select('id');
    $query->from('#__js_res_record');
    $query->where('user_id = '.$user->get('id'));
    $query->where('published = 1');
    $query->where('hidden = 0');
    $query->where('section_id = ' . $params->get('section_id'));
    $db->setQuery($query);
    $ids = $db->loadColumn();
    if(empty($ids))
    {
        return;
    }
    $params->set('view_what', 'all');
}

it seems to work for me. hope it will help someone else too. Now I can create Centralized place where will be shown records created by current user.

As I am using JSN Easy Profile Pro(they have integration with Emerald) I wanted to get integration plugin for Cobalt too but I am not good enough to do it on my own so I asked someone else who asked about 350USD for this plugin. I am happy I found alternative for free and it seems to be better alternative. Because I can simply create multiple modules for each section I have on my website and put them inside tabs or collapse and publish below Component area in my template this possition is content-bottom and because this Records module allows to set template to each module I can customize it as I wish.


Giorgi625 VIP
Total posts: 655
27 Nov 2021 18:33

https://youtu.be/k9ZmpGg7aAU In this video you can see result. So each group for separate section and via Collapse you can see records you created(first line) or bookmarked(second line) in each group. Depending on Sections for some of them I plan to add rated and commented records too as extra collapses. Currently there is simple table for records list with only title and category but depending on section can be modified to show more data.


Giorgi625 VIP
Total posts: 655
28 Nov 2021 16:28

I feel stupid. it seems that there was no need of custom coding. This module already was able to do it, Just needed to select Created in dropdown of What to show and in User limit set to Restrict currently logged in user and it works.


Giorgi625 VIP
Total posts: 655
28 Nov 2021 16:30

Now I see that there is need of Good documentation. Current does not fill most of Cobalt features and you need to experiment to understand some of features meanings. Also for non coders this documentation is in some point little hard to understand.

Powered by Cobalt