jDownloadsownloads.com

Author Topic: 0 - Using $this when not in object context  (Read 1706 times)

0 Members and 1 Guest are viewing this topic.

Offline cariss

  • Newbie
  • *
  • Posts: 4
0 - Using $this when not in object context
« on: 26.02.2019 17:56:08 »
Hi there,

I'm suddenly getting an error on my site using latest joomla 3.9.3 and latest jdownloads 3.2.63.

Jdownloads seems to be working fine, I've created a test menu item that links to list all downloads and it shows all the files fine; https://www.ekla.org.uk/test3

However, I've got a menu item with menu type "jDownloads » List my Downloads » List my Downloads" and I get the error "0 - Using $this when not in object context" on clicking on that link; https://www.ekla.org.uk/resources

I've tried setting the site template to protostar and get the same error when using that as the default template. I also tried deleting the latest file that was added when the error was noticed thinking maybe there was an issue with the file but removing it hasn't made any difference either.

Does anyone have any ideas for what else I can try?
thanks

Offline ColinM

  • Moderator
  • *
  • Posts: 3.977
Re: 0 - Using $this when not in object context
« Reply #1 on: 27.02.2019 12:25:55 »
Hi
Not sure I understand!
You created a j Downloads menu link of Menu Item Type "List All Downloads" and I assume you gave it a title of "test3".
This creates a menu item with a link like <a href="/test3">list all downloads[/url]  where test3 is the alias not the title.  If I then make this into the full reference  https://www.mysite.com/test3 then it works OK.
The key is that it must be the alias.  Maybe the alias for 'resources' is not resources or that resources is a sub category of say a top level category called Kent Info.  In which case the link would be something like https://www.mysite.com/kent-info/resources
Colin

Offline cariss

  • Newbie
  • *
  • Posts: 4
Re: 0 - Using $this when not in object context
« Reply #2 on: 27.02.2019 17:02:46 »
Hi, thanks for replying.

Apologies for the confusion.

The resources page (https://www.ekla.org.uk/resources) has always worked fine in the past, we have just suddenly noticed that it is now not working and showing the error; 0 - Using $this when not in object context

The resources page is a "List my Downloads" type of page, so when the user is logged in it only shows the files assigned to them.

I created the test3 page just to check that jdownloads on the whole still works, which it appears to.

Offline ColinM

  • Moderator
  • *
  • Posts: 3.977
Re: 0 - Using $this when not in object context
« Reply #3 on: 28.02.2019 10:49:26 »
Hi
Then this looks like a possible Permissions or view Access problem that has arrisen in latest Joomla!Normally a menu link to a 'registered' only area would be set as a 'registered' view access.In trying to simulate the situation Joomla! 3.9.3 correctly directed me to the login page but It was not a list my downloads type page.Will try later.
Colin

Offline cariss

  • Newbie
  • *
  • Posts: 4
Re: 0 - Using $this when not in object context
« Reply #4 on: 28.02.2019 14:51:24 »
How I've got it setup is the menu link and access to it is public, and then the type is just a jdownloads my downloads type;



Then I've got a few different user accounts setup that are just in the registered user group, and then I add files to jdownloads and to assign them to the different users I change the "created by" field to one of those users, that way when they click on the resources link they just see the files that are theirs.
« Last Edit: 28.02.2019 14:53:34 by cariss »

Offline ColinM

  • Moderator
  • *
  • Posts: 3.977
Re: 0 - Using $this when not in object context
« Reply #5 on: 28.02.2019 23:27:04 »
Hi
 I have created a menu item type List My Downloads with a Title Resources and alias resources.  Also of course I set up a registered user and set that user as the creator of a couple of Downloads that were Registered Access.This has a link like https://www.mysite.com/resourcesThen I logged on - the menu item and the separate direct link on its own page  -  both worked.Next I logged the user out and cleared all the browser cache.  The result was an error message, see pic attached.  As you will see it has the error message "0 - Using $this when not in object context"  but also has the problem identified as possibly being "you have no access to this page"
So the user needs to be logged in before accessing that resource! To double check I set the permissions to Download as allowed and view access to Public. And it still failed.
Then of course I realised that Joomla!/jD  had no user so it could not find and gave an error message. Sometimes a user may log out but the cache is still intact and maybe previously Joomla! 'remembered' the previous logged in front end user.
Colin
« Last Edit: 01.03.2019 12:00:44 by ColinM »

Offline Arno

  • Administrator
  • ***
  • Posts: 12.357
    • jDownloads.com
Re: 0 - Using $this when not in object context
« Reply #6 on: 01.03.2019 10:42:18 »
Quote
Normally a menu link to a 'registered' only area would be set as a 'registered' view access
Exactly! Every other use is senseless.
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!

Offline cariss

  • Newbie
  • *
  • Posts: 4
Re: 0 - Using $this when not in object context
« Reply #7 on: 07.03.2019 15:51:58 »
Many thanks for checking it out. Can confirm I replaced the resources link with just a link to a login page, and then setup a redirect on login to go to the users "my downloads".

It just worked before that when people ended up on the my downloads page and weren't already logged in it prompted them to login, guess something changed at joomla and now they have to be logged in first.