Most read article plugin for OJS 3.1.1.2

Hi @ajnyga,

Can I show sum of abstract and download views by modifying the SQL query I found inside the MostReadBlockPlugin.inc.php file:

SELECT submission_id, SUM(metric) AS metric FROM metrics WHERE (day BETWEEN $weekAgo AND $currentDate) AND (assoc_type='1048585' AND submission_id IS NOT NULL) AND (context_id='?') GROUP BY submission_id ORDER BY metric DESC LIMIT

How should I modify it?
Best regards,
Faruk

Hi both and sorry for the delay, have been busy.

I am planning to do an official release for OJS 3.1.2 within a month. At the moment the plugin does not support 3.1.2 (@Lazar_Stosic error) and the things @BJBMS is asking for will be available as plugin settings. There is already a dev branch here that includes some new features and should work with 3.1.2. You are welcome to test it. GitHub - ajnyga/mostRead at dev-3-1-2

Still error mistake and doesn`t work.
Error.log>

[06-May-2019 12:06:35 Europe/Belgrade] PHP Fatal error: Call to undefined method MostReadBlockPlugin::getTemplateResource() in /home/ijcadsee/public_html/plugins/blocks/mostRead/MostReadSettingsForm.inc.php on line 26
[06-May-2019 12:07:21 Europe/Belgrade] PHP Warning: file_get_contents(plugins/blocks/mostRead/block.tpl): failed to open stream: No such file or directory in /home/ijcadsee/public_html/lib/pkp/classes/template/PKPTemplateResource.inc.php on line 35
[06-May-2019 12:07:21 Europe/Belgrade] PHP Warning: Smarty error: unable to read resource: "plugins/plugins/blocks/mostRead/blocks/mostRead:block.tpl" in /home/ijcadsee/public_html/lib/pkp/lib/vendor/smarty/smarty/libs/Smarty.class.php on line 1094

1 Like

Hi AJ,

I’ve also upgraded from 3.1.1-4 to 3.1.2 and now several block plugins produce an error starting with: “Uncaught → Smarty: Unknown resource type 'plugins-plugins-blocks-”. Any idea what that may be?

Do you know of any documentation on making plugins OJS 3.1.2 compatible?

Regards
Jannie (AJOL)

Hi @ajnyga,

Thank you for updating your plugin. I find settings for title and number of days, however, is it possible to choose between showing a total number of views, downloads or abstract views?
How should I modify the files to choose between those?

Thanks a lot
Dijana

Hi @ajnyga,
I submitted the italian locale for the plugin on Github /it_IT/locale.xml by bolelligallevi · Pull Request #8 · ajnyga/mostRead · GitHub
I think it could be usefull to add a readme (i.e. to explain how often the view number changes, as @BJBMS asked), do you agree if I submit a draft on Github?
Best regards
Stefano Bolelli Gallevi

Thanks @bolelligallevi, please do!

The plugin started as a quick solution for a recurring request here at the forum. I have been working on getting it ready for an official release and for the official plugin gallery, but have not had the time.

Thank you @ajnyga.
I submitted the readme README.md suggestion by bolelligallevi · Pull Request #9 · ajnyga/mostRead · GitHub, but something is inferred from usage, I’m not sure everithing is correct, so please read it before merge.
Best regards

Hi everyone!
if this information can help, to change the time range of visits, just open the file “MostReadBlockPlugin.inc.php” at line 82 where there is:
$weekAgo = date(‘Ymd’, strtotime("-1 week"));
where if -1 is the week from the current day, just change it to -4 and it will be a month from the current day, and so on…

I hope I’ve clear. :slight_smile:

Bye
Tiziano

After updating our OJS, we decided to try Most Read Articles block plugin. At first glance, everything is very cool. I figured out the Russian language by creating a Russian locale through Translator plugin.
image

But faced with the following problem. The plugin always shows the article title in Russian. Regardless of which version of the site is used:

image

image

Although, of course, all articles have both Russian and English titles.

@ajnyga, what are we doing wrong? Is it possible to somehow match the language of the article title to the language version of the site?

I do not think you are doing anything wrong :smiley:

I have to check the code when I have the time. Most likely the title is not called correctly.

Thanks! We’ll wait for the news.

hmm, I think I know what is going on.

The plugin creates a cache file so that it works faster. However, that cache is not localized. So if you create the cache using the russian locale, it will show that same cache also for the english locale as long as the cache becomes old.

I have to look around how other things in OJS are taking localised data into consideration.

Wow… Yes, definitely for most of our journals the Russian locale is the default. I now turned on the plugin in the English locale on one of the journal. And it displays only English article titles in both versions of the site. So now the cache is not “multilingual” for sure.

this is definitely something I can fix, I just have to figure out the best way. You could either have a cache file for each locale or alternatively have the all the versions of the title in the single cache file and make sure you call the right one. I will see what the better solution is in this case.

Hi @ajnyga

Thanks for the great plugin. Can you instruct me how to show abstract views or total views instead of downloads?

Thanks,
Faruk

Are there any news on our issue?..

sorry, been busy with OPS. I will try to get back to this soon.

Hi @ajnyga,
I wanted to report that this plugin does not work on OJS 3.2.0.1 platform.
Displays the error:

Unrecognized DAO PublishedArticleDAO!

Thanks
Bye
Tiziano

yeah, did not port to 3.2 yet

1 Like