douliao8402 2014-12-11 14:29
浏览 17

S2会员专业版

I'm using a Pro API For Remote Operations php form which works well with a custom payment gateway, however, i'm stumbling at this final hurdle.

I simply want to check a user's 'wp_s2member_auto_eot_time' meta value then add a year to it.

I'm trying to use the below to achieve this but its throing up some errors.

 $startDate = get_user_meta ( $wp_s2member_auto_eot_time );
 $expire_on = date("Y", strtotime("+ 1 year, $startDate"));

This on its own works great:

 $expire_on = date("Y", strtotime("+ 1 year, $startDate"));

However, it doesnt update the existing date, it uses todays date and adds a year to it. I want it to add a year to the date that already shows in this meta value 'wp_s2member_auto_eot_time'.

Any help is hugely appreciated,

Thank you

After 'Diggy's' comment - i now have:

 $startDate = get_user_meta( $user_id, 'wp_s2member_auto_eot_time', true );
 $expire_on = date("Y", strtotime("+ 1 year, $startDate"));

This is still doing nothing though. Any help on what i have so far?

Thanks Diggy - It feels like i'm heading in the right direction.

  • 写回答

1条回答 默认 最新

  • duanchi8836 2014-12-11 14:35
    关注

    You'll have to pass a user ID, a string for the meta key, and true as a third param to return the value of the meta field:

    get_user_meta( $user_id, 'wp_s2member_auto_eot_time', true );
    
    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?