add another constant in Membership Pings Editor

I’m setting up the remote ping with Mailchimp API for a website using Membership plugin and almost have it working.

I want to use merge_vars[FNAME]=

and link it to the actual users “Name” that is entered, not the %username%

spoke to @alexander Rohmann and he suggested maybe:

“The developer included a hook to easily allow for adding custom fields, so if you open a forum thread, I can see if he can get in touch with you there about it”

Thanks for your help

  • Alexander
    • DEV MAN’s Mascot

    Hey there,

    Nice chatting with you earlier. So, to recap from before. I’ve seen this before, but couldn’t get it working myself in the past. Membership has a filter hook in the pings class that looks like:

    membership_pingfield_{custom_key}

    But I wasn’t successful in my attempts to use it. I’ll get in touch with the developer to see if he has any suggestions here.

    Best regards

  • Alexander
    • DEV MAN’s Mascot

    @davidh5,

    I’m sorry we didn’t get back to you sooner on this. The reason we couldn’t get this worked out before is that the hook actually wasn’t full implemented. This will be included in a future release, but for now you’re welcome to update the code manually.

    Just open up membershipincludes/classes/class.ping.php and head to line 262

    You’ll see this line:

    $pingdata = $this->pingconstants;

    Just replace that, with this code:

    $pingdata = apply_filters('membership_ping_constants_list', $this->pingconstants);

    Then in a plugin you should be able to do something like this:

    add_filter('membership_ping_constants_list','membership_add_ping_constant');
    function membership_add_ping_constant($constants){
    $constants['custom_key']='';
    return $constants;
    }
    add_filter('membership_pingfield_custom_key','membership_ping_custom_key_callback');
    function membership_ping_custom_key_callback($params){
    return "Data to be included in ping...";
    }

    Thanks for being a WPMU DEV member. Let us know if we can be of any further assistance.

    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.