• Hi there,

    I’m trying to create a function within functions.php that hooks into a Gravity Form submit action and then adds and removes membership levels for that user through Wishlist Member. So far I have not been able to get this to work, but here is my code so far:

    add_action(“gform_after_submission_1”, “change_member_level”, 10, 2);

    function change_member_level {
    $user = wp_get_current_user();
    $user_ID = array($user->ID);
    $args = array(
    ‘Users’ => array($user_ID)
    );
    $level_ID = 1340726008;
    $members = wlmapi_add_member_to_level($level_ID, $args);
    print_r($members);
    }

    Any ideas on what I’m doing wrong?

Viewing 1 replies (of 1 total)
  • ruess

    (@ruess)

    For one thing, your function is missing parentheses:
    function change_member_level () {

    Second, looks like you need to rewrite your $user_id variable definition. Try changing your $user_ID line to:
    $user_ID = $user->ID;

    Third, make sure your form id is actually 1:
    add_action("gform_after_submission_1" . . .

    Finally, if you have debug on, you may get a warning but it should still work.

    As an aside, we just released a full featured plugin that fully integrates Gravity Forms to Wishlist Member with support for choosing multiple WLM levels with a dropdown for both new and existing users:
    https://goo.gl/CNbnBm

Viewing 1 replies (of 1 total)
  • The topic ‘Wishlist Member Add/Remove Member from Levels Using Gravity Forms’ is closed to new replies.