function um_admin_user_actions_hook($actions) { $actions = null; if (!um_user('super_admin')) { if (um_user('account_status') == 'awaiting_admin_review') { $actions['um_approve_membership'] = array('label' => __('Approve Membership', 'ultimatemember')); $actions['um_reject_membership'] = array('label' => __('Reject Membership', 'ultimatemember')); } if (um_user('account_status') == 'rejected') { $actions['um_approve_membership'] = array('label' => __('Approve Membership', 'ultimatemember')); } if (um_user('account_status') == 'approved') { $actions['um_put_as_pending'] = array('label' => __('Put as Pending Review', 'ultimatemember')); } if (um_user('account_status') == 'awaiting_email_confirmation') { $actions['um_resend_activation'] = array('label' => __('Resend Activation E-mail', 'ultimatemember')); } if (um_user('account_status') != 'inactive') { $actions['um_deactivate'] = array('label' => __('Deactivate this account', 'ultimatemember')); } if (um_user('account_status') == 'inactive') { $actions['um_reenable'] = array('label' => __('Reactivate this account', 'ultimatemember')); } if (um_current_user_can('delete', um_profile_id())) { $actions['um_delete'] = array('label' => __('Delete this user', 'ultimatemember')); } } if (current_user_can('delete_users')) { $actions['um_switch_user'] = array('label' => __('Login as this user', 'ultimatemember')); } um_fetch_user(um_profile_id()); return $actions; }
function um_admin_user_actions_hook($actions) { $actions = null; if (!um_user('super_admin')) { if (um_user('account_status') == 'awaiting_admin_review') { $actions['um_approve_membership'] = array('label' => __('Утвердить Пользователя', 'ultimatemember')); $actions['um_reject_membership'] = array('label' => __('Отклонить Пользователя', 'ultimatemember')); } if (um_user('account_status') == 'rejected') { $actions['um_approve_membership'] = array('label' => __('Одобрить Пользователя', 'ultimatemember')); } if (um_user('account_status') == 'approved') { $actions['um_put_as_pending'] = array('label' => __('Положите в ожидании пересмотра', 'ultimatemember')); } if (um_user('account_status') == 'awaiting_email_confirmation') { $actions['um_resend_activation'] = array('label' => __('Отправить повторно письмо для активации', 'ultimatemember')); } if (um_user('account_status') != 'inactive') { $actions['um_deactivate'] = array('label' => __('Отключить эту учетную запись', 'ultimatemember')); } if (um_user('account_status') == 'inactive') { $actions['um_reenable'] = array('label' => __('Активируйте эту учетную запись', 'ultimatemember')); } if (um_current_user_can('delete', um_profile_id())) { $actions['um_delete'] = array('label' => __('Удалить этого пользователя', 'ultimatemember')); } } if (current_user_can('delete_users')) { $actions['um_switch_user'] = array('label' => __('Войдите в систему как этот пользователь', 'ultimatemember')); } um_fetch_user(um_profile_id()); return $actions; }
function bf_profile_tabs_content($bf_um_form_slug) { global $buddyforms, $bf_um_tabs, $bf_um_form_slug; $form_slug = $bf_um_tabs[$bf_um_form_slug]; // Get the correct tab slug $parent_tab = bf_ultimate_member_parent_tab($buddyforms[$form_slug]); // Check if the ultimate member view is a form view and add the coret content if (isset($_GET['profiletab']) && $_GET['profiletab'] == $parent_tab) { if (!isset($_GET['subnav']) || $_GET['subnav'] == 'posts-' . $bf_um_form_slug) { // Display the posts echo do_shortcode('[buddyforms_the_loop form_slug="' . $form_slug . '" author="' . um_profile_id() . '"]'); } else { // Create the arguments aray for the form to get displayed $args = array('form_slug' => $form_slug); // Add the post id if post edit if (isset($_GET['bf_post_id'])) { $args['post_id'] = $_GET['bf_post_id']; } // Add the revisionsid if needed if (isset($_GET['bf_rev_id'])) { $args['revision_id'] = $_GET['bf_rev_id']; } buddyforms_create_edit_form($args); } } }
function add_profile_tabs($tabs) { global $ultimatemember; $args = array('post_type' => 'um_tab', 'meta_key' => '_pp_position', 'orderby' => 'meta_value_num', 'order' => 'ASC', 'posts_per_page' => 99); $posts = get_posts($args); $user_role = get_user_meta(get_current_user_id(), 'role', true); $profile_role = get_user_meta(um_profile_id(), 'role', true); foreach ($posts as $post) { $post_id = $post->ID; $meta = get_post_meta($post_id); $have_roles = array(); $see_roles = array(); $private_tab = isset($meta['_pp_private'][0]); if (isset($meta['_pp_have_roles'])) { $have_roles = maybe_unserialize($meta['_pp_have_roles'][0]); } if (isset($meta['_pp_view_roles'])) { $see_roles = maybe_unserialize($meta['_pp_view_roles'][0]); } $show = true; if (!empty($have_roles)) { if (!in_array($profile_role, $have_roles)) { $show = false; } } if (!empty($see_roles)) { if (!in_array($user_role, $see_roles)) { $show = false; } } if ($private_tab && um_profile_id() != get_current_user_id()) { $show = false; } if ($show) { $tabs[$post->post_name] = array('name' => $post->post_title, 'icon' => $meta['_pp_icon'][0], 'custom' => true); } } //loop return $tabs; }
function save_skills_as_woocommerce_products() { // echo '<pre>'; // print_r($_POST);die; global $wpdb; $skillid = get_query_var('skillid'); $user_id = um_profile_id(); $display_name = um_user('display_name'); $product_cat = get_term($_POST['skillCategory'], 'product_cat'); if (isset($_POST['skillStatus'])) { switch ($_POST['skillStatus']) { case 0: $product_status = 'draft'; break; case 1: $product_status = 'publish'; break; } } $post = array('ID' => $skillid, 'post_author' => $user_id, 'post_content' => '', 'post_status' => $product_status, 'post_title' => $display_name . '-' . $product_cat->slug, 'post_parent' => '', 'post_type' => "product"); $post_id = wp_insert_post($post); //add skill post. $logtxt = "PrdctID: {$post_id}\n"; wp_set_object_terms($post_id, $product_cat->slug, 'product_cat'); wp_set_object_terms($post_id, 'simple', 'product_type'); $firstname = get_user_meta($user_id, 'first_name', true); $lastname = get_user_meta($user_id, 'last_name', true); $username = get_user_meta($user_id, 'username', true); $mobile = get_user_meta($user_id, 'mobile_number', true); $address = get_user_meta($user_id, 'address', true); $country = get_user_meta($user_id, 'countries', true); $state = get_user_meta($user_id, 'state', true); $city = get_user_meta($user_id, 'city', true); $zip = get_user_meta($user_id, 'zip_code', true); $compname = get_user_meta($user_id, 'company_name', true); $compurl = get_user_meta($user_id, 'Company_website', true); $background_check = get_user_meta($user_id, 'background_check_status', true); $license_check = ''; $certification_check = ''; $phone_messages = get_user_meta($user_id, 'allow_phone_message', true); $email_notifications = get_user_meta($user_id, 'allow_email_notification', true); $web_calls = get_user_meta($user_id, 'allow_web_call', true); $phone_calls = get_user_meta($user_id, 'allow_phone_call', true); $profile_status = get_user_meta($user_id, 'role', true) . '' . get_user_meta($user_id, 'account_status', true); $advisor_skill_count = count_user_posts($user_id, 'product'); $current_date = date('my'); $advisor_location = get_user_meta($user_id, 'user_location', true); //get advisor calender $calendar_id = $wpdb->get_var('SELECT id FROM quickqtscpabc_appointment_calendars WHERE conwer=' . $user_id); if (isset($skillid)) { $skills_id = $skillid; } else { $skills_id = $post_id; } //Store skill description from POST to variable. $skilldescription = trim($_POST['skillDesc']); $thedata = array('pa_first_name' => array('name' => 'pa_first_name', 'value' => $firstname, 'is_visible' => '1', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_last_name' => array('name' => 'pa_last_name', 'value' => $lastname, 'is_visible' => '1', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_email_address' => array('name' => 'pa_email_address', 'value' => $username, 'is_visible' => '0', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_mobile_number' => array('name' => 'pa_mobile_number', 'value' => $mobile, 'is_visible' => '0', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_full_address' => array('name' => 'pa_full_address', 'value' => $address, 'is_visible' => '0', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_country' => array('name' => 'pa_country', 'value' => $country, 'is_visible' => '0', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_state' => array('name' => 'pa_state', 'value' => $state, 'is_visible' => '0', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_city' => array('name' => 'pa_city', 'value' => $city, 'is_visible' => '0', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_zip' => array('name' => 'pa_zip', 'value' => $zip, 'is_visible' => '0', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_company_name' => array('name' => 'pa_company_name', 'value' => $compname, 'is_visible' => '1', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_company_url' => array('name' => 'pa_company_url', 'value' => $compurl, 'is_visible' => '1', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_background-check' => array('name' => 'pa_background-check', 'value' => $background_check, 'is_visible' => '0', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_license_check' => array('name' => 'pa_license_check', 'value' => $license_check, 'is_visible' => '0', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_certification_check' => array('name' => 'pa_certification_check', 'value' => $certification_check, 'is_visible' => '0', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_username' => array('name' => 'pa_username', 'value' => $username, 'is_visible' => '0', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_skill_description' => array('name' => 'pa_skill_description', 'value' => $skilldescription, 'is_visible' => '1', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_skill_level' => array('name' => 'pa_skill_level', 'value' => $_POST['skillLevel'], 'is_visible' => '1', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_phone_messages' => array('name' => 'pa_phone_messages', 'value' => $phone_messages, 'is_visible' => '0', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_email_notifications' => array('name' => 'pa_email_notifications', 'value' => $email_notifications, 'is_visible' => '0', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_web_calls' => array('name' => 'pa_web_calls', 'value' => $web_calls, 'is_visible' => '0', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_phone_calls' => array('name' => 'pa_phone_calls', 'value' => $phone_calls, 'is_visible' => '0', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_profile_status' => array('name' => 'pa_profile_status', 'value' => $profile_status, 'is_visible' => '0', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_user_id' => array('name' => 'pa_user_id', 'value' => $user_id, 'is_visible' => '0', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_calendar_id' => array('name' => 'pa_calendar_id', 'value' => $calendar_id, 'is_visible' => '0', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_skills_id' => array('name' => 'pa_skills_id', 'value' => $skills_id, 'is_visible' => '0', 'is_variation' => '1', 'is_taxonomy' => '1'), 'pa_advisor_location' => array('name' => 'pa_advisor_location', 'value' => $advisor_location, 'is_visible' => '0', 'is_variation' => '1', 'is_taxonomy' => '1')); update_post_meta($post_id, '_product_attributes', $thedata); $firstname_termexist = term_exists($firstname, 'pa_first_name'); //Check if term exists. if ($firstname_termexist == 0 && $firstname_termexist == null) { //if term not exists $first_name_termid = wp_insert_term($firstname, 'pa_first_name'); //insert term wp_set_object_terms($post_id, $first_name_termid, 'pa_first_name'); //Set skill term } else { $first_name_termid = get_term_by('name', $firstname, 'pa_first_name'); wp_set_object_terms($post_id, $first_name_termid->term_id, 'pa_first_name'); } $lastname_termexist = term_exists($lastname, 'pa_last_name'); //Check if term exists. if ($lastname_termexist == 0 && $lastname_termexist == null) { //if term not exists $last_name_termid = wp_insert_term($lastname, 'pa_last_name'); //insert term wp_set_object_terms($post_id, $last_name_termid, 'pa_last_name'); //Set skill term } else { $last_name_termid = get_term_by('name', $lastname, 'pa_last_name'); wp_set_object_terms($post_id, $last_name_termid->term_id, 'pa_last_name'); } $username_termexist = term_exists($username, 'pa_email_address'); //Check if term exists. if ($username_termexist == 0 && $username_termexist == null) { //if term not exists $email_address_termid = wp_insert_term($username, 'pa_email_address'); //insert term wp_set_object_terms($post_id, $email_address_termid, 'pa_email_address'); //Set skill term } else { $email_address_termid = get_term_by('name', $username, 'pa_email_address'); wp_set_object_terms($post_id, $email_address_termid->term_id, 'pa_email_address'); } $mobile_termexist = term_exists($mobile, 'pa_mobile_number'); //Check if term exists. if ($mobile_termexist == 0 && $mobile_termexist == null) { //if term not exists $mobile_number_termid = wp_insert_term($mobile, 'pa_mobile_number'); //insert term wp_set_object_terms($post_id, $mobile_number_termid, 'pa_mobile_number'); //Set skill term } else { $mobile_number_termid = get_term_by('name', $mobile, 'pa_mobile_number'); wp_set_object_terms($post_id, $mobile_number_termid->term_id, 'pa_mobile_number'); } $address_termexist = term_exists($address, 'pa_full_address'); //Check if term exists. if ($address_termexist == 0 && $address_termexist == null) { //if term not exists $full_address_termid = wp_insert_term($address, 'pa_full_address'); //insert term wp_set_object_terms($post_id, $address, 'pa_full_address'); //Set skill term } else { $full_address_termid = get_term_by('name', $address, 'pa_full_address'); wp_set_object_terms($post_id, $full_address_termid->term_id, 'pa_full_address'); } $country_termexist = term_exists($country, 'pa_country'); //Check if term exists. if ($country_termexist == 0 && $country_termexist == null) { //if term not exists $country_termid = wp_insert_term($country, 'pa_country'); //insert term wp_set_object_terms($post_id, $country, 'pa_country'); //Set skill term } else { $country_termid = get_term_by('name', $country, 'pa_country'); wp_set_object_terms($post_id, $country_termid->term_id, 'pa_country'); } $state_termexist = term_exists($state, 'pa_state'); //Check if term exists. if ($state_termexist == 0 && $state_termexist == null) { //if term not exists $state_termid = wp_insert_term($state, 'pa_state'); //insert term wp_set_object_terms($post_id, $state, 'pa_state'); //Set skill term } else { $state_termid = get_term_by('name', $state, 'pa_state'); wp_set_object_terms($post_id, $state_termid->term_id, 'pa_state'); } $city_termexist = term_exists($city, 'pa_state'); //Check if term exists. if ($city_termexist == 0 && $city_termexist == null) { //if term not exists $city_termid = wp_insert_term($city, 'pa_city'); //insert term wp_set_object_terms($post_id, $city, 'pa_city'); //Set skill term } else { $city_termid = get_term_by('name', $city, 'pa_city'); wp_set_object_terms($post_id, $city_termid->term_id, 'pa_city'); } $zip_termexist = term_exists($zip, 'pa_zip'); //Check if term exists. if ($zip_termexist == 0 && $zip_termexist == null) { //if term not exists $zip_termid = wp_insert_term($zip, 'pa_zip'); //insert term wp_set_object_terms($post_id, $zip, 'pa_zip'); //Set skill term } else { $zip_termid = get_term_by('name', $zip, 'pa_zip'); wp_set_object_terms($post_id, $zip_termid->term_id, 'pa_zip'); } $background_check_termexist = term_exists($background_check, 'pa_background-check'); //Check if term exists. if ($background_check_termexist == 0 && $background_check_termexist == null) { //if term not exists $background_check_termid = wp_insert_term($background_check, 'pa_background-check'); //insert term wp_set_object_terms($post_id, $background_check_termid, 'pa_background-check'); //Set skill term } else { $background_check_termid = get_term_by('name', $background_check, 'pa_background-check'); wp_set_object_terms($post_id, $background_check_termid->term_id, 'pa_background-check'); } $compname_termexist = term_exists($compname, 'pa_company_name'); //Check if term exists. if ($compname_termexist == 0 && $compname_termexist == null) { //if term not exists $company_name_termid = wp_insert_term($compname, 'pa_company_name'); //insert term wp_set_object_terms($post_id, $company_name_termid, 'pa_company_name'); //Set skill term } else { $company_name_termid = get_term_by('name', $compname, 'pa_company_name'); wp_set_object_terms($post_id, $company_name_termid->term_id, 'pa_company_name'); } $compurl_termexist = term_exists($compurl, 'pa_company_url'); //Check if term exists. if ($compurl_termexist == 0 && $compurl_termexist == null) { //if term not exists $compurl_termid = wp_insert_term($compurl, 'pa_company_url'); //insert term wp_set_object_terms($post_id, $compurl_termid, 'pa_company_url'); //Set skill term } else { $compurl_termid = get_term_by('name', $compurl, 'pa_company_url'); wp_set_object_terms($post_id, $compurl_termid->term_id, 'pa_company_url'); } $username_termexist = term_exists($username, 'pa_username'); //Check if term exists. if ($username_termexist == 0 && $username_termexist == null) { //if term not exists $username_termid = wp_insert_term($username, 'pa_username'); //insert term wp_set_object_terms($post_id, $username_termid, 'pa_username'); //Set skill term } else { $username_termid = get_term_by('name', $username, 'pa_username'); wp_set_object_terms($post_id, $username_termid->term_id, 'pa_username'); } $user_id_termexist = term_exists($user_id, 'pa_user_id'); //Check if term exists. if ($user_id_termexist == 0 && $user_id_termexist == null) { //if term not exists $user_id_termid = wp_insert_term($user_id, 'pa_user_id'); //insert term wp_set_object_terms($post_id, $user_id_termid, 'pa_user_id'); //Set skill term } else { $user_id_termid = get_term_by('name', $user_id, 'pa_user_id'); wp_set_object_terms($post_id, $user_id_termid->term_id, 'pa_user_id'); } $skillDesc_termexist = term_exists($skilldescription, 'pa_skill_description'); //Check if term exists. if ($skillDesc_termexist == 0 && $skillDesc_termexist == null) { //if term not exists $skillDesc_termid = wp_insert_term($skilldescription, 'pa_skill_description'); //insert term wp_set_object_terms($post_id, $skillDesc_termid, 'pa_skill_description'); //Set skill term } else { $skillDesc_termid = get_term_by('name', $skilldescription, 'pa_skill_description'); wp_set_object_terms($post_id, $skillDesc_termid->term_id, 'pa_skill_description'); } $skillLevel_termexist = term_exists($_POST['skillLevel'], 'pa_skill_level'); //Check if term exists. if ($skillLevel_termexist == 0 && $skillLevel_termexist == null) { //if term not exists $skillLevel_termid = wp_insert_term($_POST['skillLevel'], 'pa_skill_level'); //insert term wp_set_object_terms($post_id, $skillLevel_termid, 'pa_skill_level'); //Set skill term } else { $skillLevel_termid = get_term_by('name', $_POST['skillLevel'], 'pa_skill_level'); wp_set_object_terms($post_id, $skillLevel_termid->term_id, 'pa_skill_level'); } $skillCategory_termexist = term_exists($_POST['skillCategory'], 'pa_skills_id'); //Check if term exists. if ($skillCategory_termexist == 0 && $skillCategory_termexist == null) { //if term not exists $skillCategory_termid = wp_insert_term($_POST['skillCategory'], 'pa_skills_id'); //insert term wp_set_object_terms($post_id, $skillCategory_termid, 'pa_skills_id'); //Set skill term } else { $skillCategory_termid = get_term_by('name', $_POST['skillCategory'], 'pa_skills_id'); wp_set_object_terms($post_id, $skillCategory_termid->term_id, 'pa_skills_id'); } $phone_messages_termexist = term_exists($phone_messages, 'pa_phone_messages'); //Check if term exists. if ($phone_messages_termexist == 0 && $phone_messages_termexist == null) { //if term not exists $phone_messages_termid = wp_insert_term($phone_messages, 'pa_phone_messages'); //insert term wp_set_object_terms($post_id, $phone_messages_termid, 'pa_phone_messages'); //Set skill term } else { $phone_messages_termid = get_term_by('name', $phone_messages, 'pa_phone_messages'); wp_set_object_terms($post_id, $phone_messages_termid->term_id, 'pa_phone_messages'); } $email_notifications_termexist = term_exists($email_notifications, 'pa_email_notifications'); //Check if term exists. if ($email_notifications_termexist == 0 && $email_notifications_termexist == null) { //if term not exists $email_notifications_termid = wp_insert_term($email_notifications, 'pa_email_notifications'); //insert term wp_set_object_terms($post_id, $email_notifications_termid, 'pa_email_notifications'); //Set skill term } else { $email_notifications_termid = get_term_by('name', $email_notifications, 'pa_email_notifications'); wp_set_object_terms($post_id, $email_notifications_termid->term_id, 'pa_email_notifications'); } $web_calls_termexist = term_exists($web_calls, 'pa_web_calls'); //Check if term exists. if ($web_calls_termexist == 0 && $web_calls_termexist == null) { //if term not exists $web_calls_termid = wp_insert_term($web_calls, 'pa_web_calls'); //insert term wp_set_object_terms($post_id, $web_calls_termid, 'pa_web_calls'); //Set skill term } else { $web_calls_termid = get_term_by('name', $web_calls, 'pa_web_calls'); wp_set_object_terms($post_id, $web_calls_termid->term_id, 'pa_web_calls'); } $phone_calls_termexist = term_exists($phone_calls, 'pa_phone_calls'); //Check if term exists. if ($phone_calls_termexist == 0 && $phone_calls_termexist == null) { //if term not exists $phone_calls_termid = wp_insert_term($phone_calls, 'pa_phone_calls'); //insert term wp_set_object_terms($post_id, $phone_calls_termid, 'pa_phone_calls'); //Set skill term } else { $phone_calls_termid = get_term_by('name', $phone_calls, 'pa_phone_calls'); wp_set_object_terms($post_id, $phone_calls_termid->term_id, 'pa_phone_calls'); } $profile_status_termexist = term_exists($profile_status, 'pa_profile_status'); //Check if term exists. if ($profile_status_termexist == 0 && $profile_status_termexist == null) { //if term not exists $profile_status_termid = wp_insert_term($profile_status, 'pa_profile_status'); //insert term wp_set_object_terms($post_id, $profile_status_termid, 'pa_profile_status'); //Set skill term } else { $profile_status_termid = get_term_by('name', $profile_status, 'pa_profile_status'); wp_set_object_terms($post_id, $profile_status_termid->term_id, 'pa_profile_status'); } $calendar_id_termexist = term_exists($calendar_id, 'pa_calendar_id'); //Check if term exists. if ($calendar_id_termexist == 0 && $calendar_id_termexist == null) { //if term not exists $calendar_id_termid = wp_insert_term($calendar_id, 'pa_calendar_id'); //insert term wp_set_object_terms($post_id, $calendar_id_termid, 'pa_calendar_id'); //Set skill term } else { $calendar_id_termid = get_term_by('name', $calendar_id, 'pa_calendar_id'); wp_set_object_terms($post_id, $calendar_id_termid->term_id, 'pa_calendar_id'); } $skills_id_termexist = term_exists($skills_id, 'pa_skills_id'); //Check if term exists. if ($skills_id_termexist == 0 && $skills_id_termexist == null) { //if term not exists $skills_id_termid = wp_insert_term($skills_id, 'pa_skills_id'); //insert term wp_set_object_terms($post_id, $skills_id_termid, 'pa_skills_id'); //Set skill term } else { $skills_id_termid = get_term_by('name', $skills_id, 'pa_skills_id'); wp_set_object_terms($post_id, $skills_id_termid->term_id, 'pa_skills_id'); } $advisor_location_termexist = term_exists($advisor_location, 'pa_advisor_location'); //Check if term exists. if ($advisor_location_termexist == 0 && $advisor_location_termexist == null) { //if term not exists $advisor_location_termid = wp_insert_term($advisor_location, 'pa_advisor_location'); //insert term wp_set_object_terms($post_id, $advisor_location_termid, 'pa_advisor_location'); //Set skill term } else { $advisor_location_termid = get_term_by('name', $skills_id, 'pa_advisor_location'); wp_set_object_terms($post_id, $advisor_location_termid->term_id, 'pa_advisor_location'); } $skilltags = $_POST['skillTags']; $skilltagsarray = explode(',', $skilltags); wp_set_object_terms($post_id, $skilltagsarray, 'product_tag'); update_post_meta($post_id, '_visibility', 'visible'); update_post_meta($post_id, '_stock_status', 'instock'); update_post_meta($post_id, 'total_sales', '0'); update_post_meta($post_id, '_downloadable', 'no'); update_post_meta($post_id, '_virtual', 'yes'); update_post_meta($post_id, '_regular_price', $_POST['skillRate']); update_post_meta($post_id, '_sale_price', $_POST['skillRate']); update_post_meta($post_id, '_purchase_note', ""); update_post_meta($post_id, '_featured', "no"); update_post_meta($post_id, '_weight', ""); update_post_meta($post_id, '_length', ""); update_post_meta($post_id, '_width', ""); update_post_meta($post_id, '_height', ""); update_post_meta($post_id, '_sku', "{$firstname}-{$advisor_skill_count}-{$current_date}"); update_post_meta($post_id, '_sale_price_dates_from', ""); update_post_meta($post_id, '_sale_price_dates_to', ""); update_post_meta($post_id, '_price', $_POST['skillRate']); update_post_meta($post_id, '_sold_individually', "yes"); update_post_meta($post_id, '_manage_stock', "yes"); update_post_meta($post_id, '_backorders', "no"); update_post_meta($post_id, '_stock', "1"); //add supporting link if (get_post_meta($post_id, 'supporting_link', true)) { update_post_meta($post_id, 'supporting_link', $_POST['skillSupportLink']); } else { add_post_meta($post_id, 'supporting_link', $_POST['skillSupportLink']); } //add Skill Image of the advisor -Start if (!has_post_thumbnail($post_id)) { $current_user = wp_get_current_user(); $user_id = $current_user->ID; $profilepic = get_user_meta($user_id, 'profile_photo', true); if ($profilepic != '') { $thumb_url = get_site_url() . "/wp-content/uploads/ultimatemember/" . $user_id . "/" . get_user_meta($user_id, 'profile_photo', true); } else { $thumb_url = get_site_url() . "/wp-content/uploads/ultimatemember/no-image.png"; } // Download file to temp location $tmp = download_url($thumb_url); //print_r($tmp);die; // Set variables for storage // fix file name for query strings preg_match('/[^\\?]+\\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $thumb_url, $matches); $file_array['name'] = basename($matches[0]); $file_array['tmp_name'] = $tmp; // If error storing temporarily, unlink if (is_wp_error($tmp)) { @unlink($file_array['tmp_name']); $file_array['tmp_name'] = ''; $logtxt .= "Error: download_url error - {$tmp}\n"; } else { $logtxt .= "download_url: {$tmp}\n"; } if (!function_exists('media_handle_upload')) { require_once ABSPATH . "wp-admin" . '/includes/image.php'; require_once ABSPATH . "wp-admin" . '/includes/file.php'; require_once ABSPATH . "wp-admin" . '/includes/media.php'; } //use media_handle_sideload to upload img: $thumbid = media_handle_sideload($file_array, $post_id, 'gallery desc'); // If error storing permanently, unlink if (is_wp_error($thumbid)) { @unlink($file_array['tmp_name']); //return $thumbid; $logtxt .= "Error: media_handle_sideload error - {$thumbid}\n"; } else { $logtxt .= "ThumbID: {$thumbid}\n"; } set_post_thumbnail($post_id, $thumbid); } //add Skill Image of the advisor -End //Handle Certificate Upload. -Start if ($_FILES['skillDegree']['error'] === UPLOAD_ERR_OK) { if (!function_exists('wp_handle_upload')) { require_once ABSPATH . 'wp-admin/includes/file.php'; } // check filetype is pdf and return if not $file_type = $_FILES['skillDegree']['type']; if ($file_type != 'application/pdf') { return; } // upload the file $overrides = array('test_form' => false); $skilldeg = $_FILES["skillDegree"]; $file = wp_handle_upload($skilldeg, $overrides); if ($file && !isset($file['error'])) { //echo "File is valid, and was successfully uploaded.\n"; //var_dump( $file); if (isset($file['file'])) { // Gather data for attachment $title = str_replace(".pdf", "", $_FILES["skillDegree"]['name']); $attachment = array('post_mime_type' => $file_type, 'post_title' => addslashes($title), 'post_content' => '', 'post_status' => 'inherit', 'post_parent' => $post_id); //create attachment & update metadata $attach_id = wp_insert_attachment($attachment, $file['file']); // Before we update the post meta, trash any previously uploaded pdfs for this post. $existing_skillDegree = (int) get_post_meta($post_id, 'skillDegree', true); if (is_numeric($existing_skillDegree)) { wp_delete_attachment($existing_skillDegree); } // Now, update the post meta to associate the new pdf with the post update_post_meta($post_id, "skillDegree", $attach_id); } } else { /** * Error generated by _wp_handle_upload() * @see _wp_handle_upload() in wp-admin/includes/file.php */ echo $file['error']; //die; } } //Handle Certificate Upload. -End //Handle Licence Upload. -Start if ($_FILES['skillLicense']['error'] === UPLOAD_ERR_OK) { if (!function_exists('wp_handle_upload')) { require_once ABSPATH . 'wp-admin/includes/file.php'; } // check filetype is pdf and return if not $file_type = $_FILES['skillLicense']['type']; if ($file_type != 'application/pdf') { return; } // upload the file $overrides = array('test_form' => false); $skilldeg = $_FILES["skillLicense"]; $file = wp_handle_upload($skilldeg, $overrides); if ($file && !isset($file['error'])) { //echo "File is valid, and was successfully uploaded.\n"; //var_dump( $file); if (isset($file['file'])) { // Gather data for attachment $title = str_replace(".pdf", "", $_FILES["skillLicense"]['name']); $attachment = array('post_mime_type' => $file_type, 'post_title' => addslashes($title), 'post_content' => '', 'post_status' => 'inherit', 'post_parent' => $post_id); //create attachment & update metadata $attach_id = wp_insert_attachment($attachment, $file['file']); // Before we update the post meta, trash any previously uploaded pdfs for this post. $existing_skillLicense = (int) get_post_meta($post_id, 'skillLicense', true); if (is_numeric($existing_skillLicense)) { wp_delete_attachment($existing_skillLicense); } // Now, update the post meta to associate the new pdf with the post update_post_meta($post_id, "skillLicense", $attach_id); } } else { /** * Error generated by _wp_handle_upload() * @see _wp_handle_upload() in wp-admin/includes/file.php */ echo $file['error']; //die; } } //Handle Licence Upload. -End wp_redirect(get_permalink(get_page_by_path('mynd-skills'))); exit; }
function view_field($key, $data, $rule = false) { global $ultimatemember; $output = null; // get whole field data if (is_array($data)) { $data = $this->get_field($key); extract($data); } if (!isset($data['type'])) { return; } if (isset($data['in_group']) && $data['in_group'] != '' && $rule != 'group') { return; } if ($visibility == 'edit') { return; } if (in_array($type, array('block', 'shortcode', 'spacing', 'divider', 'group'))) { } else { if (!$this->field_value($key, $default, $data)) { return; } } if (!um_can_view_field($data)) { return; } // disable these fields in profile view only if (in_array($key, array('user_password')) && $this->set_mode == 'profile') { return; } if (!um_field_conditions_are_met($data)) { return; } switch ($type) { /* Default */ default: $output .= '<div class="um-field' . $classes . '"' . $conditional . ' data-key="' . $key . '">'; if (isset($data['label'])) { $output .= $this->field_label($label, $key, $data); } $res = stripslashes($this->field_value($key, $default, $data)); $output .= '<div class="um-field-area">'; $output .= '<div class="um-field-value">' . $res . '</div>'; $output .= '</div>'; $output .= '</div>'; break; /* HTML */ /* HTML */ case 'block': $output .= '<div class="um-field' . $classes . '"' . $conditional . ' data-key="' . $key . '"> <div class="um-field-block">' . $content . '</div> </div>'; break; /* Shortcode */ /* Shortcode */ case 'shortcode': $content = str_replace('{profile_id}', um_profile_id(), $content); $output .= '<div class="um-field' . $classes . '"' . $conditional . ' data-key="' . $key . '"> <div class="um-field-shortcode">' . do_shortcode($content) . '</div> </div>'; break; /* Gap/Space */ /* Gap/Space */ case 'spacing': $output .= '<div class="um-field um-field-spacing' . $classes . '"' . $conditional . ' style="height: ' . $spacing . '"></div>'; break; /* A line divider */ /* A line divider */ case 'divider': $output .= '<div class="um-field um-field-divider' . $classes . '"' . $conditional . ' style="border-bottom: ' . $borderwidth . 'px ' . $borderstyle . ' ' . $bordercolor . '">'; if ($divider_text) { $output .= '<div class="um-field-divider-text"><span>' . $divider_text . '</span></div>'; } $output .= '</div>'; break; /* Rating */ /* Rating */ case 'rating': $output .= '<div class="um-field' . $classes . '"' . $conditional . ' data-key="' . $key . '">'; if (isset($data['label'])) { $output .= $this->field_label($label, $key, $data); } $output .= '<div class="um-field-area">'; $output .= '<div class="um-field-value"> <div class="um-rating-readonly um-raty" id="' . $key . '" data-key="' . $key . '" data-number="' . $data['number'] . '" data-score="' . $this->field_value($key, $default, $data) . '"></div> </div>'; $output .= '</div>'; $output .= '</div>'; break; } // Custom filter for field output if (isset($this->set_mode)) { $output = apply_filters("um_{$key}_form_show_field", $output, $this->set_mode); } return $output; }
function get_admin_actions() { $items = ''; $actions = array(); $actions = apply_filters('um_admin_user_actions_hook', $actions); if (!isset($actions) || empty($actions)) { return false; } foreach ($actions as $id => $arr) { $url = add_query_arg('um_action', $id); $url = add_query_arg('uid', um_profile_id(), $url); $items[] = '<a href="' . $url . '" class="real_url">' . $arr['label'] . '</a>'; } return $items; }
if ($ultimatemember->shortcodes->loop->found_posts >= 10) { ?> <div class="um-load-items"> <a href="#" class="um-ajax-paginate um-button" data-hook="um_load_posts" data-args="post,10,10,<?php echo um_user('ID'); ?> "><?php _e('load more posts', 'ultimatemember'); ?> </a> </div> <?php } ?> </div> <?php } else { ?> <div class="um-profile-note"><span><?php echo um_profile_id() == get_current_user_id() ? __('You have not created any posts.', 'ultimatemember') : __('This user has not created any posts.', 'ultimatemember'); ?> </span></div> <?php } wp_reset_postdata();
function load($args) { global $ultimatemember; ob_start(); $defaults = array(); $args = wp_parse_args($args, $defaults); // when to not continue $this->form_id = isset($args['form_id']) ? $args['form_id'] : null; if (!$this->form_id) { return; } $this->form_status = get_post_status($this->form_id); if ($this->form_status != 'publish') { return; } // get data into one global array $post_data = $ultimatemember->query->post_data($this->form_id); $args = apply_filters('um_pre_args_setup', $post_data); if (!isset($args['template'])) { $args['template'] = ''; } if (isset($post_data['template']) && $post_data['template'] != $args['template']) { $args['template'] = $post_data['template']; } if (!$this->template_exists($args['template'])) { $args['template'] = $post_data['mode']; } if (!isset($post_data['template'])) { $post_data['template'] = $post_data['mode']; } $args = array_merge($post_data, $args); if (isset($args['use_globals']) && $args['use_globals'] == 1) { $args = array_merge($args, $this->get_css_args($args)); } else { $args = array_merge($this->get_css_args($args), $args); } // filter for arguments $args = apply_filters('um_shortcode_args_filter', $args); extract($args, EXTR_SKIP); // for profiles only if ($mode == 'profile' && um_profile_id() && isset($args['role']) && $args['role'] && $args['role'] != $ultimatemember->query->get_role_by_userid(um_profile_id())) { return; } // start loading the template here do_action("um_pre_{$mode}_shortcode", $args); do_action("um_before_form_is_loaded", $args); do_action("um_before_{$mode}_form_is_loaded", $args); $this->template_load($template, $args); $this->dynamic_css($args); if (um_get_requested_user() || $mode == 'logout') { um_reset_user(); } do_action('um_after_everything_output'); $output = ob_get_contents(); ob_end_clean(); return $output; }
function wp_ulike_comments_um_profile_content($args) { global $wp_ulike_class, $ultimatemember; $args = array("user_id" => um_profile_id(), "col" => 'comment_id', "table" => 'ulike_comments', "limit" => 10); $user_logs = $wp_ulike_class->get_current_user_likes($args); if ($user_logs != null) { echo '<div class="um-profile-note"><span>' . __('Recent Comments Liked', 'alimir') . '</span></div>'; foreach ($user_logs as $user_log) { $comment = get_comment(stripslashes($user_log->comment_id)); $get_date = $user_log->date_time; echo '<div class="um-item">'; echo '<div class="um-item-link"> <i class="um-icon-ios-chatboxes"></i> <a href="' . get_comment_link($comment->comment_ID) . '">' . $comment->comment_content . '</a> <em style="font-size:.7em;padding:0 10px;"><span class="um-faicon-quote-left"></span> ' . $comment->comment_author . ' <span class="um-faicon-quote-right"></span></em> </div>'; echo '<div class="um-item-meta"> <span>' . wp_ulike_date_i18n($get_date) . '</span> <span class="badge"><i class="um-faicon-thumbs-o-up"></i> ' . get_comment_meta($comment->comment_ID, '_commentliked', true) . '</span> </div>'; echo '</div>'; } } else { echo '<div style="display: block;" class="um-profile-note"><i class="um-faicon-frown-o"></i><span>' . __('This user has not made any likes.', 'alimir') . '</span></div>'; } }
function um_add_edit_icon($args) { global $ultimatemember; $output = ''; if (!is_user_logged_in()) { return; } // not allowed for guests if (isset($ultimatemember->user->cannot_edit) && $ultimatemember->user->cannot_edit == 1) { return; } // do not proceed if user cannot edit if ($ultimatemember->fields->editing == true) { ?> <div class="um-profile-edit um-profile-headericon"> <a href="#" class="um-profile-edit-a um-profile-save"><i class="um-faicon-check"></i></a> </div> <?php } else { ?> <div class="um-profile-edit um-profile-headericon"> <a href="#" class="um-profile-edit-a"><i class="um-faicon-cog"></i></a> <?php $items = array('editprofile' => '<a href="' . um_edit_profile_url() . '" class="real_url">' . __('Edit Profile', 'ultimatemember') . '</a>', 'myaccount' => '<a href="' . um_get_core_page('account') . '" class="real_url">' . __('My Account', 'ultimatemember') . '</a>', 'logout' => '<a href="' . um_get_core_page('logout') . '" class="real_url">' . __('Logout', 'ultimatemember') . '</a>', 'cancel' => '<a href="#" class="um-dropdown-hide">' . __('Cancel', 'ultimatemember') . '</a>'); $cancel = $items['cancel']; if (!um_is_myprofile()) { $actions = $ultimatemember->user->get_admin_actions(); unset($items['myaccount']); unset($items['logout']); unset($items['cancel']); if (is_array($actions)) { $items = array_merge($items, $actions); } $items = apply_filters('um_profile_edit_menu_items', $items, um_profile_id()); $items['cancel'] = $cancel; } else { $items = apply_filters('um_myprofile_edit_menu_items', $items); } echo $ultimatemember->menu->new_ui($args['header_menu'], 'div.um-profile-edit', 'click', $items); ?> </div> <?php } }
<div class="um-load-items"> <a href="#" class="um-ajax-paginate um-button" data-hook="um_load_comments" data-args="comment,10,10,<?php echo um_user('ID'); ?> "><?php _e('load more comments', 'ultimatemember'); ?> </a> </div> <?php } ?> </div> <?php } else { ?> <div class="um-profile-note"><span><?php echo um_profile_id() == get_current_user_id() ? __('You have not made any comments.', 'ultimatemember') : __('This user has not made any comments.', 'ultimatemember'); ?> </span></div> <?php }
function um_profile_content_deals_default($args) { global $ultimatemember; $user_deals = $ultimatemember->query->make('post_type=deal&posts_per_page=10&offset=0&author=' . um_profile_id()); if ($user_deals->have_posts()) { ?> <div class="isotope-wrapper" data-isotope-cols="4" data-isotope-gutter="30"> <?php while ($user_deals->have_posts()) { $user_deals->the_post(); ?> <div class="deal-item-wrapper"> <?php get_template_part('loop/content', 'deal'); ?> </div> <?php } ?> </div><!-- end isotope-wrapper --> <?php } }
if ($ultimatemember->shortcodes->loop->found_posts >= 10) { ?> <div class="um-load-items"> <a href="#" class="um-ajax-paginate um-button" data-hook="um_load_posts" data-args="post,10,10,<?php echo um_user('ID'); ?> "><?php _e('load more posts', 'ultimatemember'); ?> </a> </div> <?php } ?> </div> <?php } else { ?> <div class="um-icon-ios-paper-outline"> <span><?php echo um_profile_id() == get_current_user_id() ? __('Todavía no has creado ninguna clase. <a href=https://escuelamlm.com/escritorio/post-new.php>Crea una ahora.</a>', 'ultimatemember') : __('Este miembro todavía no ha creado ninguna clase. ¿Quieres crear una clase? <a href=https://escuelamlm.com?ref=perfil-clases>Registra tu cuenta y empieza.</a> ', 'ultimatemember'); ?> </span></div> <?php } wp_reset_postdata();
<?php // Admin Send Deal Mail $email_to = fw_ssd_get_option('new-deal-email'); // Allow deal submit without registration $allow_no_reg = fw_ssd_get_option('member-submit-switch'); if (function_exists('um_profile_id') || $allow_no_reg) { if (function_exists('um_profile_id') && !um_profile_id()) { wp_redirect(home_url('login/')); exit; } if ($email_to) { acf_form_head(); } /* Template Name: Submit Deal */ get_header(); ?> <div id="post-<?php the_ID(); ?> " <?php post_class('page-wrapper'); ?> > <div class="container"> <div class="row">
function get_phone_messages_details() { $calldetails[] = ''; $user_id = um_profile_id(); $mobile_number = get_user_meta($user_id, 'mobile_number', true); //echo $mobile_number."<br/>"; $myoptions = get_option('twilio_settings'); $AccountSid = $myoptions['twilio_account_sid']; $AuthToken = $myoptions['twilio_auth_token']; //$appSid = "AP3474e136f42acf5fcc40d20c64d78d12"; $callerID = $myoptions['twilio_app_twilionumber']; $http = new Services_Twilio_TinyHttp('https://api.twilio.com', array('curlopts' => array(CURLOPT_SSL_VERIFYPEER => true, CURLOPT_SSL_VERIFYHOST => 2))); $client = new Services_Twilio($AccountSid, $AuthToken, "2010-04-01", $http); $messages = $client->account->messages->getIterator(0, 50, array('From' => $callerID)); $html = "<h1>My Phone Messages</h1><br><table class='footable'>"; $html .= "<thead><th>Date-Time</th></th><th>Message From</th><th>Message To</th><th>Credit Used</th><th>Status</th></thead>"; $html .= "<tbody>"; foreach ($messages as $message) { if ($message->price == "") { $message = 0; } else { $price = $message->price; } $html .= "<tr><td>" . $message->date_sent . "</td><td>" . $message->from . "</td><td>" . $message->to . "</td>" . "<td>" . $price . " " . '0.5 Credits' . "</td><td>" . $message->status . "</td></tr>"; } $html .= "</tbody>"; $html .= "</table>"; echo $html; }
function pp_tabs_output_field($atts) { global $ultimatemember; $a = shortcode_atts(array('field' => '', 'label' => '0'), $atts); um_fetch_user(um_profile_id()); $key = $a['field']; $showlabel = $a['label']; if (um_user($key)) { $output = null; $data = $ultimatemember->fields->get_field($key); extract($data); if (!isset($data['type'])) { return; } if (isset($data['in_group']) && $data['in_group'] != '' && $rule != 'group') { return; } if (in_array($type, array('block', 'shortcode', 'spacing', 'divider', 'group'))) { } else { if (!$ultimatemember->fields->field_value($key, $default, $data)) { return; } } if (!um_can_view_field($data)) { return; } if (!um_field_conditions_are_met($data)) { return; } switch ($type) { /* Default */ default: if ($showlabel == '1') { $output .= $ultimatemember->fields->field_label($label, $key, $data); } $res = stripslashes($ultimatemember->fields->field_value($key, $default, $data)); $output .= $res; break; /* HTML */ /* HTML */ case 'block': $output .= '<div class="um-field' . $classes . '"' . $conditional . ' data-key="' . $key . '"> <div class="um-field-block">' . $content . '</div> </div>'; break; /* Shortcode */ /* Shortcode */ case 'shortcode': $content = str_replace('{profile_id}', um_profile_id(), $content); $output .= '<div class="um-field' . $classes . '"' . $conditional . ' data-key="' . $key . '"> <div class="um-field-shortcode">' . do_shortcode($content) . '</div> </div>'; break; /* Gap/Space */ /* Gap/Space */ case 'spacing': $output .= '<div class="um-field um-field-spacing' . $classes . '"' . $conditional . ' style="height: ' . $spacing . '"></div>'; break; /* A line divider */ /* A line divider */ case 'divider': $output .= '<div class="um-field um-field-divider' . $classes . '"' . $conditional . ' style="border-bottom: ' . $borderwidth . 'px ' . $borderstyle . ' ' . $bordercolor . '">'; if ($divider_text) { $output .= '<div class="um-field-divider-text"><span>' . $divider_text . '</span></div>'; } $output .= '</div>'; break; /* Rating */ /* Rating */ case 'rating': $output .= '<div class="um-field' . $classes . '"' . $conditional . ' data-key="' . $key . '">'; if (isset($data['label'])) { $output .= $ultimatemember->fields->field_label($label, $key, $data); } $output .= '<div class="um-field-area">'; $output .= '<div class="um-field-value"> <div class="um-rating-readonly um-raty" id="' . $key . '" data-key="' . $key . '" data-number="' . $data['number'] . '" data-score="' . $ultimatemember->fields->field_value($key, $default, $data) . '"></div> </div>'; $output .= '</div>'; $output .= '</div>'; break; } // Custom filter for field output if (isset($ultimatemember->fields->set_mode)) { $output = apply_filters("um_{$key}_form_show_field", $output, $ultimatemember->fields->set_mode); } return $output; } else { return ''; } }
<?php /** * Template Name: Skills List */ global $product; get_header(); if (have_posts()) { while (have_posts()) { the_post(); $user_id = um_profile_id(); $main_content_style = ""; if (vp_metabox('background_settings.hb_content_background_color')) { $main_content_style = ' style="background-color: ' . vp_metabox('background_settings.hb_content_background_color') . ';"'; echo "<style type=\"text/css\">#pre-footer-area:after{border-top-color:" . vp_metabox('background_settings.hb_content_background_color') . "}</style>"; } ?> <!-- BEGIN #main-content --> <div id="main-content"<?php echo $main_content_style; ?> > <div class="container"> <?php $sidebar_layout = vp_metabox('layout_settings.hb_page_layout_sidebar'); $sidebar_name = vp_metabox('layout_settings.hb_choose_sidebar'); if ($sidebar_layout == "default" || $sidebar_layout == "") { $sidebar_layout = hb_options('hb_page_layout_sidebar'); $sidebar_name = hb_options('hb_choose_sidebar'); } if (vp_metabox('misc_settings.hb_onepage')) {