hakana VIP
Total posts: 425
05 Sep 2014 11:37

Is it possible to have a placeholder like [REMAININGDAYS] so we can use it between the [PAID] tags. Thanks.

Last Modified: 15 Feb 2016


Sergey
Total posts: 13,748
12 Sep 2014 09:57

But it say already when it will be available? And when you show content that allowed already there are not days remained.


hakana VIP
Total posts: 425
13 Sep 2014 07:58

Hi Sergey,

I like the way you question my ideas :-)

This [REMAININGDAYS] tag is not for a single article, but to show the last day of the whole subscription. Sometimes, I would like to mention:
You have 5 days left to renew your subscription. You have 5 days left to read all the articles.

If I have such a placeholder, I can use it in the text or in my welcome page that is displayed after the subscription is bought.

Maybe we can change the name of the placeholder so that it will not be confused with the delay parameter of the PAID placeholder.

You can see a similar placeholder here:
https://www.akeebabackup.com/documentation/akeeba-subscriptions/plugin-astimedcontent.html

{asdaysremaining LEVEL1}


Sergey
Total posts: 13,748
14 Sep 2014 02:07

This is not simple. What is in PAID 5 plans indicated? What if user have 2 of those? What if plans limited by usage count not by time?


hakana VIP
Total posts: 425
15 Sep 2014 06:17

In the invoice you show how many days the current subscription has. So it can be like:
[REMAININGDAYS=12] (Remaining days for plan number 12)

What if the user rebuys the plan to extend the subscription period? I think this is the only problem that needs to be solved here.

If there is a count limit of the plan, then the admin will not use this placeholder. :-)


Sergey
Total posts: 13,748
16 Sep 2014 00:52

Not only this problem to be solved. What is user have plan 23 and do not have plan 12 but also allowed to see PAID content? Message will not correspond. So we will need syntax like this

[IF USER HAS PLAN=12]
The remind days [REMAININGDAYS=12]
[endif]

[IF USER HAS PLAN=23]
The remind days [REMAININGDAYS=23]
[endif]

And that is going to be only more and more complicated.


hakana VIP
Total posts: 425
16 Sep 2014 18:41

Don't put the if then. Just query [REMAININGDAYS=12] between any PAID tags. If the user is the subscriber of the indicated plan (12 here) you simply show the remaining days.

So, the remaining days placeholder will work even in this case but return null or zero.

[PAID TAG=31,32]  
[REMAININGDAYS=12]  
Blah blah...  
[/PAID TAG]

Sergey
Total posts: 13,748
17 Sep 2014 00:37

This is the point. What if it is NULL.


You have [REMAININGDAYS=12] days remaining


hakana VIP
Total posts: 425
17 Sep 2014 06:49

Then, we can use a language string.

[PAID TAG=31,32,33]  
[REMAININGDAYS=31,32,33]  
Blah blah...  
[/PAID TAG]

When the content plugin sees [REMAININGDAYS=31,32,33] the whole sentence will be displayed as a whole or as none. So if the user has 2 or more active subscriptions:

You have %s days left for your %s subscription.<br /> (It will be like a loop and show one or two sentences.)

Well, if I know Sergey, he might not like this solution but it will work in this case :-)


hakana VIP
Total posts: 425
18 Sep 2014 10:29

Thank you very much for the addition of this feature Sergey. You have come up with a wonderful solution at the end :-) Bravo.


hakana VIP
Total posts: 425
21 Oct 2014 16:26

REMAININGDAYS placeholder deserves an honourable place in the documentation area. These placesholders are the polishes of Emerald, not no be ignored ;-)


Sergey
Total posts: 13,748
23 Oct 2014 04:09

Ok. Added.


hakana VIP
Total posts: 425
27 Nov 2014 10:47

Hi Sergey,

I have added one more month to an expired subscription and the remaining days placeholder is now showing the remaining days as "-16402 days remaining". But on the invoice area, the remaining days is shown right as 17 days left.


Sergey
Total posts: 13,748
28 Nov 2014 08:49

MOst probably because you extended it after it have been expired. Deactivation track was applied.

I would suggect to extend only yet active subcriptions or create new one.


hakana VIP
Total posts: 425
29 Nov 2014 19:19

You are right. But in the memberships section where I see all the active and expired memberships, I see the remaining days right. Do you think calculating the remaining days with that method is not good?


Sergey
Total posts: 13,748
01 Dec 2014 10:32

Remaining days are right, but there is another flag attached to subscription after it is tracjed as deactive.


hakana VIP
Total posts: 425
04 Dec 2014 09:39

I don't see negative remaining days any more but the days still do not match if I extending the membership after expiry. remaining


Jeff VIP
Total posts: 745
04 Feb 2016 05:49

For those who want to implement REMAININGDAYS successfully:

[PLAN=1]
[REMAININGDAYS]
[/PLAN]

Replace "1" with your plan id.

However, the following warning is displayed in Developer Mode:

Strict Standards: Non-static method EmeraldApi::getDaysRemain() should not be called statically, assuming $this from incompatible context in /home/mysite/public_html/plugins/system/emerald/emerald.php on line 326

Sergey
Total posts: 13,748
08 Feb 2016 02:23

Error fixed. But did you mean?

[ PAID=1]
[REMAININGDAYS]
[/ PAID]

Jeff VIP
Total posts: 745
11 Feb 2016 01:48

Sergey Error fixed. But did you mean?

Huh? Your code field is empty.


Sergey
Total posts: 13,748
15 Feb 2016 15:49

I edited. It was replaced by Emerald. I added spaces.

Powered by Cobalt