function userpro_show_badges($user_id, $inline = false)
{
    global $current_user, $wp, $userpro, $userpro_vk;
    get_currentuserinfo();
    $output = null;
    /* verification beside name */
    if (userpro_get_option('verified_badge_by_name') && $userpro->get_verified_status($user_id) == 1) {
        $output .= userpro_get_badge('verified', '', $tooltip = 'right');
    }
    /* the badges wrap */
    if ($inline == true) {
        $output .= '<span class="userpro-badges inline">';
    } else {
        $output .= '<span class="userpro-badges">';
    }
    /* Verified */
    if (userpro_is_verified($user_id) && !userpro_get_option('verified_badge_by_name')) {
        $output .= userpro_get_badge('verified');
    }
    /* Show country flag */
    $output .= userpro_get_badge('country', $user_id);
    /* Facebook */
    if ($userpro->is_facebook_user($user_id)) {
        $output .= userpro_get_badge('facebook');
    }
    /* Twitter */
    if ($userpro->is_twitter_user($user_id)) {
        $output .= userpro_get_badge('twitter');
    }
    /* Google+ */
    if ($userpro->is_google_user($user_id)) {
        $output .= userpro_get_badge('google');
    }
    /* VK integration */
    if (class_exists('userpro_vk_api') && $userpro_vk->is_vk_user($user_id)) {
        $output .= $userpro_vk->userpro_get_badge('vk');
    }
    /* Envato */
    if ($userpro->is_envato_customer($user_id)) {
        $output .= userpro_get_badge('envato');
    }
    /* Custom defined badges */
    $badges = apply_filters('userpro_show_badges', $user_id);
    if ($badges != $user_id) {
        $output .= $badges;
    }
    /* Online/offline status */
    if (userpro_get_option('modstate_online')) {
        if ($userpro->is_user_online($user_id)) {
            $output .= userpro_get_badge('online');
        } else {
            if (userpro_get_option('modstate_showoffline')) {
                $output .= userpro_get_badge('offline');
            }
        }
    }
    $output .= '</span>';
    return $output;
}
Esempio n. 2
0
function userpro_admin_users_badges($value, $column_name, $user_id)
{
    global $userpro;
    $user = get_userdata($user_id);
    if (userpro_get_option('backend_users_change')) {
        if ('userpro_username' == $column_name) {
            $res = '<div class="upadmin-avatar">' . get_avatar($user_id, 40) . '</div>';
            $res .= '<strong><a href="' . $userpro->permalink($user_id) . '" target="_blank" title="' . __('View Profile', 'userpro') . '">' . $user->user_login . '</a></strong><br />';
            $res .= '<span class="upadmin-small-name">(' . userpro_profile_data('display_name', $user_id) . ')</span>';
            $res .= '<div class="row-actions"><span class="edit"><a href="' . $userpro->permalink($user_id, 'edit') . '" target="_blank">' . __('Edit Profile', 'userpro') . '</a></span></div>';
            return $res;
        }
    }
    if ('userpro_admin_badges' == $column_name) {
        $res = userpro_show_badges($user_id, true);
        return $res;
    }
    if ('userpro_verify' == $column_name) {
        $res = '<div class="upadmin-verify-v2">';
        if ($userpro->get_verified_status($user_id) == 0) {
            $res .= '<a href="#" class="button upadmin-verify-u" data-user="' . $user_id . '">' . userpro_get_badge('unverified') . '</a>';
        } else {
            if (userpro_is_admin($user_id)) {
                $res .= '<a href="#" class="button button-primary upadmin-unverify-u" data-user="' . $user_id . '">' . userpro_get_badge('verified') . '</a>';
            } else {
                $res .= '<a href="#" class="button button-primary upadmin-unverify-u" data-user="' . $user_id . '">' . userpro_get_badge('verified') . '</a>';
            }
        }
        if ($userpro->get_verified_status($user_id) == 0) {
            if ($userpro->invited_to_verify($user_id)) {
                $res .= '&nbsp;&nbsp;' . __('Invitation sent!', 'userpro');
            } else {
                $res .= '<a href="#" class="button upadmin-invite-u" data-user="' . $user_id . '">' . __('Verified Invite', 'userpro') . '</a>';
            }
        }
        $res .= '</div>';
        return $res;
    }
    if ('block_users' == $column_name) {
        $res = '<div class="upadmin-block-v2">';
        if ($userpro->get_account_status($user_id) == 0) {
            $res .= '<a href="#" class="button upadmin-block-u" data-user="' . $user_id . '">' . userpro_get_badge('unblocked') . '</a>';
        } else {
            if (userpro_is_admin($user_id)) {
                $res .= '<a href="#" class="button upadmin-unblock-u" data-user="' . $user_id . '">' . userpro_get_badge('blocked') . '</a>';
            } else {
                $res .= '<a href="#" class="button upadmin-unblock-u" data-user="' . $user_id . '">' . userpro_get_badge('blocked') . '</a>';
            }
        }
        if ($userpro->get_account_status($user_id) == 1) {
            $res .= '<span class="button" data-user="' . $user_id . '">' . __('Account Blocked', 'userpro') . '</span>';
        }
        $res .= '</div>';
        $res .= '</div>';
        return $res;
    }
    return $value;
}
Esempio n. 3
0
function userpro_warn_verified_user($key, $user_id)
{
    global $userpro;
    $res = '';
    // add custom notice to display name
    if ($user_id > 0 && $key == 'display_name') {
        if (!userpro_is_admin($user_id) && userpro_get_option('unverify_on_namechange') && $userpro->get_verified_status($user_id) == 1 && !current_user_can('manage_options')) {
            $res .= '<div class="userpro-notice">' . sprintf(__('<strong>Warning!</strong> Your account is %s verified. If you change your display name, <em>you will lose your verification status.</em>', 'userpro'), userpro_get_badge('verified')) . '</div>';
        }
    }
    return $res;
}
Esempio n. 4
0
 function online_status($user_id)
 {
     global $userpro;
     $res = null;
     if (userpro_get_option('modstate_online')) {
         if ($userpro->is_user_online($user_id)) {
             $res = userpro_get_badge('online');
         } else {
             $res = userpro_get_badge('offline');
         }
     }
     return $res;
 }
function userpro_verify_invite()
{
    if (!current_user_can('manage_options')) {
        die;
    }
    // admin priv
    global $userpro, $userpro_admin;
    extract($_POST);
    $output = '';
    $userpro->new_invitation_verify($user_id);
    $output['admin_tpl'] = '<a href="#" class="button upadmin-verify-u" data-user="' . $user_id . '">' . userpro_get_badge('unverified') . '</a>';
    if ($userpro->get_verified_status($user_id) == 0) {
        $output['admin_tpl'] .= '&nbsp;&nbsp;' . __('Invitation sent!', 'userpro');
    }
    $output = json_encode($output);
    if (is_array($output)) {
        print_r($output);
    } else {
        echo $output;
    }
    die;
}
Esempio n. 6
0
 function parse_column($col, $user_id, $user, $args)
 {
     global $userpro_msg;
     $output = null;
     $show_on_mobile = array('');
     if (isset($args['show_on_mobile'])) {
         $show_on_mobile = explode(',', $args['show_on_mobile']);
     }
     switch ($col) {
         case 'user_id':
             if (in_array($col, $show_on_mobile)) {
                 $mobile = 'show-on-mobile';
             } else {
                 $mobile = 'hide-on-mobile';
             }
             $output .= '<td class="small ' . $col . ' ' . $mobile . '">' . $user_id . '</td>';
             break;
         case 'picture':
             if (in_array($col, $show_on_mobile)) {
                 $mobile = 'show-on-mobile';
             } else {
                 $mobile = 'hide-on-mobile';
             }
             $output .= '<td class="thumb ' . $col . ' ' . $mobile . '"><div class="userpro-table-img"><a href="' . $this->permalink($user_id) . '">' . get_avatar($user_id, 36) . '</a></div></td>';
             break;
         case 'name':
             if (in_array($col, $show_on_mobile)) {
                 $mobile = 'show-on-mobile';
             } else {
                 $mobile = 'hide-on-mobile';
             }
             $output .= '<td class="name ' . $col . ' ' . $mobile . '"><a href="' . $this->permalink($user_id) . '">' . userpro_profile_data('user_login', $user_id) . '</a> ';
             if (userpro_is_verified($user_id)) {
                 $output .= userpro_get_badge('verified');
             }
             $output .= '<br /><span class="nickname">(' . userpro_profile_data('display_name', $user_id) . ')</span></td>';
             break;
         case 'country':
             if (in_array($col, $show_on_mobile)) {
                 $mobile = 'show-on-mobile';
             } else {
                 $mobile = 'hide-on-mobile';
             }
             $output .= '<td class="' . $col . ' ' . $mobile . '">' . userpro_get_badge('country_big', $user_id) . '</td>';
             break;
         case 'gender':
             if (in_array($col, $show_on_mobile)) {
                 $mobile = 'show-on-mobile';
             } else {
                 $mobile = 'hide-on-mobile';
             }
             $output .= '<td class="' . $col . ' ' . $mobile . '">' . $this->cap_gender($user_id) . '</td>';
             break;
         case 'role':
             if (in_array($col, $show_on_mobile)) {
                 $mobile = 'show-on-mobile';
             } else {
                 $mobile = 'hide-on-mobile';
             }
             $output .= '<td class="' . $col . ' ' . $mobile . '">' . $this->get_role_nice($user) . '</td>';
             break;
         case 'email_user':
             if (in_array($col, $show_on_mobile)) {
                 $mobile = 'show-on-mobile';
             } else {
                 $mobile = 'hide-on-mobile';
             }
             $output .= '<td class="' . $col . ' ' . $mobile . '">';
             if (userpro_field_is_viewable('user_email', $user_id, $args)) {
                 $output .= '<a href="mailto:' . userpro_profile_data('user_email', $user_id) . '" class="userpro-flat-btn"><i class="userpro-icon-envelope"></i><span>' . __('Contact', 'userpro') . '</span></a>';
             }
             $output .= '</td>';
             break;
         case 'message_user':
             if (in_array($col, $show_on_mobile)) {
                 $mobile = 'show-on-mobile';
             } else {
                 $mobile = 'hide-on-mobile';
             }
             if (class_exists('userpro_msg_api')) {
                 if ($userpro_msg->can_chat_with($user_id)) {
                     $output .= '<td class="' . $col . ' ' . $mobile . '"><a href="#" class="userpro-flat-btn chat userpro-init-chat" data-chat_with="' . $user_id . '" data-chat_from="' . get_current_user_id() . '"><i class="userpro-icon-comment"></i><span>' . __('Send Message', 'userpro-msg') . '</span>';
                     $output .= '</a></td>';
                 }
             }
             break;
         default:
             $value = get_user_meta($user_id, $col, true);
             if (is_array($value)) {
                 $value = implode(',', $value);
             }
             if (in_array($col, $show_on_mobile)) {
                 $mobile = 'show-on-mobile';
             } else {
                 $mobile = 'hide-on-mobile';
             }
             $output .= '<td class="' . $col . ' ' . $mobile . '">' . $value . '</td>';
             break;
     }
     return $output;
 }
Esempio n. 7
0
function userpro_check_status_verified()
{
    echo '<div class="userpro-bar-success">' . sprintf(__('Congratulations! Your account is now %s <strong>Verified</strong>. <i class="userpro-icon-remove"></i>', 'userpro'), userpro_get_badge('verified')) . '</div>';
}