vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Activity Modification (https://vborg.vbsupport.ru/showthread.php?t=93831)

WetWired 01-13-2006 02:21 PM

Quote:

Originally Posted by Live Wire
Add a new hook to global_start with this code:

PHP Code:

$user['activity'] = intval($vbulletin->userinfo['wwu002activity'] / $GLOBALS['WWU002maxPoints'] * 100) . '%'

Now that should make it so you can use $user[activity] in any template.

Almost. Your code doesn't take into account the first visit of the day, where the data in userinfo may not be up to date yet. This code should handle that situation:
Code:

if(isset($WWU002activityPoints)){
  $user['activity']=intval($WWU002activityPoints/$WWU002maxPoints*100).'%'; 
}else if($vbulletin->userinfo['userid']){
  $user['activity']=intval($vbulletin->userinfo['wwu002activity']/$WWU002maxPoints*100).'%'; 
}else{//(isset($WWU002activityPoints))
  $user['activity']='N/A';
}//endif(isset($WWU002activityPoints))


Lance Carbuncle 01-27-2006 12:27 AM

Well, I got the activity to show up on my Welcome block thanks to everyone's help here....

Would it be possible to integrate this with usergroup promotions? I am trying to find a way to only allow active users the ability to post in the free classifieds (photopost classifieds) which is integrated with vbulletin usergroups...

For example.... only people who maintain a 20% activity level would be included in a custom usergroup, and if their activity falls below this, they drop out of the usergroup until their activity increases to the set level again....... I now require XX amounts of posts to be able to use the classifieds, but find people just post junk until they reach this level and then stop contributing... This feature would take care of that problem....

I know this might be asking a lot....but i am willing to hire someone to do this if it is possible within reason.... Anyone? I think this would be an awesome feature that coule be used in many ways. I also would not have to keep it to myself if someone wants to code it and share it on my dime.

Thanks, Lance

WetWired 01-27-2006 03:51 AM

At one point, I had started work on such a system, but I accidentally wiped it out. The biggest issue is with demotions. A user's activity only gets updated when they visit or when their posts or profile is viewed. This means that it's possible to come back after a month of inactivity and have the old usergroup untill the next time promotions are run. It is, of course, possible to just do activity for everyone at once, however the process would be very server intensive, which is why I do it the way it is now.

Glad to hear that you got it sorted out on your own; sorry I hadn't gotten the chance to look into it for you yet.

luroca 01-27-2006 11:47 AM

Quote:

Originally Posted by WetWired
A user's activity only gets updated when they visit or when their posts or profile is viewed. This means that it's possible to come back after a month of inactivity and have the old usergroup untill the next time promotions are run. It is, of course, possible to just do activity for everyone at once, however the process would be very server intensive

Perhaps with a diary cron this issue can be solved?
If promotion/demotion can be added to this hack I?ll install it.

In any case, excellent hack :)

Lance Carbuncle 01-27-2006 02:46 PM

Quote:

Originally Posted by WetWired
A user's activity only gets updated when they visit or when their posts or profile is viewed. This means that it's possible to come back after a month of inactivity and have the old usergroup untill the next time promotions are run. It is, of course, possible to just do activity for everyone at once, however the process would be very server intensive, which is why I do it the way it is now.

Thanks for the feedback WetWired... I am having a little trouble understanding what you are saying here, so maybe you can comment one more time........When are the promotions run now? Is this part of your script, or a vbulletin action.... Would it be possible to run a promotion check for a single user upon there visit, or is the problem that vbulletin would have to run all promotions to check one? (I am speaking al a layperson here and have no idea of coding or how things work, just a mechanic's view of the computer world LOL) Could vbulletin be set to run promotions once every evening for all users at a user set time (low visit period) if it uses a lot of resources?


OOps.... reading it again, I guess it would be the activity you would want to run a scheduled update for? and then promotions?

Thanks Again, Lance

nexus851 01-31-2006 07:30 AM

in my post_legacy graphic... under longevity, it says this:

"User has been a member for 76114f the board's existence....etc.."

Why does it say "76114f"???? shouldnt that be a variable of some kind, i followed the instructions, but it still says it... sometimes it says another large number, but basically it seems like i left a variable out or something, any ideas????

NEVERMIND, fixed! thanks!

nexus851 01-31-2006 08:12 AM

Quote:

Originally Posted by WetWired
Almost. Your code doesn't take into account the first visit of the day, where the data in userinfo may not be up to date yet. This code should handle that situation:
Code:

if(isset($WWU002activityPoints)){
  $user['activity']=intval($WWU002activityPoints/$WWU002maxPoints*100).'%'; 
}else if($vbulletin->userinfo['userid']){
  $user['activity']=intval($vbulletin->userinfo['wwu002activity']/$WWU002maxPoints*100).'%'; 
}else{//(isset($WWU002activityPoints))
  $user['activity']='N/A';
}//endif(isset($WWU002activityPoints))


i tried using the code above to add to my welcome block, but it doesnt seem to work. It gives me a "0%"....

I set the code as a plugin in global_start hook and used the variable "$user[activity]" in my template but just only gives me 0%


anyone know why it doesnt work?

username12 01-31-2006 10:03 PM

Answered my own question.

mrcrx 02-01-2006 12:00 PM

I installed the file as it said. It shows up as active and it shows up in the admin control panel also. but I dont see anything on the forum. Any help. Im very new at this.

nexus851 02-03-2006 12:54 AM

Quote:

Originally Posted by WetWired
Almost. Your code doesn't take into account the first visit of the day, where the data in userinfo may not be up to date yet. This code should handle that situation:
Code:

if(isset($WWU002activityPoints)){
  $user['activity']=intval($WWU002activityPoints/$WWU002maxPoints*100).'%'; 
}else if($vbulletin->userinfo['userid']){
  $user['activity']=intval($vbulletin->userinfo['wwu002activity']/$WWU002maxPoints*100).'%'; 
}else{//(isset($WWU002activityPoints))
  $user['activity']='N/A';
}//endif(isset($WWU002activityPoints))



help, this doesnt work when i use $user[activity] in my template.. it just spits out "0"...... i did everything requested above.. anyone help please!


All times are GMT. The time now is 09:16 PM.

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.01254 seconds
  • Memory Usage 1,757KB
  • 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
  • (3)bbcode_code_printable
  • (1)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete