Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-14-2006, 01:25 AM
Quarterbore Quarterbore is offline
 
Join Date: Mar 2005
Location: Valley Forge PA
Posts: 538
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default PLS Help: How to add Scheduled Task to run Update User Titles and Ranks script when:

I have subscriptions in my forums for people that donate to the website. The subscriptions work fine but I have noticed that after the subscription ends the member is pulled from the "contributor group" but they still have a contributor title in their member name.

This is sure to cause confusion as their PM, Attachments, and PhotoPost limits are higher as a contributor, plus they have access to some "Members Only" forums.

So, what I need is a way to run a "Scheduled Task" to ping the "Update User Titles and Ranks" script that we have in the "Update Counters" area of the Admin CP.

Can someone advise how I might be able to add a task to do this and I assume there would be no problems with having the server do this at least once a day...

Thanks!

p.s. I did try VB.com but they said to try here:

http://www.vbulletin.com/forum/showt...38#post1073338

Now, until someone suggest how to do this I am going to disect the code here:

In /admincp I see the file /usertitle.php which has a section:


Code:
// ###################### Start do update #######################
if ($_POST['do'] == 'doupdate')
{

	$vbulletin->input->clean_array_gpc('p', array(
		'title'    => TYPE_STR,
		'minposts' => TYPE_UINT
	));

	if (empty($vbulletin->GPC['title']))
	{
		print_stop_message('invalid_user_title_specified');
	}

	$db->query_write("
		UPDATE " . TABLE_PREFIX . "usertitle
		SET title = '" . $db->escape_string($vbulletin->GPC['title']) . "',
		minposts = " . $vbulletin->GPC['minposts'] . "
		WHERE usertitleid = " . $vbulletin->GPC['usertitleid'] . "
	");

	define('CP_REDIRECT', 'usertitle.php?do=modify');
	print_stop_message('saved_user_title_x_successfully', $vbulletin->GPC['title']);
In Misc.php I find a few bits of code that must be related to this:

Code:
// ###################### Start user choices #######################
if ($_REQUEST['do'] == 'chooser')
{
	print_form_header('misc', 'updateuser');
	print_table_header($vbphrase['update_user_titles'], 2, 0);
	print_input_row($vbphrase['number_of_users_to_process_per_cycle'], 'perpage', 1000);
	print_submit_row($vbphrase['update_user_titles']);
Now, the server delivered HTML code for this MISC script that does the Update of User titles looks like this (copied from a right click of admin CP)

Code:
	<script type="text/javascript">
	<!--
	var SESSIONHASH = "";
	function set_cp_title()
	{
		if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown' && typeof(parent.document.title) == 'string')
		{
			parent.document.title = (document.title != '' ? document.title : 'vBulletin');
		}
	}
	//-->
	</script>
	<script type="text/javascript" src="../clientscript/vbulletin_global.js"></script>

</head>
<body style="margin:0px" onload="set_cp_title();">
<div class="pagetitle">Maintenance</div>
<div style="margin:10px">
<!-- END CONTROL PANEL HEADER -->


<!-- form started:6 queries executed -->
<form action="misc.php" name="cpform" method="post">
<input type="hidden" name="do" value="updateuser" />
<br />
<table cellpadding="4" cellspacing="0" border="0" align="center" width="90%" class="tborder">
<tr>
	<td class="tcat" align="center" colspan="2">
		<div style="float:right"><a class="helplink" href="#" onclick="js_open_help('misc', 'chooser', ''); return false;">Help <img src="../cpstyles/vBulletin_3_Default/cp_help.gif" alt="" border="0" title="Click for help on these options" style="vertical-align:middle" /></a></div>
		<b>Update User Titles and Ranks</b>
	</td>
</tr>
<tr valign="top">
	<td class="alt1">Number of users to process per cycle</td>
	<td class="alt1"><table cellpadding="0" cellspacing="0" border="0" width="100%"><tr valign="top"><td><input type="text" class="bginput" name="perpage" id="it_perpage" value="1000" size="35" dir="ltr" tabindex="1" /></td><td align="right" style="padding-left:4px"><a class="helplink" href="#" onclick="js_open_help('misc', 'chooser', 'perpage'); return false;"><img src="../cpstyles/vBulletin_3_Default/cp_help.gif" alt="" border="0" title="Click for help on this option" /></a> </td></tr></table></td>
</tr>
<tr>
	<td class="tfoot" colspan="2" align="center">	<input type="submit" class="button" tabindex="1" value="Update User Titles and Ranks" accesskey="s" />
	<input type="reset" class="button" tabindex="1" value=" Reset  " accesskey="r" />
</td>
</tr>
</table>
</form>
<!-- form ended: 6 queries executed -->
Note, I don't know java but it looks to be like this code is working with the java to do the work... if so, I guess I will never figure this out without some Java help!
Reply With Quote
  #2  
Old 02-22-2006, 07:34 PM
Quarterbore Quarterbore is offline
 
Join Date: Mar 2005
Location: Valley Forge PA
Posts: 538
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I still need some help with programing this sceduled task....

Even if it was some help coming up with a small php file that acts like the original request so that when the CRON gets done it pings the PHP script that causes the work to be done....

I am sure others could use this as well....
Reply With Quote
  #3  
Old 02-22-2006, 07:55 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

just copy one of the existing scripts in the includes/cron directory, and work from there.
Reply With Quote
  #4  
Old 02-22-2006, 08:27 PM
Quarterbore Quarterbore is offline
 
Join Date: Mar 2005
Location: Valley Forge PA
Posts: 538
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yea, I am trying... I am prety sure I know what I need to do I just can't figure out the code to do it yet.... I assume I need to get the value "updateuser" to the "admincp/misc.php" script. I believe I need to do this with the variable "cpform"... (this from the code above)

I know it is the right section of code as I put the form in my main index.php file and it pinged the script and ran the user update as I need... The problem is it works in the forum but I need it out of the form.

I will grow grey trying to figure this out with my PHP books and random pinging away with code... but one day I will figure it out (I think) ... :ermm:

I think this tidbit of info might be along the line of what I need...

http://www.alt-php-faq.org/local/55/#id55

Then there is this:

http://www.phpbuilder.com/board/show...php?t=10317131
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:51 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.03679 seconds
  • Memory Usage 2,205KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete