latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Show Length of Membership

Home Forums Community Forum Show Length of Membership

This topic contains 3 replies, has 2 voices. Last updated by  Cristián Lávaque 4 years, 10 months ago.

Topic Author Topic
Posted: Friday Mar 2nd, 2012 at 3:56 pm #7095

Would it be possible to output the length a user’s membership using:

[s2Get constant="S2MEMBER_CURRENT_USER_REGISTRATION_DAYS" /]

I’d like for the user to see “You’ve been a member for X years, Y months, Z days!”

Or even better, “You’ve been a member since DATE!”

I was trying to use

[s2Get constant="S2MEMBER_CURRENT_USER_REGISTRATION_DAYS/365" /]years, [s2Get constant="S2MEMBER_CURRENT_USER_REGISTRATION_DAYS/30" /] months, [s2Get constant="S2MEMBER_CURRENT_USER_REGISTRATION_DAYS" /] days.

But it outputs “You’ve been a member for years, months, Z days.”

List Of Topic Replies

Viewing 3 replies - 1 through 3 (of 3 total)
Author Replies
Author Replies
Posted: Friday Mar 2nd, 2012 at 8:44 pm #7131

Hi Vashte.

You can use the constants S2MEMBER_CURRENT_USER_REGISTRATION_TIME or S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME.
[hilite path]Dashboard -› s2Member® -› API / Scripting -› PHP/API Constants[/hilite]
http://mx.php.net/manual/en/function.date.php

Something like:
[hilite pre_code]

[/hilite]

I hope that helps. :)

Posted: Friday Mar 2nd, 2012 at 9:40 pm #7136

Ah, cool. Made that a shortcode. Works!

Posted: Friday Mar 2nd, 2012 at 10:37 pm #7138

Great. :)

Viewing 3 replies - 1 through 3 (of 3 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.