Hoomanhpc2 74 ارسال شده در اردیبهشت 93 گزارش بازنشر ارسال شده در اردیبهشت 93 (ویرایش شده) سلام. من خیلی جستجو کردم اما متأسفانه نتونستم اون چیزی که میخوام رو پیدا کنم. سوالم این بود که چطور میشه مشخصات زیر رو تو قسمتی از قالب نشون داد؟ (منظور از کاربر فعلی کاربر وارد شده هست)- تعداد نوشته (پست تایپ، مثلا learn) های کاربر فعلی- تعداد نوشته (پست تایپ، مثلا learn) های در انتظار بررسی کاربر فعلی- تعداد دیدگاه های ارسال شده توسط کاربر فعلیممنون ویرایش شده اردیبهشت 93 توسط Hoomanhpc2 نقل قول لینک به ارسال
imanfakhar 26231 ارسال شده در اردیبهشت 93 گزارش بازنشر ارسال شده در اردیبهشت 93 در فایل functions.php function get_user_pending($user_ID,$post_type){ global $wpdb; $pending = $wpdb->get_results("select * from ".$wpdb->prefix."posts where post_type='$post_type' and post_status='pending' and post_author='$user_ID'"); $get_user_pending = count($pending); if($get_user_pending == 0){ return false; } else{ return $get_user_pending; }}function get_user_publish($user_ID,$post_type){ global $wpdb; $publish = $wpdb->get_results("select * from ".$wpdb->prefix."posts where post_status='publish' and post_type='$post_type' and post_author='$user_ID'"); $get_user_publish = count($publish); if($get_user_publish ==0){ return false; } else{ return $get_user_publish; }}function get_user_comment_count($user_ID){global $wpdb;$where = 'WHERE comment_approved = 1 AND user_id = '.$user_ID;$comment_counts = $wpdb->get_results("SELECT user_id, COUNT( * ) AS totalFROM {$wpdb->comments}{$where}GROUP BY user_id", object);if ($comment_counts[0]->total > 0 ){return $comment_counts[0]->total;}else{return 0;}}در محل نمایش <?phpif(is_user_logged_in()) {$get_user_publish_count = get_user_publish_countt($user_ID,'learn');$get_user_pending_count = get_user_publish_count($user_ID,'learn');$user_comment_count = get_user_comment_count($user_ID);?>مطالب آموزشی منتشر شده شما: <?php echo $get_user_publish_count; ?><br>مطالب آموزشی در انتظار تایید شما: <?php echo $get_user_pending_count; ?><br>نظرات شما: <?php echo $user_comment_count; ?><?php } ?>این آموزش را هم بخوانید [sharedmedia=tutorials:tutorials:536] 2 نقل قول لینک به ارسال
Hoomanhpc2 74 ارسال شده در اردیبهشت 93 مالک گزارش بازنشر ارسال شده در اردیبهشت 93 (ویرایش شده) خیلی ممنون! ولی وقتی کدهارو اضافه کردم ارور داد. اول متوجه شدم که تو کد دومی count دوتا t داشت که یکیشو حذف کردم. ولی باز مشکل حل نشد!Fatal error: Call to undefined function get_user_publish_count() in F:\Program Files\xampp\htdocs\wordpress\wp-content\themes\template\sidebar.php on line 13 ویرایش شده اردیبهشت 93 توسط Hoomanhpc2 نقل قول لینک به ارسال
پست های پیشنهاد شده
به گفتگو بپیوندید
هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .