Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases

Reply
 
Thread Tools
Force Current Members To Fill Out Required Profile Field Details »»
Force Current Members To Fill Out Required Profile Field
Version: 2.0.0, by calorie calorie is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Version: 3.0.7 Rating:
Released: 09-09-2004 Last Update: 06-08-2005 Installs: 31
 
No support by the author.

So you add a new required profile field, and members who join afterwards are forced to fill out the field, but you want your current members to fill out that field too. Well unless your current members go edit their profile, the new field sits and waits for them to take action. This mini hack will force your current members to fill out the field by prompting them for action before allowing them to return to normal site use. Here are some further details:
  • Credit is given to Revan from this post.
  • Credit is given to Locutus2999 from this thread.
  • Related vB 2.2.x from roxics in this thread.
  • Here based off the vB 2.3.x hack by Locutus2999.
  • This is for vB 3.0.7 though rather similar indeed.
  • Add one phrase, edit one file, set profile field.
  • Support only if/as time available, no guarantees.
  • Should you install, say thanks by clicking install.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 09-11-2004, 08:06 PM
integra99's Avatar
integra99 integra99 is offline
 
Join Date: Jun 2003
Location: Indiana
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

First, open the STANDARD_ERROR template, and copy it to a new template named zzzz_emptyreqfields. Then replace $errormessage with
Code:
There are new required profile field(s) since your last visit: click <a href="profile.php?$session[sessionurl]do=editprofile">$vbphrase[edit_profile]</a> to update.
Then edit global.php and add the following code right before the end of the file, i.e., right before the last ?>
Code:
if ($bbuserinfo['userid'] AND $bbuserinfo['userid'] > 1) {
	if (!empty($_SERVER["REQUEST_URI"])) {                  ///// check your phpinfo
		$zzzz_noise = $_SERVER["REQUEST_URI"];            ///// check your phpinfo
	}
	else { $zzzz_noise = "zzzz"; }
	$zzzz_regex = "(profile\.php|usercp\.php)";
	if (!eregi($zzzz_regex,$zzzz_noise)) {
		$zzzz_reqfields = $DB_site->query("SELECT * FROM ".TABLE_PREFIX."profilefield WHERE required=1");
		if ($DB_site->num_rows($zzzz_reqfields)) {
			while ($zzzz_reqfield = $DB_site->fetch_array($zzzz_reqfields)) {
				$zzzz_ufields = $DB_site->query_first("SELECT * FROM ".TABLE_PREFIX."userfield WHERE userid='$bbuserinfo[userid]'");
				$zzzz_fieldname = "field$zzzz_reqfield[profilefieldid]";
				$zzzz_field = $zzzz_ufields[$zzzz_fieldname];
				if (empty($zzzz_field)) {
					$zzzz_templatename = "zzzz_emptyreqfields";
					eval('print_output("' . fetch_template($zzzz_templatename) . '");');
					exit;
				}
			}
		}
	}
}
Note: you may not have $_SERVER["REQUEST_URI"] on your machine so check phpinfo and use an applicable $_SERVER element.
Reply With Quote
  #13  
Old 09-11-2004, 08:59 PM
calorie calorie is offline
 
Join Date: May 2003
Posts: 2,804
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks integra99! Hopefully the required steps are now more clear for others. BTW, here is a mini script to check for other applicable $_SERVER elements.
PHP Code:
<?php

if (isset($_SERVER['REQUEST_URI'])) {
  echo 
"\$_SERVER['REQUEST_URI'] = ".$_SERVER['REQUEST_URI']."<br><br>";
}
if (isset(
$_SERVER['SCRIPT_FILENAME'])) {
  echo 
"\$_SERVER['SCRIPT_FILENAME'] = ".$_SERVER['SCRIPT_FILENAME']."<br><br>";
}
if (isset(
$_SERVER['SCRIPT_URI'])) {
  echo 
"\$_SERVER['SCRIPT_URI'] = ".$_SERVER['SCRIPT_URI']."<br><br>";
}
if (isset(
$_SERVER['SCRIPT_URL'])) {
  echo 
"\$_SERVER['SCRIPT_URL'] = ".$_SERVER['SCRIPT_URL']."<br><br>";
}
if (isset(
$_SERVER['SCRIPT_NAME'])) {
  echo 
"\$_SERVER['SCRIPT_NAME'] = ".$_SERVER['SCRIPT_NAME']."<br><br>";
}
if (isset(
$_SERVER['PATH_TRANSLATED'])) {
  echo 
"\$_SERVER['PATH_TRANSLATED'] = ".$_SERVER['PATH_TRANSLATED']."<br><br>";
}
if (isset(
$_SERVER['PHP_SELF'])) {
  echo 
"\$_SERVER['PHP_SELF'] = ".$_SERVER['PHP_SELF']."<br><br>";
}

?>
Reply With Quote
  #14  
Old 10-11-2004, 04:57 AM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very useful. Is there a way to tell it to look only for some required field? I want birthdays, gender and country only. Unfortunately the weather hack has a required field (required when you select the weather) and that force people to choose it too. Perhaps a conditionals if condition required and different than weather field?
Reply With Quote
  #15  
Old 10-28-2004, 03:21 AM
calorie calorie is offline
 
Join Date: May 2003
Posts: 2,804
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try changing...
PHP Code:
$zzzz_reqfields $DB_site->query("SELECT * FROM ".TABLE_PREFIX."profilefield WHERE required=1"); 
To the following...
PHP Code:
$zzzz_reqfields $DB_site->query("SELECT * FROM ".TABLE_PREFIX."profilefield WHERE required=1 AND profilefieldid NOT IN(1,2,3)");

// where 1,2,3 are from the fieldX names and X is a number (see the vB User Profile Field Manager for fieldX names) 
Reply With Quote
  #16  
Old 10-30-2004, 03:14 AM
xg3 xg3 is offline
 
Join Date: Jan 2004
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Calorie, your suggestion didn't work...it keeps sending me to the error page even after I have filled in the require field. Can you find another solution?
Reply With Quote
  #17  
Old 11-10-2004, 10:44 AM
theArchitect's Avatar
theArchitect theArchitect is offline
 
Join Date: Sep 2004
Location: Sydney
Posts: 417
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

*theArchitect clicks install*.

Nice hack, and very useful.

Only one problem. When I add the necessary code to the global.php file I can't update anything. I first get sent to a page saying that there are new profile fields that I need to fill out and when I click on the link I get told that I need to fill out new profile fields before i can browse the forum. So I end up in a new profile field loop.

I decided to add the code to the index.php page instead and this works fine. Though people can still use the rest of the forum if they choose to ignore the prompt. Do you know what I did wrong?
Reply With Quote
  #18  
Old 12-01-2004, 11:32 PM
CuriousGeorge CuriousGeorge is offline
 
Join Date: Oct 2004
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am planning on implementing this hack into my boards. Yet, I am wondering if its possible to add onto it slightly.

I want a profile field such as "I Agree to post by the rules" that everyone has to fill out. However, if a user choses 'no' I want their account to be placed ina usergroup that will not let them post until they choose 'yes' in their profile field.

Any guidance on how I can go about accomplishing this? Thanks.
Reply With Quote
  #19  
Old 12-11-2004, 01:51 PM
Bison's Avatar
Bison Bison is offline
 
Join Date: Jun 2002
Location: Virginia Beach, Virginia
Posts: 522
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by CuriousGeorge
I am planning on implementing this hack into my boards. Yet, I am wondering if its possible to add onto it slightly.

I want a profile field such as "I Agree to post by the rules" that everyone has to fill out. However, if a user choses 'no' I want their account to be placed ina usergroup that will not let them post until they choose 'yes' in their profile field.

Any guidance on how I can go about accomplishing this? Thanks.
I might suggest this:

add a condition that checks the value from that field after submission, if the value is "NO" ... then change that users groupid to the groupid you want.

if zzz_customfield = 'NO'{ bbusergroupid = 10};
Reply With Quote
  #20  
Old 12-15-2004, 12:19 PM
T3MEDIA T3MEDIA is offline
 
Join Date: Dec 2004
Posts: 944
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by integra99
Note: you may not have $_SERVER["REQUEST_URI"] on your machine so check phpinfo and use an applicable $_SERVER element.
how do you know what element to use???
Reply With Quote
  #21  
Old 12-15-2004, 12:34 PM
T3MEDIA T3MEDIA is offline
 
Join Date: Dec 2004
Posts: 944
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I get a heavy loop. Dont know what is up. Wish I could use this baby.
Reply With Quote
Reply

Thread Tools

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 02: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.04713 seconds
  • Memory Usage 2,320KB
  • Queries Executed 25 (?)
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
  • (2)bbcode_code
  • (3)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete