vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Averaging Data held in 3 User profile fields (https://vborg.vbsupport.ru/showthread.php?t=99896)

Aceman 11-02-2005 11:16 AM

Averaging Data held in 3 User profile fields
 
I currently am developing a system on my forums that will help establish a users experience level as it relates to 3D graphics.

I will be using three custom proflie fields for base values. They are:

Modeling
Texturing
Animation

I would like to average these three values (1-10 scale for each) and establish an overall experience value that I can display.

This is a photoshop mockup:
http://www.scifi-meshes.com/sample_gold5.gif

The OVERALL (3D) bar will be a value based on the values entered in the MTA areas. (M + T + A / 30 * 10 = Value)

Example:
M(4) + T(8) + A(8) / 30 * 10 = 6.6 Rounded up would be a 7

Assume:

M = Field10 (Number from 1 - 10)
T = Field11 (Number from 1 - 10)
A = Field12 (Number from 1 - 10)
Overall = the average of these fields

Is it possible to average data held in the Custom Profile Fields to a whole value (1 - 10).

1. I am unsure how to code so the value is rounded to a whole value. (1,2,3, etc)
2. I then want to display an image (see example) that corresponds to the averaged value.

Can anyone help me?
Aceman

Marco van Herwaarden 11-02-2005 12:54 PM

Not tested but try something like:

Add a new plugin on postbit_display_complete hook with teh following code:
PHP Code:

$post['overall'] = round(($post['field10'] + $post['field11'] + $post['field12']) / 3); 

Then use $post[overall] in your postbit template.

This is not tested, so you might have to tweak it a little.

Aceman 11-02-2005 03:47 PM

This worked PERFECTLY!

THANK YOU!

Aceman

Marco van Herwaarden 11-02-2005 03:49 PM

Glad to be able to help you.


All times are GMT. The time now is 09:09 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01022 seconds
  • Memory Usage 1,724KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete