当前位置: 首页>>代码示例>>PHP>>正文


PHP userpro_is_logged_in函数代码示例

本文整理汇总了PHP中userpro_is_logged_in函数的典型用法代码示例。如果您正苦于以下问题:PHP userpro_is_logged_in函数的具体用法?PHP userpro_is_logged_in怎么用?PHP userpro_is_logged_in使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了userpro_is_logged_in函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: userpro_logout_page

function userpro_logout_page()
{
    global $userpro;
    if (is_page() || is_single()) {
        global $post;
        $pages = get_option('userpro_pages');
        if ($post->ID == $pages['logout_page']) {
            if (userpro_is_logged_in()) {
                $logout = userpro_get_option('logout_uri');
                if ($logout == 1) {
                    $url = home_url();
                }
                if ($logout == 2) {
                    $url = $userpro->permalink(0, 'login');
                }
                if ($logout == 3) {
                    $url = userpro_get_option('logout_uri_custom');
                }
                if (isset($_REQUEST['redirect_to'])) {
                    $url = $_REQUEST['redirect_to'];
                }
                wp_logout();
                wp_redirect($url);
                exit;
            } else {
                wp_redirect($userpro->permalink(0, 'login'));
                exit;
            }
        }
    }
}
开发者ID:ingridlima,项目名称:userpro-custom,代码行数:31,代码来源:template_redirects.php

示例2: userpro_sc_show_follow

function userpro_sc_show_follow($user_id)
{
    global $userpro, $userpro_social;
    if (!userpro_get_option('modstate_social')) {
        return false;
    }
    if (userpro_is_logged_in() && !$userpro->is_user_logged_user($user_id)) {
        echo '<div class="userpro-sc-flw">' . $userpro_social->follow_text($user_id, get_current_user_id()) . '</div>';
    }
}
开发者ID:fritzdenim,项目名称:pangMoves,代码行数:10,代码来源:hooks-actions.php

示例3: userpro_loggedout

function userpro_loggedout($args = array(), $content = null)
{
    global $wp, $userpro_admin, $userpro;
    ob_start();
    if (!userpro_is_logged_in()) {
        echo do_shortcode($content);
    }
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
开发者ID:httvncoder,项目名称:151722441,代码行数:11,代码来源:shortcode-extras.php

示例4: userpro_allow_profile_redirect

function userpro_allow_profile_redirect()
{
    global $userpro;
    if (userpro_get_option('allow_dashboard_for_these_roles') && userpro_is_logged_in() && $userpro->user_role_in_array(get_current_user_id(), explode(',', userpro_get_option('allow_dashboard_for_these_roles')))) {
        return false;
    }
    if (!current_user_can('manage_options') && userpro_get_option('profile_redirect_users')) {
        return true;
    }
    return false;
}
开发者ID:fritzdenim,项目名称:pangMoves,代码行数:11,代码来源:common-functions.php

示例5: userpro

function userpro($args = array())
{
    global $post, $wp, $userpro_admin, $userpro;
    if (is_home()) {
        $permalink = home_url();
    } else {
        if (isset($post->ID)) {
            $permalink = get_permalink($post->ID);
        } else {
            $permalink = '';
        }
    }
    /* arguments */
    $defaults = apply_filters('userpro_shortcode_args', array('template' => null, 'max_width' => userpro_get_option('width'), 'uploads_dir' => $userpro->get_uploads_url(), 'default_avatar_male' => userpro_url . 'img/default_avatar_male.jpg', 'default_avatar_female' => userpro_url . 'img/default_avatar_female.jpg', 'layout' => userpro_get_option('layout'), 'margin_top' => 0, 'margin_bottom' => '30px', 'align' => 'center', 'skin' => userpro_get_option('skin'), 'required_text' => __('This field is required', 'userpro'), 'password_too_short' => __('Your password is too short', 'userpro'), 'passwords_do_not_match' => __('Passwords do not match', 'userpro'), 'password_not_strong' => __('Password is not strong enough', 'userpro'), 'keep_one_section_open' => 1, 'allow_sections' => 1, 'permalink' => $permalink, 'field_icons' => userpro_get_option('field_icons'), 'profile_thumb_size' => 80, 'register_heading' => __('Register an Account', 'userpro'), 'register_side' => __('Already a member?', 'userpro'), 'register_side_action' => 'login', 'register_button_action' => 'login', 'register_button_primary' => __('Register', 'userpro'), 'register_button_secondary' => __('Login', 'userpro'), 'register_group' => 'default', 'register_redirect' => '', 'type' => userpro_mu_get_option('multi_forms_default'), 'login_heading' => __('Login', 'userpro'), 'login_side' => __('Forgot your password?', 'userpro'), 'login_side_action' => 'reset', 'login_button_action' => 'register', 'login_button_primary' => __('Login', 'userpro'), 'login_button_secondary' => __('Create an Account', 'userpro'), 'login_group' => 'default', 'login_redirect' => '', 'delete_heading' => __('Delete Profile', 'userpro'), 'delete_side' => __('Undo, back to profile', 'userpro'), 'delete_side_action' => 'view', 'delete_button_action' => 'view', 'delete_button_primary' => __('Confirm Deletion', 'userpro'), 'delete_button_secondary' => __('Back to Profile', 'userpro'), 'delete_group' => 'default', 'reset_heading' => __('Reset Password', 'userpro'), 'reset_side' => __('Back to Login', 'userpro'), 'reset_side_action' => 'login', 'reset_button_action' => 'change', 'reset_button_primary' => __('Request Secret Key', 'userpro'), 'reset_button_secondary' => __('Change your Password', 'userpro'), 'reset_group' => 'default', 'change_heading' => __('Change your Password', 'userpro'), 'change_side' => __('Request New Key', 'userpro'), 'change_side_action' => 'reset', 'change_button_action' => 'reset', 'change_button_primary' => __('Change my Password', 'userpro'), 'change_button_secondary' => __('Do not have a secret key?', 'userpro'), 'change_group' => 'default', 'list_heading' => __('Latest Members', 'userpro'), 'list_per_page' => 5, 'list_sortby' => 'registered', 'list_order' => 'desc', 'list_users' => '', 'list_group' => 'default', 'list_thumb' => 50, 'list_showthumb' => 1, 'list_showsocial' => 1, 'list_showbio' => 0, 'list_verified' => 0, 'list_relation' => 'or', 'online_heading' => __('Who is online now', 'userpro'), 'online_thumb' => 30, 'online_showthumb' => 1, 'online_showsocial' => 0, 'online_showbio' => 0, 'online_mini' => 1, 'online_mode' => 'vertical', 'edit_button_primary' => __('Save Changes', 'userpro'), 'edit_group' => 'default', 'view_group' => 'default', 'social_target' => '_blank', 'social_group' => 'default', 'card_width' => '250px', 'card_img_width' => '250', 'card_showbio' => 1, 'card_showsocial' => 1, 'link_target' => '_blank', 'error_heading' => __('An error has occured', 'userpro'), 'memberlist_v2' => 1, 'memberlist_v2_pic_size' => '86', 'memberlist_v2_fields' => 'age,gender,country', 'memberlist_v2_bio' => 1, 'memberlist_v2_showbadges' => 1, 'memberlist_v2_showname' => 1, 'memberlist_v2_showsocial' => 1, 'memberlist_pic_size' => '120', 'memberlist_pic_topspace' => '15', 'memberlist_pic_sidespace' => '30', 'memberlist_pic_rounded' => 1, 'memberlist_width' => '100%', 'memberlist_paginate' => 1, 'memberlist_paginate_top' => 1, 'memberlist_paginate_bottom' => 1, 'memberlist_show_name' => 1, 'memberlist_popup_view' => 0, 'memberlist_withavatar' => 0, 'memberlist_verified' => 0, 'memberlist_filters' => '', 'memberlist_default_search' => 1, 'per_page' => 12, 'sortby' => 'registered', 'order' => 'desc', 'relation' => 'and', 'search' => 1, 'show_social' => 1, 'registration_closed_side' => __('Existing member? login', 'userpro'), 'registration_closed_side_action' => 'login', 'facebook_redirect' => 'profile', 'logout_redirect' => '', 'postsbyuser_num' => '12', 'postsbyuser_types' => 'post', 'postsbyuser_mode' => 'grid', 'postsbyuser_thumb' => 50, 'postsbyuser_showthumb' => 1, 'publish_heading' => __('Add a New Post', 'userpro'), 'publish_button_primary' => __('Publish', 'userpro')));
    $args = wp_parse_args($args, $defaults);
    extract($args, EXTR_SKIP);
    if ($template) {
        static $i = 0;
        ob_start();
        /* increment wall */
        $i = rand(1, 1000);
        /* user template */
        do_action('userpro_custom_template_hook', array_merge($args, array('i' => $i)));
        switch ($template) {
            case 'publish':
                if (userpro_is_logged_in()) {
                    $user_id = get_current_user_id();
                    $layout = 'none';
                    $args['layout'] = 'none';
                    if (isset($args['deny_roles']) && !empty($args['deny_roles'])) {
                        $denied_roles = explode(',', $args['deny_roles']);
                        if ($userpro->user_role_in_array($user_id, $denied_roles)) {
                            if (locate_template('userpro/not_allowed.php') != '') {
                                include get_template_directory() . '/userpro/not_allowed.php';
                            } else {
                                include userpro_path . "templates/not_allowed.php";
                            }
                        } else {
                            if (locate_template('userpro/' . $template . '.php') != '') {
                                include get_template_directory() . '/userpro/' . $template . '.php';
                            } else {
                                include userpro_path . "templates/{$template}.php";
                            }
                        }
                    } else {
                        if (locate_template('userpro/' . $template . '.php') != '') {
                            include get_template_directory() . '/userpro/' . $template . '.php';
                        } else {
                            include userpro_path . "templates/{$template}.php";
                        }
                    }
                } else {
                    /* attempt to edit profile so force redirect to same page */
                    $args['force_redirect_uri'] = 1;
                    add_action('userpro_pre_form_message', 'userpro_msg_login_to_post');
                    $template = 'login';
                    $args['template'] = 'login';
                    if (locate_template('userpro/' . $template . '.php') != '') {
                        include get_template_directory() . '/userpro/' . $template . '.php';
                    } else {
                        include userpro_path . "templates/login.php";
                    }
                    remove_action('userpro_pre_form_message', 'userpro_msg_login_to_post');
                }
                break;
            case 'postsbyuser':
                if (isset($args['user'])) {
                    if ($args['user'] == 'author') {
                        $user_id = get_the_author_meta('ID');
                    } else {
                        $user_id = userpro_get_view_user($args['user'], 'shortcode_user');
                    }
                } else {
                    $user_id = userpro_get_view_user(get_query_var('up_username'));
                }
                $post_query = $userpro->posts_by_user($user_id, $args);
                if (locate_template('userpro/' . $template . '.php') != '') {
                    include get_template_directory() . '/userpro/' . $template . '.php';
                } else {
                    include userpro_path . "templates/{$template}.php";
                }
                wp_reset_query();
                break;
            case 'online':
                $users = $userpro->onlineusers();
                if (locate_template('userpro/' . $template . '.php') != '') {
                    include get_template_directory() . '/userpro/' . $template . '.php';
                } else {
                    include userpro_path . "templates/{$template}.php";
                }
                break;
            case 'request_verify':
                $userpro->new_verification_request($_POST['up_username']);
                if (locate_template('userpro/' . $template . '.php') != '') {
                    include get_template_directory() . '/userpro/' . $template . '.php';
                } else {
                    include userpro_path . "templates/{$template}.php";
                }
                break;
            case 'reset':
//.........这里部分代码省略.........
开发者ID:ingridlima,项目名称:userpro-custom,代码行数:101,代码来源:shortcode-main.php

示例6: can_view_private_content

 function can_view_private_content($restrict_to_verified = null, $restrict_to_roles = null)
 {
     if (!userpro_is_logged_in()) {
         return '-1';
     } else {
         if (userpro_get_option('restricted_page_verified') == "1" && $this->get_verified_status(get_current_user_id())) {
             $user = get_userdata(get_current_user_id());
             $user_role = array_shift($user->roles);
             if ($restrict_to_verified == 1 && $this->get_verified_status(get_current_user_id()) || $restrict_to_roles != '' && in_array($user_role, explode(',', $restrict_to_roles)) || !$restrict_to_verified && !$restrict_to_roles) {
                 return '1';
             } else {
                 return '-2';
             }
         } else {
             if (userpro_get_option('restricted_page_verified') == "0") {
                 $user = get_userdata(get_current_user_id());
                 $user_role = array_shift($user->roles);
                 if ($restrict_to_verified == 1 && $this->get_verified_status(get_current_user_id()) || $restrict_to_roles != '' && in_array($user_role, explode(',', $restrict_to_roles)) || !$restrict_to_verified && !$restrict_to_roles) {
                     return '1';
                 } else {
                     return '-2';
                 }
             }
         }
     }
 }
开发者ID:fritzdenim,项目名称:pangMoves,代码行数:26,代码来源:api.php

示例7: userpro_process_form

function userpro_process_form()
{
    global $userpro;
    if (!isset($_POST['_myuserpro_nonce']) || !wp_verify_nonce($_POST['_myuserpro_nonce'], '_myuserpro_nonce_' . $_POST['template'] . '_' . $_POST['unique_id'])) {
        die;
    }
    if (!isset($_POST) || $_POST['action'] != 'userpro_process_form') {
        die;
    }
    if (!userpro_is_logged_in() && $_POST['template'] == 'edit') {
        die;
    }
    extract($_POST);
    foreach ($_POST as $key => $val) {
        $key = explode('-', $key);
        $key = $key[0];
        $form[$key] = $val;
    }
    extract($form);
    /* form action */
    switch ($template) {
        /* publish */
        case 'publish':
            $output['error'] = '';
            if (!$post_title) {
                $output['error']['post_title'] = __('You must enter a post title.', 'userpro');
            }
            if (!$userpro_editor) {
                $output['error']['userpro_editor'] = __('You must enter some content.', 'userpro');
            }
            /*
            	publish post
            */
            if (empty($output['error'])) {
                $array = array('post_title' => $post_title, 'post_content' => @wp_kses($userpro_editor), 'post_author' => $user_id);
                if ($post_type) {
                    $array['post_type'] = $post_type;
                }
                if (userpro_is_admin($user_id)) {
                    $array['post_status'] = 'publish';
                    $post_id = wp_insert_post($array);
                    $output['custom_message'] = '<div class="userpro-message userpro-message-ajax"><p>' . sprintf(__('Your post has been published. You can view it %s.', 'userpro'), '<a href="' . get_permalink($post_id) . '">here</a>') . '</p></div>';
                } else {
                    // under review
                    $array['post_status'] = 'pending';
                    $post_id = wp_insert_post($array);
                    $output['custom_message'] = '<div class="userpro-message userpro-message-ajax"><p>' . __('Your post has been sent for review. It will be checked by our staff.', 'userpro') . '</p></div>';
                }
                /*
                	empty category first
                */
                wp_set_object_terms($post_id, NULL, 'category');
                /*
                	taxonomy
                	and category
                */
                if (isset($taxonomy) && isset($category)) {
                    $categories = explode(',', $category);
                    if (is_array($categories)) {
                        foreach ($categories as $cat) {
                            if (is_numeric($cat)) {
                                $cat = (int) $cat;
                            }
                            $cats[] = $cat;
                        }
                        wp_set_object_terms($post_id, $cats, $taxonomy);
                    } else {
                        if (is_numeric($categories)) {
                            $categories = (int) $categories;
                        }
                        wp_set_object_terms($post_id, $categories, $taxonomy);
                    }
                }
                /*
                	multiple taxonomy
                	category insertion
                */
                if (isset($post_categories)) {
                    $i = 0;
                    foreach ($post_categories as $cat) {
                        $i++;
                        $split = explode('#', $cat);
                        $tax = $split[1];
                        $id = $split[0];
                        $terms[$tax][] = $id;
                    }
                    if (is_array($terms)) {
                        foreach ($terms as $k => $arr) {
                            wp_set_object_terms($post_id, $terms[$k], $k, true);
                        }
                    }
                }
                /*
                	assign featured
                	image for post
                */
                if ($post_featured_image) {
                    $attach_id = $userpro->new_attachment($post_id, $post_featured_image);
                    $userpro->set_thumbnail($post_id, $attach_id);
                }
//.........这里部分代码省略.........
开发者ID:ingridlima,项目名称:userpro-custom,代码行数:101,代码来源:ajax.php

示例8: userpro_show_new_notification

function userpro_show_new_notification()
{
    global $userpro_msg;
    if (userpro_is_logged_in()) {
        $user_id = get_current_user_id();
        if ($userpro_msg->has_new_chats($user_id)) {
            require_once userpro_msg_path . 'templates/notification.php';
        }
    }
}
开发者ID:fritzdenim,项目名称:pangMoves,代码行数:10,代码来源:hooks-actions.php

示例9: userpro_redirects

function userpro_redirects()
{
    global $pagenow;
    // redirect dashboard
    if ('index.php' == $pagenow && is_admin()) {
        if (userpro_is_logged_in() && userpro_allow_dashboard_redirect()) {
            wp_redirect(userpro_dashboard_redirect_uri());
            exit;
        }
    }
    // redirect dashboard profile
    if ('profile.php' == $pagenow) {
        if (userpro_is_logged_in() && userpro_allow_profile_redirect()) {
            wp_redirect(userpro_profile_redirect_uri());
            exit;
        }
    }
    // redirect login
    if ('wp-login.php' == $pagenow && !isset($_REQUEST['action'])) {
        if (userpro_allow_login_redirect()) {
            if (isset($_GET['redirect_to'])) {
                $url = add_query_arg('redirect_to', $_GET['redirect_to'], userpro_login_redirect_uri());
            } else {
                $url = userpro_login_redirect_uri();
            }
            wp_redirect($url);
            exit;
        }
    }
    // redirect lostpassword
    if ('wp-login.php' == $pagenow && isset($_REQUEST['action']) && $_REQUEST['action'] == 'lostpassword') {
        if (userpro_allow_login_redirect()) {
            wp_redirect(userpro_login_redirect_uri());
            exit;
        }
    }
    // redirect register
    if ('wp-login.php' == $pagenow && isset($_REQUEST['action']) && $_REQUEST['action'] == 'register') {
        if (userpro_allow_register_redirect()) {
            wp_redirect(userpro_register_redirect_uri());
            exit;
        }
    }
}
开发者ID:ingridlima,项目名称:userpro-custom,代码行数:44,代码来源:hooks-actions.php

示例10: userpro_fbconnect

function userpro_fbconnect()
{
    global $userpro;
    $output = '';
    if (!isset($_POST)) {
        die;
    }
    if ($_POST['action'] != 'userpro_fbconnect') {
        die;
    }
    if (!isset($_POST['id'])) {
        die;
    }
    extract($_POST);
    if (!isset($username) || $username == '' || $username == 'undefined') {
        $username = $email;
    }
    /* Check if facebook uid exists */
    if (isset($id) && $id != '' && $id != 'undefined') {
        $users = get_users(array('meta_key' => 'userpro_facebook_id', 'meta_value' => $id, 'meta_compare' => '='));
        if (isset($users[0]->ID) && is_numeric($users[0]->ID)) {
            $returning = $users[0]->ID;
            $returning_user_login = $users[0]->user_login;
        } else {
            $returning = '';
        }
    } else {
        $returning = '';
    }
    $result = get_user_meta($returning, "userpayment");
    $paymentoption = get_option('userpro_payment');
    /* Check if user is logged in */
    if (userpro_is_logged_in()) {
        $userpro->update_fb_id(get_current_user_id(), $id);
        if ($redirect == '') {
            $output['redirect_uri'] = 'refresh';
        } elseif ($redirect != 'profile') {
            $output['redirect_uri'] = $redirect;
        } else {
            $output['redirect_uri'] = $userpro->permalink();
        }
        $output['redirect_uri'] = apply_filters('userpro_login_redirect', $output['redirect_uri']);
    } else {
        if ($returning != '') {
            if ($paymentoption['userpro_payment_option'] == 'y') {
                if ($result[0] == "recive" || $result[0] == "") {
                    userpro_auto_login($returning_user_login, true);
                    $userpro->update_fb_id($returning, $id);
                    if ($redirect == '') {
                        $output['redirect_uri'] = 'refresh';
                    } elseif ($redirect != 'profile') {
                        $output['redirect_uri'] = $redirect;
                    } else {
                        $output['redirect_uri'] = $userpro->permalink();
                    }
                    $output['redirect_uri'] = apply_filters('userpro_login_redirect', $output['redirect_uri']);
                } else {
                    !empty($output['paypal_form']) ? $out = $output['paypal_form'] : ($out = '');
                    $output['paypal_form'] = apply_filters('paymentredirect', $out, $returning);
                }
            } else {
                userpro_auto_login($returning_user_login, true);
                if ($redirect == '') {
                    $output['redirect_uri'] = 'refresh';
                } elseif ($redirect != 'profile') {
                    $output['redirect_uri'] = $redirect;
                } else {
                    $output['redirect_uri'] = $userpro->permalink();
                }
                $output['redirect_uri'] = apply_filters('userpro_login_redirect', $output['redirect_uri']);
            }
            /* Email is same, connect them together */
        } else {
            if ($email != '' && email_exists($email)) {
                $user_id = email_exists($email);
                $user = get_userdata($user_id);
                $result = get_user_meta($user_id, "userpayment");
                $paymentoption = get_option('userpro_payment');
                if ($paymentoption['userpro_payment_option'] == 'y') {
                    if (isset($result[0]) && $result[0] == "recive" || $result[0] == "") {
                        userpro_auto_login($user->user_login, true);
                        $userpro->update_fb_id($user_id, $id);
                        if ($redirect == '') {
                            $output['redirect_uri'] = 'refresh';
                        } elseif ($redirect != 'profile') {
                            $output['redirect_uri'] = $redirect;
                        } else {
                            $output['redirect_uri'] = $userpro->permalink();
                        }
                        $output['redirect_uri'] = apply_filters('userpro_login_redirect', $output['redirect_uri']);
                    } else {
                        !empty($output['paypal_form']) ? $out = $output['paypal_form'] : ($out = '');
                        $output['paypal_form'] = apply_filters('paymentredirect', $out, $user_id);
                    }
                } else {
                    userpro_auto_login($user->user_login, true);
                    $userpro->update_fb_id($user_id, $id);
                    if ($redirect == '') {
                        $output['redirect_uri'] = 'refresh';
                    } elseif ($redirect != 'profile') {
//.........这里部分代码省略.........
开发者ID:fritzdenim,项目名称:pangMoves,代码行数:101,代码来源:ajax.php

示例11: userpro_update_profile_via_facebook

function userpro_update_profile_via_facebook($user_id, $array)
{
    global $userpro;
    $id = isset($array['id']) ? $array['id'] : 0;
    $first_name = isset($array['first_name']) ? $array['first_name'] : 0;
    $last_name = isset($array['last_name']) ? $array['last_name'] : 0;
    $gender = isset($array['gender']) ? $array['gender'] : 0;
    $link = isset($array['link']) ? $array['link'] : 0;
    $email = isset($array['email']) ? $array['email'] : 0;
    $username = isset($array['username']) ? $array['username'] : 0;
    if (userpro_is_logged_in() && $user_id != get_current_user_id() && !current_user_can('manage_options')) {
        die;
    }
    if ($id && $id != 'undefined') {
        update_user_meta($user_id, 'userpro_facebook_id', $id);
    }
    if ($first_name && $first_name != 'undefined') {
        update_user_meta($user_id, 'first_name', $first_name);
    }
    if ($last_name && $last_name != 'undefined') {
        update_user_meta($user_id, 'last_name', $last_name);
    }
    if ($gender && $gender != 'undefined') {
        update_user_meta($user_id, 'gender', $gender);
    }
    if ($link && $link != 'undefined') {
        update_user_meta($user_id, 'facebook', $link);
    }
    /* begin display name */
    if (isset($name) && $name != 'undefined' && $name != 0) {
        $display_name = $name;
    } else {
        if ($first_name && $last_name && $first_name != 'undefined' && $last_name != 'undefined') {
            $display_name = $first_name . ' ' . $last_name;
        } else {
            if ($email) {
                $display_name = $email;
            } else {
                $display_name = $username;
            }
        }
    }
    if ($display_name) {
        if ($userpro->display_name_exists($display_name)) {
            $display_name = $userpro->unique_display_name($display_name);
        }
        $display_name = $userpro->remove_denied_chars($display_name);
        wp_update_user(array('ID' => $user_id, 'display_name' => $display_name));
        update_user_meta($user_id, 'display_name', $display_name);
    }
    /* end display name */
    do_action('userpro_after_profile_updated_fb');
}
开发者ID:Darciro,项目名称:PPM,代码行数:53,代码来源:user-functions.php

示例12: userpro_sc_shortcodes

function userpro_sc_shortcodes($args)
{
    global $userpro, $userpro_social;
    extract($args);
    if (!userpro_get_option('modstate_social')) {
        return false;
    }
    $query_id = userpro_get_view_user(get_query_var('up_username'));
    $user_id = get_current_user_id();
    // show activity
    if (isset($args['template']) && $args['template'] == 'activity') {
        // ALL ACTIVITY
        if ($args['activity_all'] == 1) {
            // ACTIVITY OPEN TO ALL
            if (userpro_sc_get_option('activity_open_to_all') == 1) {
                $activity = $userpro_social->activity(0, 0, $args['activity_per_page'], $args['activity_user']);
                if (locate_template('userpro/' . $template . '.php') != '') {
                    include get_template_directory() . '/userpro/' . $template . '.php';
                } else {
                    include userpro_sc_path . "templates/{$template}.php";
                }
            } else {
                if (userpro_is_logged_in()) {
                    $activity = $userpro_social->activity(0, 0, $args['activity_per_page'], $args['activity_user']);
                    if (locate_template('userpro/' . $template . '.php') != '') {
                        include get_template_directory() . '/userpro/' . $template . '.php';
                    } else {
                        include userpro_sc_path . "templates/{$template}.php";
                    }
                } else {
                    /* attempt to view profile so force redirect to same page */
                    $args['force_redirect_uri'] = 1;
                    $template = 'login';
                    $args['template'] = 'login';
                    if (locate_template('userpro/' . $template . '.php') != '') {
                        include get_template_directory() . '/userpro/' . $template . '.php';
                    } else {
                        include userpro_path . "templates/login.php";
                    }
                }
            }
            // FOLLOWED ACTIVITY
        } else {
            if (userpro_is_logged_in()) {
                if ($user_id == $query_id) {
                    $activity = $userpro_social->activity($user_id, 0, $args['activity_per_page'], $args['activity_user']);
                    if (locate_template('userpro/' . $template . '.php') != '') {
                        include get_template_directory() . '/userpro/' . $template . '.php';
                    } else {
                        include userpro_sc_path . "templates/{$template}.php";
                    }
                } else {
                    // show nothing
                }
            } else {
                /* attempt to view profile so force redirect to same page */
                $args['force_redirect_uri'] = 1;
                $template = 'login';
                $args['template'] = 'login';
                if (locate_template('userpro/' . $template . '.php') != '') {
                    include get_template_directory() . '/userpro/' . $template . '.php';
                } else {
                    include userpro_path . "templates/login.php";
                }
            }
        }
    }
    // show users I am following
    if (isset($args['template']) && $args['template'] == 'following') {
        if (userpro_is_logged_in()) {
            $user_id = $userpro->try_query_user($user_id);
            $following = $userpro_social->following($user_id);
            if (locate_template('userpro/' . $template . '.php') != '') {
                include get_template_directory() . '/userpro/' . $template . '.php';
            } else {
                include userpro_sc_path . "templates/{$template}.php";
            }
        } else {
            /* attempt to view profile so force redirect to same page */
            $args['force_redirect_uri'] = 1;
            $template = 'login';
            $args['template'] = 'login';
            if (locate_template('userpro/' . $template . '.php') != '') {
                include get_template_directory() . '/userpro/' . $template . '.php';
            } else {
                include userpro_path . "templates/login.php";
            }
        }
        $userpro->temp_id = $user_id;
    }
    // show followers
    if (isset($args['template']) && $args['template'] == 'followers') {
        if (userpro_is_logged_in()) {
            $user_id = $userpro->try_query_user($user_id);
            $followers = $userpro_social->followers($user_id);
            if (locate_template('userpro/' . $template . '.php') != '') {
                include get_template_directory() . '/userpro/' . $template . '.php';
            } else {
                include userpro_sc_path . "templates/{$template}.php";
            }
//.........这里部分代码省略.........
开发者ID:httvncoder,项目名称:151722441,代码行数:101,代码来源:shortcode-main.php

示例13: follow_text

 function follow_text($to, $from)
 {
     $body = '';
     $caption = '';
     $link = '';
     $name = '';
     $description = '';
     if ($to != $from && userpro_is_logged_in()) {
         /** Facebook Auto Post Bring Back , Added By Rahul */
         if (userpro_get_option('facebook_follow_autopost')) {
             if (userpro_get_option('facebook_follow_autopost_name')) {
                 $name = userpro_get_option('facebook_follow_autopost_name');
                 // post title
             } else {
                 $name = '';
             }
             if (userpro_get_option('facebook_follow_autopost_body')) {
                 $body = userpro_get_option('facebook_follow_autopost_body');
                 // post body
             } else {
                 $body = '';
             }
             if (userpro_get_option('facebook_follow_autopost_caption')) {
                 $caption = userpro_get_option('facebook_follow_autopost_caption');
                 // caption, url, etc.
             } else {
                 $caption = '';
             }
             if (userpro_get_option('facebook_follow_autopost_description')) {
                 $description = userpro_get_option('facebook_follow_autopost_description');
                 // full description
             } else {
                 $description = '';
             }
             if (userpro_get_option('facebook_follow_autopost_link')) {
                 $link = userpro_get_option('facebook_follow_autopost_link');
                 // link
             } else {
                 $link = '';
             }
         }
         $iamfollowing = get_user_meta($from, '_userpro_following_ids', true);
         if (isset($iamfollowing[$to])) {
             return '<a href="#" class="userpro-button userpro-follow following" data-follow-text="' . __('Follow', 'userpro') . '" data-unfollow-text="' . __('Unfollow', 'userpro') . '" data-following-text="' . __('Following', 'userpro') . '" data-follow-to="' . $to . '" data-follow-from="' . $from . '">' . __('Following', 'userpro') . '</a>';
         } else {
             return '<a href="#" class="userpro-button secondary userpro-follow notfollowing" data-follow-text="' . __('Follow', 'userpro') . '" data-unfollow-text="' . __('Unfollow', 'userpro') . '" data-following-text="' . __('Following', 'userpro') . '" data-follow-to="' . $to . '" data-follow-from="' . $from . '" id="fb-post-data" data-fbappid="' . userpro_get_option('facebook_app_id') . '" data-message="' . $body . '" data-caption="' . $caption . '" data-link="' . $link . '" data-name="' . $name . '" data-description="' . $description . '" ><i class="userpro-icon-share"></i>' . __('Follow', 'userpro') . '</a>';
         }
     }
 }
开发者ID:Darciro,项目名称:PPM,代码行数:49,代码来源:api.php

示例14: userpro_broadcast

function userpro_broadcast()
{
    global $userpro, $userpro_msg;
    $output = '';
    extract($_POST);
    if (!userpro_is_logged_in() || $user_id != get_current_user_id()) {
        die;
    }
    $user_id = get_current_user_id();
    $registered_users = explode(",", $user_list);
    $no_of_users -= 1;
    if ($registered_users[$user_no] != $user_id) {
        $userpro_msg->do_chat_dir($registered_users[$user_no], $user_id, $mode = 'inbox');
        $userpro_msg->write_chat($registered_users[$user_no], $user_id, $broadcast_body, $mode = 'inbox');
        $userpro_msg->email_user($registered_users[$user_no], $user_id, $broadcast_body);
        if (isset($_SESSION['user_count'])) {
            $_SESSION['user_count'] += 1;
        } else {
            $_SESSION['user_count'] = 1;
        }
        $output['message'] = '<div class="userpro-msg-notice">' . __('Your message has been sent to ' . userpro_profile_data('display_name', $registered_users[$user_no]) . '.', 'userpro-msg') . '</div><div class="userpro-msg-notice">' . __('Message sent to ' . $_SESSION['user_count'] . ' out of ' . $no_of_users . ' users.', 'userpro-msg') . '</div>';
        if ($_SESSION['user_count'] >= $no_of_users) {
            unset($_SESSION['user_count']);
            $userpro_msg->email_broadcaster($user_id, $broadcast_body);
            $output['message'] .= '<div class="userpro-msg-notice">' . __('Your message has been broadcasted successfully.', 'userpro-msg') . '</div>';
        }
        $output = json_encode($output);
        if (is_array($output)) {
            print_r($output);
        } else {
            echo $output;
        }
        die;
    } else {
        $output['message'] = '';
        $output = json_encode($output);
        if (is_array($output)) {
            print_r($output);
        } else {
            echo $output;
        }
        die;
    }
}
开发者ID:fritzdenim,项目名称:pangMoves,代码行数:44,代码来源:ajax.php

示例15: userpro

function userpro($args = array())
{
    global $post, $wp, $userpro_admin, $userpro;
    $argument = $args;
    if (is_home()) {
        $permalink = home_url();
    } else {
        if (isset($post->ID)) {
            $permalink = get_permalink($post->ID);
        } else {
            $permalink = '';
        }
    }
    /* arguments */
    /* Deafult Args */
    $default_args = array('modal_profile_saved' => __('Your profile has been saved!', 'userpro'), 'template' => null, 'max_width' => userpro_get_option('width'), 'uploads_dir' => $userpro->get_uploads_url(), 'default_avatar_male' => userpro_url . 'img/default_avatar_male.jpg', 'default_avatar_female' => userpro_url . 'img/default_avatar_female.jpg', 'layout' => userpro_get_option('layout'), 'margin_top' => 0, 'margin_bottom' => '30px', 'align' => 'center', 'skin' => userpro_get_option('skin'), 'required_text' => __('This field is required', 'userpro'), 'password_too_short' => __('Your password is too short', 'userpro'), 'passwords_do_not_match' => __('Passwords do not match', 'userpro'), 'password_not_strong' => __('Password is not strong enough', 'userpro'), 'keep_one_section_open' => 0, 'allow_sections' => 1, 'permalink' => $permalink, 'field_icons' => userpro_get_option('field_icons'), 'profile_thumb_size' => 80, 'register_heading' => __('Register an Account', 'userpro'), 'register_side' => __('Already a member?', 'userpro'), 'register_side_action' => 'login', 'register_button_action' => 'login', 'register_button_primary' => __('Register', 'userpro'), 'register_button_secondary' => __('Login', 'userpro'), 'register_group' => 'default', 'register_redirect' => '', 'type' => userpro_mu_get_option('multi_forms_default'), 'force_redirect_uri' => 0, 'login_heading' => __('Login', 'userpro'), 'login_side' => __('Forgot your password?', 'userpro'), 'login_side_action' => 'reset', 'login_button_action' => 'register', 'login_button_primary' => __('Login', 'userpro'), 'login_button_secondary' => __('Create an Account', 'userpro'), 'login_group' => 'default', 'login_redirect' => '', 'rememberme' => 'true', 'delete_heading' => __('Delete Profile', 'userpro'), 'delete_side' => __('Undo, back to profile', 'userpro'), 'delete_side_action' => 'view', 'delete_button_action' => 'view', 'delete_button_primary' => __('Confirm Deletion', 'userpro'), 'delete_button_secondary' => __('Back to Profile', 'userpro'), 'delete_group' => 'default', 'reset_heading' => __('Reset Password', 'userpro'), 'reset_side' => __('Back to Login', 'userpro'), 'reset_side_action' => 'login', 'reset_button_action' => 'change', 'reset_button_primary' => __('Request Secret Key', 'userpro'), 'reset_button_secondary' => __('Change your Password', 'userpro'), 'reset_group' => 'default', 'change_heading' => __('Change your Password', 'userpro'), 'change_side' => __('Request New Key', 'userpro'), 'change_side_action' => 'reset', 'change_button_action' => 'reset', 'change_button_primary' => __('Change my Password', 'userpro'), 'change_button_secondary' => __('Do not have a secret key?', 'userpro'), 'change_group' => 'default', 'list_heading' => __('Latest Members', 'userpro'), 'list_per_page' => 5, 'list_sortby' => 'registered', 'list_order' => 'desc', 'list_users' => '', 'list_group' => 'default', 'list_thumb' => 50, 'list_showthumb' => 1, 'list_showsocial' => 1, 'list_showbio' => 0, 'list_verified' => 0, 'list_relation' => 'or', 'online_heading' => __('Who is online now', 'userpro'), 'online_thumb' => 30, 'online_showthumb' => 1, 'online_showsocial' => 0, 'online_showbio' => 0, 'online_mini' => 1, 'online_mode' => 'vertical', 'edit_button_primary' => __('Save Changes', 'userpro'), 'edit_group' => 'default', 'view_group' => 'default', 'social_target' => '_blank', 'social_group' => 'default', 'card_width' => '250px', 'card_img_width' => '250', 'card_showbio' => 1, 'card_showsocial' => 1, 'link_target' => '_blank', 'error_heading' => __('An error has occured', 'userpro'), 'memberlist_table' => 0, 'memberlist_table_columns' => 'user_id,picture,name,country,gender,role,email_user,message_user', 'show_on_mobile' => 'picture,name,country,email_user,message_user', 'memberlist_v2' => 1, 'memberlist_v2_pic_size' => '86', 'memberlist_v2_fields' => 'age,gender,country', 'memberlist_v2_bio' => 1, 'memberlist_v2_showbadges' => 1, 'memberlist_v2_showname' => 1, 'memberlist_v2_showsocial' => 1, 'memberlist_pic_size' => '120', 'memberlist_pic_topspace' => '15', 'memberlist_pic_sidespace' => '30', 'memberlist_pic_rounded' => 1, 'memberlist_width' => '100%', 'memberlist_paginate' => 1, 'memberlist_paginate_top' => 1, 'memberlist_paginate_bottom' => 1, 'memberlist_show_name' => 1, 'memberlist_popup_view' => 0, 'memberlist_withavatar' => 0, 'memberlist_verified' => 0, 'memberlist_filters' => '', 'memberlist_default_search' => 1, 'per_page' => 12, 'sortby' => 'registered', 'order' => 'desc', 'relation' => 'and', 'search' => 1, 'exclude' => '', 'show_social' => 1, 'registration_closed_side' => __('Existing member? login', 'userpro'), 'registration_closed_side_action' => 'login', 'facebook_redirect' => 'profile', 'logout_redirect' => '', 'post_paginate' => 1, 'postsbyuser_num' => '12', 'postsbyuser_types' => 'post', 'postsbyuser_mode' => 'grid', 'postsbyuser_thumb' => 50, 'postsbyuser_showthumb' => 1, 'postsbyuser_taxonomy' => 'category', 'postsbyuser_category' => '', 'following_per_page' => '4', 'following_paginate' => '1', 'followers_per_page' => '4', 'followers_paginate' => '1', 'publish_heading' => __('Add a New Post', 'userpro'), 'publish_button_primary' => __('Publish', 'userpro'));
    $defaults = apply_filters('userpro_shortcode_args', $default_args);
    $args = wp_parse_args($args, $defaults);
    /* The arguments are passed via shortcode through admin panel*/
    foreach ($default_args as $key => $val) {
        if (isset($args[$key])) {
            ${$key} = $args[$key];
        } else {
            ${$key} = $val;
        }
    }
    if ($template) {
        static $i = 0;
        ob_start();
        /* increment wall */
        $i = rand(1, 1000);
        /* user template */
        do_action('userpro_custom_template_hook', array_merge($args, array('i' => $i)));
        if (isset($argument['hide_content']) && $argument['hide_content'] && empty($_GET)) {
            if (!empty($argument)) {
                $parameters = '';
                $argument_length = count($argument);
                foreach ($argument as $key => $value) {
                    if ($key == 'hide_content') {
                        continue;
                    }
                    $parameters .= " " . $key . "=" . "{$value}";
                }
            }
            $output = '<div class=userpro_show_content data-parameters="' . $parameters . '" ><a href="#">Click here to view the content</a></div>';
            return $output;
        } else {
            if (isset($argument['hide_content']) && $argument['hide_content']) {
                $template = $template;
            }
        }
        switch ($template) {
            case 'publish':
                if (userpro_is_logged_in()) {
                    $user_id = get_current_user_id();
                    $layout = 'none';
                    $args['layout'] = 'none';
                    if (isset($args['deny_roles']) && !empty($args['deny_roles'])) {
                        $denied_roles = explode(',', $args['deny_roles']);
                        if ($userpro->user_role_in_array($user_id, $denied_roles)) {
                            if (locate_template('userpro/not_allowed.php') != '') {
                                include get_stylesheet_directory() . '/userpro/not_allowed.php';
                            } else {
                                include userpro_path . "templates/not_allowed.php";
                            }
                        } else {
                            if (locate_template('userpro/' . $template . '.php') != '') {
                                include get_stylesheet_directory() . '/userpro/' . $template . '.php';
                            } else {
                                include userpro_path . "templates/{$template}.php";
                            }
                        }
                    } else {
                        if (locate_template('userpro/' . $template . '.php') != '') {
                            include get_stylesheet_directory() . '/userpro/' . $template . '.php';
                        } else {
                            include userpro_path . "templates/{$template}.php";
                        }
                    }
                } else {
                    /* attempt to edit profile so force redirect to same page */
                    $args['force_redirect_uri'] = 1;
                    add_action('userpro_pre_form_message', 'userpro_msg_login_to_post');
                    $template = 'login';
                    $args['template'] = 'login';
                    if (locate_template('userpro/' . $template . '.php') != '') {
                        include get_stylesheet_directory() . '/userpro/' . $template . '.php';
                    } else {
                        include userpro_path . "templates/login.php";
                    }
                    remove_action('userpro_pre_form_message', 'userpro_msg_login_to_post');
                }
                break;
            case 'postsbyuser':
                if (isset($args['user'])) {
                    if ($args['user'] == 'author') {
                        if (is_author()) {
                            $user_id = get_query_var('author');
                        } else {
                            $user_id = get_the_author_meta('ID');
//.........这里部分代码省略.........
开发者ID:Darciro,项目名称:PPM,代码行数:101,代码来源:shortcode-main.php


注:本文中的userpro_is_logged_in函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。