• Resolved nAtic86

    (@natic86)


    I have a page with hundreds of movies. Each is it’s own post.
    I sell them pay per view via selling a S2Member Level 1 + CCAP.
    The CCAP is beeing created with my own aod_ccap() function.

    Now I do not want the customers to see the damn S2Member return page.
    I want them to be redirected directly to the post, where they pressed the paypal button. But they get redirected to my paypal-return.php every freakin time.
    I am trying to set the success attribute to:
    success=”‘.get_permalink().’?transaction=success”.

    I simply do not understand in which case S2Member uses the success attribute, and in which not.

    The return template of S2Member would be of use, if it wouldn’t redirect the user to the freakin Homepage -.-

    Any suggestions on what I am doing wrong?

    function aod_paypal_button($value_eur, $license) {
        return do_shortcode('[s2Member-PayPal-Button level="1" ccaps="' . aod_ccap() . '_' . $license . '" desc="' . ucwords(str_replace('_', ' ', aod_ccap())) . '" ps="AOD" lc="" cc="EUR" dg="0" ns="1" custom="192.168.1.69" ta="0" tp="0" tt="D" ra="' . str_replace(',', '.', $value_eur) . '" rp="2" rt="D" rr="BN" rrt="" rra="1" image="default" output="url" success="' . get_permalink() . '?transaction=success" /]');
    }

    https://ww.wp.xz.cn/plugins/s2member/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter nAtic86

    (@natic86)

    solved it.

    the problem was not the success attribute, because it is useless.
    you can only use it for customers, who somehow sign up and buy a product with one press of a button.

    i do not know if this is the most appealing or even the easiest way, but it works like a charm:

    i created a must use plugin with a hook which overrides the default return page of s2member:

    adding to (or creating) the /wp-content/mu-plugins/s2-hacks.php

    add_filter('ws_plugin__s2member_redirection_url_after_modification', 'my_modification_redirection_url');
    
    function my_modification_redirection_url() {
        $aod_permalink = aod_get_return_url();
        return $aod_permalink.'?transaction=success';
    }

    now i built 2 functions, which save the last visited post into user meta. this function needs to be called inside the loop in the single.php template:

    function aod_set_return_url() {
    //    add_user_meta($user_id, $meta_key, $meta_value, $unique);
    //    get_user_meta($user_id, $key, $single);
    //    update_user_meta( $user_id, $meta_key, $meta_value, $prev_value );
        global $current_user;
        $user_id = $current_user->ID;
        $aod_permalink = get_permalink();
        if (get_user_meta($user_id, '_return_permalink', true)) {
            update_user_meta($user_id, '_return_permalink', $aod_permalink);
        } else {
        add_user_meta($user_id, '_return_permalink', $aod_permalink);
        }
    }

    also you need the function to return the new user-meta:

    function aod_get_return_url() {
        global $current_user;
        $user_id = $current_user->ID;
        return get_user_meta($user_id, '_return_permalink', true);
    }

    i guess the last one could have gone into the s2-hacks.php. but I am a newbie (=

    so what all of this does is creating additional data for every user and saving the permalink of the last visited post to this user.
    this data is later used as the return url after paypal payment.

    the downside is that now i do not have the ridiculous return page for s2member…

    Thread Starter nAtic86

    (@natic86)

    well, this method still does not work for mobile devices.

    i have no idea what happens, but the return template of s2member is still in use, when using the chrome or safari browser on my iphone 4.

    also i always get the error on mobile:
    Page Expired: Duplicate Return-Data.
    Please contact Support if you need any assistance.

    remains a mystery.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘success attribute never works’ is closed to new replies.