• Resolved ITGeist

    (@itgeist)


    Hello everybody,

    I currently have PayPal as option to purchase Level 1 membership at my wordpress page, but I also want them to be able to send a Steam Account two keys and get 1 month Membership then.
    The Bot already up and able to send webrequests (I can get the WP user_id from the SteamID the Bots gives me), but I do not know how to give User X (with user_id X in database) one month of Level 1 as the PayPal payment does.

    Can anyone help me? I just need something like set_membership(level, user_id).

    Greetz,
    ITGeist.

    https://www.ads-software.com/plugins/s2member/

Viewing 1 replies (of 1 total)
  • Thread Starter ITGeist

    (@itgeist)

    SOLVED

    I used this code:

    $wpuser = new WP_User($usrid);
    $current_role = c_ws_plugin__s2member_user_access::user_access_role ($wpuser);
    if ($current_role !== “s2member_level1”)
    $user->set_role(“s2member_level1”);

    Updating time:

    $iCurrentTime = time();
    $sqlQuery3 = “UPDATE wp_usermeta SET meta_value = $iCurrentTime WHERE meta_key = ‘wp_s2member_last_payment_time’ AND user_id = ‘” .$usrid. “‘”;

    $iEndTime = strtotime(“+1 month”, $iCurrentTime);
    $sqlQuery4 = “UPDATE wp_usermeta SET meta_value = $iEndTime WHERE meta_key = ‘wp_s2member_auto_eot_time’ AND user_id = ‘” .$usrid. “‘”;

    Taken from: s2member\includes\classes\paypal-notify-in-subscr-modify-w-level.inc.php

Viewing 1 replies (of 1 total)
  • The topic ‘Adding Level 1 Membership via external PHP Script’ is closed to new replies.