Scheduled content - custom HTML message - instead of 403 error

  • Marck Goran Lorencin
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
2 years 6 months ago #147033 by Marck Goran Lorencin
Hello,

I started implementing the excelent feature of scheduled content but stubled on a problem, which I assume has a "simple" fix. I have multiple categories where I plan to implement scheduled content, for example, workout plans. Say a workout plan has 30 sessions. How I have my website setup, with custom layouts, I can show a category with those 30 sessions (articles), all are and should be clickable, obviously only those articles for which scheduled content allows acces shoud show the content, while if you click on an article, which isn't yet ready to show content it would be nice to say, for example, "This content will be available for you on DATE : TIME". What happens now in
/plugins/system/schedulecontent/schedulecontent.php
Code:
line 289          if (!$this->canAccess($articleId))         {             if (!$user->id)             {                 // Redirect user to login page                 $this->app->redirect(Route::_('index.php?option=com_users&view=login&return=' . base64_encode(Uri::getInstance()->toString())));             }             else             {                 OSMembershipHelper::loadLanguage();                 throw new Exception(Text::_('OSM_SCHEDULE_CONTENT_LOCKED'), 403);             }         }

I have modified this throw new Exception line to redirect to some custom article, with url /scheduled-content, which basically says, this content is scheduled for publishing, and added a java script back button, to return back to the category, where you have a list of your scheduled articles. I can do some modifying the code and such, so if you give me some code snippet, I will be happy to try it out and test it.

With kind regards,
Marck

Please Log in or Create an account to join the conversation.

More
2 years 6 months ago #147049 by Tuan Pham Ngoc
We throw 403 error here because we want to prevent direct access to the item (by access directly to the link)

Normally, you should create a menu item to link to User's Schedule Content menu item type to allow subscribers to access to the schedule content instead

You said you did the modification, so exactly what you want here?

Regards,

Tuan

Please Log in or Create an account to join the conversation.

  • Marck Goran Lorencin
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
2 years 5 months ago #147381 by Marck Goran Lorencin
Replied by Marck Goran Lorencin on topic Scheduled content - custom HTML message - instead of 403 error
The original idea how you would want to prevent a NON - access to a not yet scheduled content does work. The thing is, going through a menu item link which is specific for a scheduled content doesn't seem to be the best way for how we usually use websites.

My proposal is to allow for a scheduled content item to be seen in a blog or category view, you can see the title and all, just like for a normal article item BUT then when you click on it you get a normal HTML message within the article, for example,

"There are 3 days and 14 h left until you will be able to see this content"

or

"You are trying to access content scheduled to be online in 3 days and 14 h".

****

In short, using 403 error is appropriate if you want to hide the url, I think this is not necessary at all. You could allow for all those links and url to be shown but when clicked, you get a message why this content is not available for the user yet.

****

My workaround has been to modify your file and insert a custom redirect link, to an article, where I can show a custom message. It is a "dirty" workaround for the time being.

I hope you like my proposal how to approach scheduled content, you could eventually offer a possibility, to choose between a 403 or not hide the url and allow for a custom message approach.

Kind regards,
Marck

Please Log in or Create an account to join the conversation.

More
2 years 5 months ago #147383 by Tuan Pham Ngoc
Hello Marck

We can introduce a parameter to the plugin to allow select a menu item which users will be redirected to when they are trying to access to a not allowed article

Please submit a support ticket. I will send you the updated package of the extension which support that parameter. You can help testing it and update me with the result. If it works good, we will include it in next release

Regards,

Tuan

Please Log in or Create an account to join the conversation.