null, ), $atts, 'register_form' ) ); // set this to true so the CSS is loaded $ambprog_load_css = true; // check to make sure user registration is enabled $registration_enabled = get_option('users_can_register'); // only show the registration form if allowed if( $registration_enabled ) { $output = ambprog_registration_form_fields( $redirect ); } else { $output = __('User registration is not enabled'); } return $output; }else{ return '

You are logged in already and registered already.

'; } } add_shortcode('register_form', 'ambprog_registration_form'); /** * Shortcode that displays the user login form * * @return [type] [description] */ function ambprog_login_form( $atts, $content = null ) { if(!is_user_logged_in()) { global $ambprog_load_css; extract( shortcode_atts( array( 'redirect' => null, ), $atts, 'login_form' ) ); // set this to true so the CSS is loaded $ambprog_load_css = true; $output = ambprog_login_form_fields( $redirect ); } else { // could show some logged in user info here $output = '

You\'re already logged in!

'; } return $output; } add_shortcode('login_form', 'ambprog_login_form'); /** * Create Project Form * * @return [type] [description] */ function ambprog_create_project_form( $atts, $content = null ) { if(is_user_logged_in()) { global $current_user, $ambprog_load_css; $ambprog_load_css = true; // print_r( $current_user ); ob_start(); if( isset( $_GET['post'] ) ) { switch( $_GET['post'] ) { case 'successful': echo '

' . __('Project created', 'ambprog') . '

'; break; case 'failed' : echo '

' . __('Please fill in all the info', 'ambprog') . '

'; break; } } ?>






You must be logged into submit a project.

'; } return $output; } add_shortcode('submit_project_form', 'ambprog_create_project_form'); function ambprog_dashboard( $atts, $content = null ) { if( is_user_logged_in() ) { global $post, $current_user, $ambprog_load_dashboard_css; $ambprog_load_dashboard_css = true; ob_start(); $profile_args = array( 'post_status' => array( 'publish', 'pending' ), 'post_type' => 'ambprog_projects', 'nopaging' => true, 'author' => $current_user->ID ); $profile_query = new WP_Query( $profile_args ); $user_meta = get_userdata( $current_user->ID ); $register_date = $user_meta->user_registered; $register_date_formatted = date( 'F j, Y', strtotime( $register_date ) ); if( $profile_query->have_posts() ) : ?>
Total referrals:
ID ) ); ?>
Total earned:
$ID ); ?> since
+ New Project
have_posts() ) : $profile_query->the_post(); ?>
Referral/Org Name Date Submitted Project Cost Project Commission Last Note Progress
pending approval post_date ); // post's creation date in seconds since Epoch, so we're comparing apples to apples $one_day_in_seconds = 24*60*60; if ( ( $now - $post_created ) < $one_day_in_seconds ) { echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; } else { the_time( 'j F Y' ); } ?> ID ); ?> 'approve', 'number' => '1', 'post_id' => get_the_ID(), // use post_id, not post_ID ); $comments = get_comments( $args ); if( $comments ) : foreach($comments as $comment) : echo $comment->comment_content; endforeach; else : ?> Referral Received In process

You have not submitted any projects/referrals

Log in to view your dashboard'; } return $output; } add_shortcode('referral_dashboard', 'ambprog_dashboard');