Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $lang = get_bloginfo('language'); // 'en-US';
- ?>
- <script src="<?php bloginfo('template_url'); ?>/profile/jquery.js" type="text/javascript"></script>
- <script src="<?php bloginfo('template_url'); ?>/profile/ajaxupload.js" type="text/javascript"></script>
- <?php if($_SERVER["HTTP_HOST"] == 'localhost') : ?>
- <link href="style.css" rel="stylesheet" type="text/css" />
- <link rel="stylesheet" href="profile/style.css" type="text/css" />
- <?php endif ?>
- <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/profile/style.css" type="text/css" />
- <script>
- $(document).ready(function(){
- $('#p_picture').hide(); //, 'label[for=#p_picture]'
- $("label.p_picture").hide();
- var thumb = $('img#thumb');
- new AjaxUpload('imageUpload', {
- action: '<?php bloginfo('template_url'); ?>/profile/upload.php', //$('form#picture').attr('action'),
- name: 'qqfile',
- onSubmit: function(file, extension) {
- $('div.preview').addClass('loading');
- },
- onComplete: function(file, response) {
- var response_ajax = '<?php bloginfo('wpurl'); ?>/wp-content/uploads/'+response;
- $("#p_picture").val(response);
- thumb.load(function(){
- $('div.preview').removeClass('loading');
- thumb.unbind();
- });
- thumb.attr('src', response_ajax);
- //alert(response_ajax);
- }
- });
- $("#profileDeleteForm").click(function() {
- $(this).remove();
- });
- $("#profileDeleteForm").confirm({
- msg:'Do you really want to delete this button?',
- timeout:3000
- });
- });
- function deletechecked(message)
- {
- var answer = confirm(message)
- if (answer){
- document.messages.submit();
- }
- return false;
- }
- </script>
- <style>
- div.preview { float: left; width: 200px; height: 150px; margin:5px; border: 1px solid #CCCCCC; }
- div.preview.loading { background: url(<?php bloginfo('template_url'); ?>/profile/images/loading.gif) no-repeat 90px 65px; }
- div.preview.loading img {display: none; }
- </style>
- <?php do_shortcode('[theme-my-login login_template="login-templates/login-form.php" register_template="login-templates/register-form.php" lostpassword_template="login-templates/lostpassword-form.php" resetpass_template="login-templates/resetpass-form.php" user_template="login-templates/user-panel.php" profile_template="login-templates/profile-form.php" before_widget="" after_widget="" before_title="" after_title="" show_reg_link="false"]'); ?>
- <?php edit_post_link('Edit', ' | ', ' | '); ?>
- <div class="main-subject">
- <?php if($lang == 'en-US'): ?>
- Welcome to resume creation wizard,..
- <?php else: ?>
- Özgeçmiş oluşturma sihirbazına hoşgeldiniz,..
- <?php endif; ?>
- </div>
- <?php if(!is_user_logged_in()) : ?>
- <?php if($lang == 'en-US'): ?>
- <div class="main-text">
- To continue, please <a href="<?php echo home_url(); ?>/login?action=register"><strong>register</strong></a>, to our website,<br />
- if you are already registered, please<b> <a href="<?php echo home_url(); ?>/login">login</a></b> to your account.
- </div>
- <?php else: ?>
- <div class="main-text">
- Özgeçmiş bilgilerini oluşturmanız için,
- Sitemize <a href="<?php echo home_url(); ?>/login?action=register"><strong>üye olmalı</strong></a>,<br />
- üye iseniz<b> <a href="<?php echo home_url(); ?>/login">kullanıcı girişi</a></b> yapmanız gerekmektedir.
- </div>
- <?php endif; ?>
- <?php else : ?>
- <div class="main-text">
- <?php
- //Save Function
- require_once( dirname(__FILE__) . '/../../plugins/magic-fields/RCCWP_Post.php' );
- //Picture Upload Function
- require_once( dirname(__FILE__) . '/../../plugins/magic-fields/RCCWP_WritePostPage.php' );
- global $metaData;
- function check_profile(){
- global $post, $current_user, $post_category, $post_title, $post_content, $post_id, $profileData, $metaData, $lang;
- if($lang == 'en-US'){ $text = 'Profile'; } else{ $text = 'Profil'; }
- $post_category = get_cat_ID($text);
- $profileData = query_posts('author='.$current_user->ID.
- '&post_type=post&post_status=publish&posts_per_page=1&orderby=date&order=DESC&cat='.$post_category.'');
- if ( have_posts() ) : while ( have_posts() ) : the_post(); //echo $post->ID;
- $post_title = get_the_title();
- $post_content = get_the_content();
- $post_id = $post->ID;
- endwhile; else:
- //echo "Lutfen once profilinizi olusturun";
- endif;
- }
- function get_form_data(){
- //Get post verileri varsa burada topluyoruz
- global $_SERVER, $_POST, $_GET;
- if(empty($_POST)){ $data = $_GET; }else{ $data = $_POST; }
- foreach ($data as $k=>$v){
- $vars[$k] = $v; //echo $k.': '; echo $v.'<br />';
- }
- //var_dump($vars);
- return $vars;
- }
- //Form verilerini alalim.
- $formData = get_form_data();
- //Veritabanina yazmak icin butun verileri alalim.
- check_profile();
- // Check if the form was submitted
- if( $_SERVER['REQUEST_METHOD'] == 'POST' && !empty( $formData['post_action'] )) {
- if($formData['post_action'] == 'delete'){ //wp_delete_post( $post_id, $force_delete = 1 )
- if(wp_delete_post( $post_id, $force_delete = 1 ))
- { echo $post_id.' id\'li profiliniz silinmistir.'; }
- else { echo "Bir hata olustu islem tamamlanamadi."; }
- }
- // Add the content of the form to $post as an array
- $post = array(
- 'post_title' => $formData['post_title'],
- 'post_content' => $formData['post_content'],
- 'post_category' => array($formData['post_category']), // Usable for custom taxonomies too
- 'tags_input' => $formData['post_tags'],
- 'post_status' => 'publish', // Choose: publish, preview, future, etc.
- 'post_type' => $formData['post_type'], // Use a custom post type if you want to,
- 'post_name' => $post_id.'-'.$formData['post_title'] // Sluq
- );
- if(empty($profileData)){
- if($lang == 'en-US'){ echo "<h2>Your resume has been created.</h1>"; }
- else{ echo "<h2>Profiliniz oluşturuldu.</h1>"; }
- $new_id = wp_insert_post($post); // Pass the value of $post to WordPress the insert function
- RCCWP_Post::SaveCustomFields($new_id);
- }
- else{
- if($lang == 'en-US'){ echo "<h2>Your profile has been updated.</h2>"; }
- else{ echo "<h2>Profiliniz güncellendi.</h2>"; }
- $post['edit_date'] = true;
- $post['ID'] = $post_id;
- //$post['post_content'] = 'This is the updated content.';
- //print_r( $post );
- wp_update_post($post);
- RCCWP_Post::SaveCustomFields($post_id);
- //wp_publish_post($post['ID']);
- }
- }
- //Yeni eklenen verileri alalimki asagidaki formu yeni verilerle sunalim.
- check_profile();
- if($lang == 'en-US'){ echo "Welcome, <b>".$current_user->user_login."</b><br \>"; }
- else{ echo "Hoşgeldin, <b>".$current_user->user_login."</b><br \>"; }
- if(empty($profileData)){
- if($lang == 'en-US'){ echo 'Currently there are no resume, please create your resume.'; }
- else{ echo 'Henüz özgeçmişini oluşturmamışsın,
- <br />Lütfen özgeçmişinizi oluşturunuz.'; }
- }
- $bUrl = get_bloginfo('wpurl');
- if($bUrl == "http://localhost/atol2"){ $mf_panel_id = 3; $mf_group_id = 13; }
- else{ $mf_panel_id = 1; $mf_group_id = 2; }
- ?>
- </div>
- <!-- New Post Form -->
- <div class="main-subject">
- <?php if($lang == 'en-US'): ?>
- Resume details,...
- <?php else: ?>
- Özgeçmiş detayları,...
- <?php endif; ?>
- </div>
- <div class="main-text">
- <form action="?" id="profileForm" name="profileForm" method="POST">
- <input type='hidden' name='rc-custom-write-panel-verify-key' id='rc-custom-write-panel-verify-key' value='<?php echo wp_create_nonce('rc-custom-write-panel'); ?>'/>
- <input type='hidden' name='rc-cwp-change-custom-write-panel-id' id='rc-cwp-change-custom-write-panel-id' value='<?php echo $mf_panel_id; ?>' />
- <input type='hidden' name='rc-cwp-custom-write-panel-id' id='rc-cwp-custom-write-panel-id' value='<?php echo $mf_panel_id; ?>' />
- <input type='hidden' name='magicfields_remove_files' id='magicfields_remove_files' value=''/>
- <input type="hidden" name="post_action" value="post" />
- <input type="hidden" name="post_category" id="post_category" value="<?php echo $post_category; ?>" />
- <!--<input type="hidden" name="npost_type" id="npost_type" value="post" /> -->
- <label for="post_title">
- <?php if($lang == 'en-US'): ?>
- Your profession followed by your name and surname
- <br /><small>example: Captain Yavuz Porsuk</small>
- <?php else: ?>
- Varsa Ünvanınız, Adınız Soyadınız
- <small>Örn: Kaptan Yavuz Porsuk</small>
- <?php endif; ?>
- </label>
- <br />
- <input type="text" id="post_title" name="post_title" value="<?php echo $post_title; ?>" tabindex="1" size="22" />
- <br clear="all" />
- <label for="post_content">
- <?php
- if($lang == 'en-US'){ echo 'A short description about yourself and your references'; }
- else{ echo 'Kendiniz hakkında kısa özgeçmiş (Referanslarınız),'; }
- ?>
- </label>
- <br />
- <textarea id="post_content" name="post_content" tabindex="3" cols="50" rows="6"><?php echo $post_content; ?></textarea>
- <br clear="all" />
- <div id="picture" class="container">
- <div class="preview">
- <?php if(get('p_picture')): ?>
- <img id="thumb" width="200px" height="150px" src="<?php echo bloginfo('template_url').'/wp-t/?w=200&h=150&src='.get('p_picture'); ?>" />
- <?php else: ?>
- <img id="thumb" width="200px" height="150px" src="<?php bloginfo('template_url'); ?>/profile/images/captain-icon.png" />
- <?php endif ?>
- </div>
- <label>
- <?php if($lang == 'en-US'): ?>
- Photo uploader,<br />
- <font color="#FF0000"><b>Please upload a decent photo with uniform </b></font>
- <br />Please choose a photo from your computer
- <?php else: ?>
- Resim yükleme sihirbazı,<br />
- <font color="#FF0000"><b>Üniformalı resmi olmayanların cv'si yayınlanmayacaktır.</b></font>
- <br />Lütfen bilgisayarınızdan bir resim seçiniz.
- <?php endif; ?>
- </label>
- <br />
- <input type="file" id="imageUpload" size="20" value="" />
- <button type="submit" class="button">Save</button>
- <noscript>
- <?php
- if($lang == 'en-US'){ echo 'To upload a picture please enable javascript in your browser'; }
- else{ echo '<p>Resim yüklemek için Browser\'inizin JavaScript özelliğinin aktif olması gerekir.</p>'; }
- ?>
- <!-- or put a simple form for upload here -->
- </noscript>
- </div>
- <br clear="all" />
- <?php
- $customFields = RCCWP_CustomGroup::GetCustomFields($mf_group_id);
- foreach($customFields as $customField) {
- $customFieldValue = get($customField->name);
- $customFieldLabel = get($customField->description);
- if(empty($customFieldValue)){ $customFieldValue = $customField->default_value; }
- if($customField->type == 'Textbox'){
- echo '<label for="'.$customField->name.'">'.$customField->description.'</label><br />';
- echo '<input type="text" name="magicfields['.$customField->name.'][1][1]" id="'.$customField->name.'" value="'.$customFieldValue.'" />';
- echo '<br clear="all" />';
- }
- elseif($customField->type == 'Multiline Textbox'){
- echo '<label for="'.$customField->name.'">'.$customField->description.'</label><br />';
- echo '<textarea name="magicfields['.$customField->name.'][1][1]" id="'.$customField->name.'">'.$customFieldValue.'</textarea>';
- echo '<br clear="all" />';
- }
- elseif($customField->type == 'Dropdown List'){
- echo '<label for="'.$customField->name.'">'.$customField->description.'</label><br />';
- echo '<select name="magicfields['.$customField->name.'][1][1]" style="width:250px;">'."\n";
- $dropDownListDefaultValues = $customField->options;
- foreach($dropDownListDefaultValues as $defaultValue){
- $selected = ' ';
- if($defaultValue == $customFieldValue)
- { $selected = ' selected="selected "'; }
- echo '<option value="'.$defaultValue.'"'.$selected.'>'.$defaultValue.'</option>';
- }
- echo '</select>';
- echo '<br clear="all" />';
- }
- elseif($customField->type == 'Checkbox List'){
- echo '<label for="'.$customField->name.'">'.$customField->description.'</label><br />';
- $dropDownListDefaultValues = $customField->options;
- foreach($dropDownListDefaultValues as $defaultValue){
- $selected = ' ';
- if(in_array($defaultValue, $customFieldValue))
- { $selected = ' checked="checked" '; }
- echo '<label for="magicfields['.$customField->name.'][1][1]_'.$defaultValue.'">'.$defaultValue;
- echo '<input name="magicfields['.$customField->name.'][1][1][]" id="magicfields['.$customField->name.'][1][1]_'.$defaultValue.'" type="checkbox" value="'.$defaultValue.'"'.$selected.'/></label>';
- }
- echo '<br clear="all" />';
- }
- elseif($customField->type == 'Listbox'){
- echo '<label for="'.$customField->name.'">'.$customField->description.'</label><br />';
- $dropDownListDefaultValues = $customField->options;
- echo '<select id="magicfields_'.$customField->name.'_1_1" name="magicfields['.$customField->name.'][1][1][]" multiple="multiple" size="3" style="width:250px; height: auto;">';
- foreach($dropDownListDefaultValues as $defaultValue){
- $selected = ' ';
- if(in_array($defaultValue, $customFieldValue))
- { $selected = ' selected="selected" '; }
- echo '<option value="'.$defaultValue.'"'.$selected .'>'.$defaultValue.'</option>';
- }
- echo '</select>';
- echo '<br clear="all" />';
- }
- elseif($customField->type == 'Radiobutton List'){
- echo '<label for="'.$customField->name.'">'.$customField->description.'</label><br />';
- $dropDownListDefaultValues = $customField->options;
- foreach($dropDownListDefaultValues as $defaultValue){
- $selected = ' ';
- if($defaultValue == $customFieldValue)
- { $selected = ' checked="checked" '; }
- echo '<label for="magicfields['.$customField->name.'][1][1]_'.$defaultValue.'">'.$defaultValue;
- echo '<input id="magicfields['.$customField->name.'][1][1]_'.$defaultValue.'" name="magicfields['.$customField->name.'][1][1]" value="'.$defaultValue.'" '.$selected.' type="radio"></label>';
- }
- echo '<br clear="all" />';
- }
- else { "Boyle bir input hazirlamamisim, buyuk ihtimalle sacma sapan gereksiz bir input sectin."; }
- }
- echo "<pre>";
- //pr($customFields);
- echo "</pre>";
- // print_r( get_group('profil'));
- //
- // //$customField = RCCWP_CustomField::Get(184);
- //
- // //print_r($customField);
- //
- // $customFields = RCCWP_CustomGroup::GetCustomFields(13);
- // $mf_post_id = $post_id;
- // $groupCounter = 1;
- // $customGroup->id = 13;
- //
- // foreach($customFields as $field){
- // //RCCWP_WritePostPage::CustomFieldInterface($field->id,1,1,1);
- // if(isset($mf_post_id)){
- // $fc = RCCWP_CustomField::GetFieldDuplicates($mf_post_id,$field->name,$groupCounter);
- // $fields_order = RCCWP_CustomField::GetFieldsOrder($mf_post_id,$field->name,$groupCounter);
- // foreach($fields_order as $element){
- // RCCWP_WritePostPage::CustomFieldInterface($field->id,$groupCounter,$element,$customGroup->id);
- // }
- // }else{
- // RCCWP_WritePostPage::CustomFieldInterface($field->id,$groupCounter,1,$customGroup->id);
- // $fc = 1;
- // }
- // }
- ?>
- <?php wp_nonce_field('profileForm'); ?>
- <?php if($lang == 'en-US'){ $text = 'Save Profile'; } else{ $text = 'Profilimi Kaydet'; } ?>
- <input type="submit" id="submit" name="submit" value="<?php echo $text; ?>" tabindex="6" />
- </form>
- </div>
- <!--// New Post Form -->
- <form id="profileForm" name="profileForm" method="POST" action="?">
- <input type="hidden" name="post_action" value="delete" />
- <?php wp_nonce_field('delete-post'); ?>
- <?php if($lang == 'en-US'){ $text = 'Delete My Profile'; } else{ $text = 'Profilimi Sil'; } ?>
- <?php if($lang == 'en-US'){ $text2 = 'Are you sure?'; } else{ $text2 = 'Devam Etmek istiyormusunuz?'; } ?>
- <p align="right"><input type="submit" id="submit" name="submit" onclick="return deletechecked('<?php echo $text2; ?>');" value="<?php echo $text; ?>" tabindex="6" /></p>
- </form>
- <?php endif ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement