The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Wishlist Member Add/Remove Member from Levels Using Gravity Forms (2 posts)

  1. bkegs98
    Posted 2 years ago #

    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);

    Any ideas on what I'm doing wrong?

  2. ruess
    Posted 1 year ago #

    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:

Topic Closed

This topic has been closed to new replies.

About this Topic