function widget($args, $instance)
 {
     get_currentuserinfo();
     global $current_user;
     extract($args);
     echo ym_register_flow($instance['flow_id'], $instance['pack_id'], TRUE);
 }
Example #2
0
function ym_replace_tag($function, $matches, $argument = false)
{
    get_currentuserinfo();
    global $current_user, $user_data, $ym_user;
    $return = '';
    switch ($function) {
        case 'ym_register':
            $flow = isset($argument['flow']) ? $argument['flow'] : FALSE;
            $id = isset($argument['id']) ? $argument['id'] : FALSE;
            if ($id == 'get') {
                $id = ym_request('id');
            }
            if (function_exists('ym_register_flow') && $flow) {
                $return = ym_register_flow($flow, $id);
                break;
            }
            $hcf = isset($argument['hide_custom_fields']) ? $argument['hide_custom_fields'] : FALSE;
            $hfp = isset($argument['hide_further_pages']) ? $argument['hide_further_pages'] : FALSE;
            $al = isset($argument['autologin']) ? $argument['autologin'] : FALSE;
            $return = ym_register_sidebar_widget(false, $id, $hcf, $hfp, $al);
            break;
        case 'ym_login':
            $register_text = isset($argument['register_text']) ? $argument['register_text'] : '';
            $lostpassword_text = isset($argument['lostpassword_text']) ? $argument['lostpassword_text'] : '';
            $redirect = isset($argument['redirect']) ? $argument['redirect'] : '';
            $return = ym_login_form($register_text, $lostpassword_text, $redirect);
            break;
        case 'private':
            $override_message = isset($argument['override_message']) ? $argument['override_message'] : '';
            $return = ym_post_replace($matches, $override_message);
            break;
            //Private Tag with Or statement	Account Type
        //Private Tag with Or statement	Account Type
        case 'private_or':
            if (ym_user_has_access() || strtolower($argument) == strtolower($ym_user->account_type)) {
                $return = $matches;
            }
            break;
            //Private Tag with AND statement Account Type
        //Private Tag with AND statement Account Type
        case 'private_and':
            if (ym_user_has_access() && strtolower($argument) == strtolower($ym_user->account_type)) {
                $return = $matches;
            }
            break;
            //Checks User has access to referenced post usage: [user_has_access#123] where post_id = 123 [user_has_access post_id123]
        //Checks User has access to referenced post usage: [user_has_access#123] where post_id = 123 [user_has_access post_id123]
        case 'user_has_access':
            // as long as arg zero is a post id....
            //			$post_id = is_array($argument) ? (isset($argument['post_id']) ? $argument['post_id'] : $argument['post_id']) : $argument;
            if (ym_user_has_access($argument)) {
                $return = $matches;
            }
            break;
            // user name check [private_username_is#username]
        // user name check [private_username_is#username]
        case 'private_username_is':
            get_currentuserinfo();
            global $current_user;
            $username = $current_user->user_login;
            if (strtolower($username) == strtolower($argument)) {
                $return = $matches;
            }
            break;
            //Checks if user has no access to current post usage [no_access]
        //Checks if user has no access to current post usage [no_access]
        case 'no_access':
            // as long as arg zero is a post id....
            //			$post_id = is_array($argument) ? (isset($argument['post_id']) ? $argument['post_id'] : $argument['post_id']) : $argument;
            if (!ym_user_has_access($argument)) {
                $return = $matches;
            }
            break;
    }
    return do_shortcode(stripslashes($return));
}