vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Force Current Members To Fill Out Required Profile Field (https://vborg.vbsupport.ru/showthread.php?t=69270)

calorie 09-09-2004 10:00 PM

Force Current Members To Fill Out Required Profile Field
 
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.

mtha 09-10-2004 01:58 AM

Great idea, I will give a careful look at this one.


... hmm the idea is good, but the code looks like a mess and the instruction is not clear. is this a complete clean one?

Johnny 09-10-2004 02:02 AM

hmm, nice one. this might come handy for me

calorie 09-10-2004 06:02 AM

>> ...is this a complete clean one?

Hmm, got it running on my vB, no probs. If you find a prob with the code, just post.

>> ...might come handy for me

Maybe handy for verification purposes, community interaction, who knows what else.

???`S?LV?R???` 09-10-2004 07:11 AM

nice... this will definitly come in use

integra99 09-10-2004 10:20 AM

/me clicks install

rex_b 09-10-2004 02:30 PM

Those instructs are horrible. Can anyone clean that up?

colicab-d 09-10-2004 05:25 PM

Nice IDea, though Id personally use a little Javascript to alert users torequired profile fields on registration, maybe via alerts. I may actaully do that and add this hack as abckup for already reged users or someone maybe on a aolder browser whos bypassed the Js

joeychgo 09-10-2004 07:22 PM

THANK YOU for the hack!!!!!!!! Exactly what I need.

Hope I can figure out how to install it...............

calorie 09-11-2004 07:41 PM

>> Those instructs are horrible. Can anyone clean that up?

Horrible? Are you offering? :D

integra99 09-11-2004 08:06 PM

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.

calorie 09-11-2004 08:59 PM

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>";
}

?>


Lionel 10-11-2004 04:57 AM

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?

calorie 10-28-2004 03:21 AM

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) 


xg3 10-30-2004 03:14 AM

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?

theArchitect 11-10-2004 10:44 AM

*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?

CuriousGeorge 12-01-2004 11:32 PM

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.

Bison 12-11-2004 01:51 PM

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};

T3MEDIA 12-15-2004 12:19 PM

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???

T3MEDIA 12-15-2004 12:34 PM

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

T3MEDIA 12-18-2004 02:05 AM

:::bump:::

T3MEDIA 01-06-2005 03:41 AM

uninstall to the extream

mkdevo 02-28-2005 11:46 AM

does this work in 3.07?

i tried installing, wanting to make 'birthday' a required field.. but when i go to the user profile field manager, there's nothing there..

??

T3MEDIA 03-13-2005 11:06 PM

wow see this is how you know this site isnt moderated properly. hacks listed with no support, coder disapears.... and its here like the sunshine for a next poor sap to use.

that was my negitive post.
now my question...

anyone bothered with this? Would love to hear how people got this baby to work.

Marco van Herwaarden 03-14-2005 03:38 AM

Quote:

Originally Posted by T3MEDIA
wow see this is how you know this site isnt moderated properly. hacks listed with no support, coder disapears.... and its here like the sunshine for a next poor sap to use.

that was my negitive post.
now my question...

anyone bothered with this? Would love to hear how people got this baby to work.

Well the coder indicated that no support will be given, so i don't see your problem.

Revan 03-15-2005 06:26 AM

Ok, if no support is given, I will post my clean, optimised code when I get home.
The main issue that made my stomach turn about this hack is that it is loop querying the profilefield table to check if it is set, when everybody knows that all this info is contained in the $bbuserinfo variable :p
I got it down to adding 1 query (the one to check whether or not a field is required, if Im not too much mistaken) :)

Revan 03-15-2005 06:35 PM

This is my revised code, and it seems to work OK. It goes in place of the original global.php edit:
PHP Code:

if ($bbuserinfo['userid'] AND $bbuserinfo['userid'] > 1
{
    
$regex "(profile\.php|usercp\.php)";
    if (!
eregi($regex$_SERVER['REQUEST_URI'])) 
    {
        
$reqfields $DB_site->query("SELECT * FROM " TABLE_PREFIX "profilefield WHERE required = 1");
        if (
$DB_site->num_rows($reqfields))
        {
            while (
$reqfield $DB_site->fetch_array($reqfields)) 
            {
                
$fieldname "field$reqfield[profilefieldid]";
                
$field $bbuserinfo["$fieldname"];
                if (empty(
$field))
                {
                    eval(
'print_output("' fetch_template('STANDARD_ERROR_PROFILEFIELD') . '");');
                    die;
                }
            }
        }
    }


STANDARD_ERROR_PROFILEFIELD is in place of "zzzz_emptyreqfields", I just thought that was a stupid name so I made something more vBish.

T3MEDIA 03-15-2005 09:52 PM

Quote:

Originally Posted by MarcoH64
Well the coder indicated that no support will be given, so i don't see your problem.

Thats good! I am glad you dont see any problems I have enough as it is.

T3MEDIA 03-15-2005 09:54 PM

Quote:

Originally Posted by Revan
This is my revised code, and it seems to work OK. It goes in place of the original global.php edit:

Finally a man to step up to the plate. I will test it first and let you know.
if you can do magic with zero tols mass PM that would be a god send as well.
dam thing just stopped working.
Yeah I know its not in this thread but who IS in this thread?

checkin your stuff now bro.

T3MEDIA 03-15-2005 10:14 PM

works. may sound crazy but how can you have this exclude the year of birth or birday entirely? thanks. but it works I personallly just need a slight mod

Revan 03-16-2005 05:51 AM

To do this, change the query in the hack to:
[sql]$DB_site->query("SELECT * FROM `" . TABLE_PREFIX . "profilefield` WHERE `required` = '1' AND `title` NOT LIKE 'Age'");[/sql]
Just replace "Age" with the title of whatever profilefield you want to exclude. Find these titles in the AdminCP Profile Field Manager.

T3MEDIA 03-17-2005 03:46 AM

Quote:

Originally Posted by Revan
To do this, change the query in the hack to:
[sql]$DB_site->query("SELECT * FROM `" . TABLE_PREFIX . "profilefield` WHERE `required` = '1' AND `title` NOT LIKE 'Age'");[/sql]
Just replace "Age" with the title of whatever profilefield you want to exclude. Find these titles in the AdminCP Profile Field Manager.

HEY! wow thanks! It didnt work though. See I dont have age in my Profile manager since its part of vb internally.

I dont even know where to look for the name of the birthday location.
Just so you know I am talking about the birthday users have to answer when they register.

Revan 03-17-2005 07:17 AM

It seems like the Birthday is not listed in the profilefield table, at which point what you are asking is impossible without adding further queries.
Not to mention me having no idea how it would be done.

And I also have to wonder, why would you want to exclude birthdays?
If you have it mandatory on register, then it will already be filled out, and wont trigger this mod.

T3MEDIA 03-17-2005 04:43 PM

Quote:

Originally Posted by Revan
It seems like the Birthday is not listed in the profilefield table, at which point what you are asking is impossible without adding further queries.
Not to mention me having no idea how it would be done.

And I also have to wonder, why would you want to exclude birthdays?
If you have it mandatory on register, then it will already be filled out, and wont trigger this mod.

Exactly. Previous users do not have it filled.
(I dont know why people on vb always doubt a question... but ok) so your looking at around 5000 users with this field blank. and around 7000 or so that do have it. But the profile page does not have it available. (next hack installed) But hey this hack is doing what it says.... awsome. so you have to do a db query to STOP the year result in this hack? maybe we are not hitting each other.

Jan 3rd 1980 <--- The year on the site I wanted to use your awsome hack with has the year un editable. so the field is there.

T3MEDIA 03-26-2005 10:38 AM

Quote:

Originally Posted by Revan
To do this, change the query in the hack to:
[sql]$DB_site->query("SELECT * FROM `" . TABLE_PREFIX . "profilefield` WHERE `required` = '1' AND `title` NOT LIKE 'Age'");[/sql]
Just replace "Age" with the title of whatever profilefield you want to exclude. Find these titles in the AdminCP Profile Field Manager.

Revan do to some asking around I found out The user's birthday is stored in the user.birthday field. How would I do this (ignore this area) with your hack?

Thanks bro.

Revan 03-28-2005 05:31 PM

Well the thing is, if the Birthday is not listed as a Required profilefield in that table, it will be ignored automatically :)

T3MEDIA 03-28-2005 11:52 PM

Its not that is why I responded as I did remember?

how could I make your code work with the position of the field in the database?

Thanks in advance.

rjordan 05-05-2005 02:16 PM

Finally found this thing... I knew I saw it somewhere! Now I suppose I should install per the "cleaned up" code, huh...

TwinsForMe 05-12-2005 01:48 PM

/me clicks install with Revan's revised code.

mamboking 05-17-2005 01:01 PM

excellent hack!!!! exactly what i have been looking for since i changed to vb.

this should be standard..............


All times are GMT. The time now is 06:35 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.01599 seconds
  • Memory Usage 1,855KB
  • 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
  • (2)bbcode_code_printable
  • (4)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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