예제 #1
0
function message_custom_login($message)
{
    global $wpdb;
    mf_enqueue_script('script_custom_login', plugin_dir_url(__FILE__) . "script.js");
    $post_title = __("You haven't set a text to be displayed here", 'lang_login');
    $post_content = "<a href='" . admin_url("options-general.php?page=settings_mf_base#settings_custom_login") . "'>" . __("Choose a text by going to the settings page", 'lang_login') . "</a>";
    $post_id = get_option('settings_custom_login_page');
    if ($post_id > 0) {
        $result = $wpdb->get_results($wpdb->prepare("SELECT post_title, post_content FROM " . $wpdb->posts . " WHERE ID = '%d' AND post_type = 'page' AND post_status = 'publish'", $post_id));
        foreach ($result as $r) {
            $post_title = $r->post_title;
            $post_content = apply_filters('the_content', $r->post_content);
        }
    }
    $additional_message = "<div id='mf_custom_login'>\n\t\t<h2>" . $post_title . "</h2>\n\t\t<p>" . $post_content . "</p>\n\t</div>";
    if (empty($message)) {
        return $additional_message;
    } else {
        return $message . $additional_message;
    }
}
예제 #2
0
function setting_admin_menu_roles_callback()
{
    global $menu;
    mf_enqueue_script('script_admin_menu_wp', plugin_dir_url(__FILE__) . "script_wp.js");
    $setting_key = get_setting_key(__FUNCTION__);
    $option = get_option($setting_key);
    $arr_data = get_settings_roles(array('default' => true, 'custom_name' => true, 'none' => true));
    echo "<div id='admin_menu_roles'>";
    if (count($menu) > 0) {
        if (!in_array('profile.php', $menu)) {
            $menu[71] = array(0 => __("Profile", 'lang_admin_menu'), 1 => 'read', 2 => 'profile.php');
        }
        foreach ($menu as $item) {
            if ($item[0] != '') {
                //$item_name = strip_tags($item[0]);
                //$item_name = trim(preg_replace("/(\<span(.*)\<\/span\>)/is", "", $item[0]));
                $update_count = get_match("/(\\<span.*\\<\\/span\\>)/is", $item[0], false);
                $item_name = trim(str_replace($update_count, "", $item[0]));
                $item_capability = $item[1];
                $item_url = $item[2];
                $option_temp = $item_url . '|' . $item_name;
                if (!(is_array($option) && count($option) > 0 && isset($option[$option_temp]))) {
                    echo "<div class='flex_flow tight'>" . show_textfield(array('value' => $item_name)) . input_hidden(array('value' => $item_url)) . show_select(array('data' => $arr_data, 'name' => "setting_admin_menu_roles[" . $option_temp . "]", 'value' => $item_capability)) . "</div>";
                }
            }
        }
    }
    if (is_array($option) && count($option) > 0) {
        foreach ($option as $key => $value) {
            list($item_url, $item_name) = explode('|', $key);
            echo "<div class='flex_flow tight'>" . show_textfield(array('value' => $item_name)) . input_hidden(array('value' => $item_url)) . show_select(array('data' => $arr_data, 'name' => "setting_admin_menu_roles[" . $key . "]", 'value' => $value)) . "</div>";
        }
    }
    echo "</div>";
}
예제 #3
0
function show_profile_users($user)
{
    $arr_remove = array();
    $option = get_option('setting_remove_profile_fields');
    if (is_array($option) && count($option) > 0) {
        foreach ($option as $remove) {
            $arr_remove[$remove] = true;
        }
    }
    $option = get_option('setting_add_profile_fields');
    if (is_array($option) && count($option) > 0) {
        $out = "";
        if (in_array('phone', $option)) {
            $meta_key = 'profile_phone';
            $meta_value = get_the_author_meta($meta_key, $user->ID);
            $meta_text = __('Phone Number', 'lang_users');
            $out .= "<tr class='" . str_replace("_", "-", $meta_key) . "-wrap'>\n\t\t\t\t<th><label for='" . $meta_key . "'>" . $meta_text . "</label></th>\n\t\t\t\t<td>" . show_textfield(array('name' => $meta_key, 'value' => $meta_value, 'xtra' => "class='regular-text'")) . "</td>\n\t\t\t</tr>";
        }
        if (in_array('profile_picture', $option)) {
            $arr_remove['profile_picture'] = true;
            $meta_key = 'profile_picture';
            $meta_value = get_the_author_meta($meta_key, $user->ID);
            $meta_text = __('Profile Picture', 'lang_users');
            $out .= "<tr class='" . str_replace("_", "-", $meta_key) . "-wrap'>\n\t\t\t\t<th><label for='" . $meta_key . "'>" . $meta_text . "</label></th>\n\t\t\t\t<td>" . get_file_button(array('setting_key' => $meta_key, 'option' => $meta_value)) . "</td>\n\t\t\t</tr>";
        }
        if (in_array('edit_page_per_page', $option)) {
            $meta_key = 'edit_page_per_page';
            $meta_value = get_the_author_meta($meta_key, $user->ID);
            $meta_text = __('Rows per page', 'lang_users');
            $out .= "<tr class='" . str_replace("_", "-", $meta_key) . "-wrap'>\n\t\t\t\t<th><label for='" . $meta_key . "'>" . $meta_text . "</label></th>\n\t\t\t\t<td>" . show_textfield(array('type' => 'number', 'name' => $meta_key, 'value' => $meta_value)) . "</td>\n\t\t\t</tr>";
        }
        /*if(in_array('password', $option))
        		{
        			$arr_remove['password'] = true;
        
        			$meta_key = 'profile_password';
        			$meta_text = __('New Password', 'lang_users');
        
        			$out .= "<tr class='".str_replace("_", "-", $meta_key)."-wrap'>
        				<th><label for='".$meta_key."'>".$meta_text."</label></th>
        				<td>".show_password_field(array('name' => $meta_key, 'placeholder' => __("Enter a new password here", 'lang_users'), 'xtra' => "class='regular-text'"))."</td>
        			</tr>";
        		}*/
        if ($out != '') {
            echo "<table class='form-table'>" . $out . "</table>";
        }
    }
    if (count($arr_remove) > 0) {
        mf_enqueue_script('script_users', plugin_dir_url(__FILE__) . "script_remove.js", $arr_remove);
    }
}