| Re: Estimate profile completeness |
| by mjoel on 2021/5/15 13:55:27 i would like to try this where do we exactly put this code ? is it still working?, im using xoops 2.5.10 and php 7.3 i tried putting it in php block but i got Error : Error: Call to a member function getVar() on null |
| Re: Estimate profile completeness |
| by irmtfan on 2012/8/21 6:13:09 very nice code deka87 i will test this hack tomorrow. |
| Re: Estimate profile completeness |
| by deka87 on 2012/8/17 14:04:59 jimmyx, below is the full code : le="color: #000000"><?php // ===================== Profile completeness hack =============================== // $uid = $thisUser->getVar('uid'); $query_c = "SELECT * FROM " . $xoopsDB -> prefix( "profile_profile" ) . " WHERE profile_id = '$uid'"; $result_c = $xoopsDB -> query ($query_c ); $all_rows = $xoopsDB -> fetchArray( $result_c ); $num_rows = count( $all_rows ); $full_rows = array_diff($all_rows,array(NULL)); $num_full_rows = count ( $full_rows ); $perc = floor($num_full_rows*100/$num_rows); $xoopsTpl->assign('compl', $perc); // Colors if ( $perc < 25 ) { $class = 'warning'; } elseif ( $perc >= 25 && $perc < 50 ) { $class = 'danger'; } elseif ( $perc >= 50 && $perc < 75 ) { $class = 'info'; } else { $class = 'success'; } $xoopsTpl->assign('class', $class); // ==================== End of profile completeness hack ===================================== // where warning, info, success, and danger are my css classes for the progress bar. You must put this code in userinfo.php before the le="color: #000000"><?php include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'footer.php'; ?> Deka |
| Re: Estimate profile completeness |
| by jimmyx on 2012/8/17 13:08:45 nice deka... can you show the full code ? how did you made the background color for the percent ? |
| Re: Estimate profile completeness |
| by deka87 on 2012/8/17 8:00:32 Looks pretty nice, IMO
|