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-07-2008, 01:12 AM
keith1995 keith1995 is offline
 
Join Date: Sep 2007
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default usergroupid variable not working on profile.php page

What we are trying to accomplish is that our client has some members of their site that are Advisory board members that do not have the necessary credentials/information to fill out the required member filters of the profile. These members should still have to fill in the standard required fields of name, email, etc but they should not be forced to fill out any of the member filters.

We've been able to edit the global.php file to include this code:

PHP Code:
// #############################################################################
// check required profile fields
if ($vbulletin->session->vars['profileupdate'] AND THIS_SCRIPT != 'login' AND THIS_SCRIPT != 'profile')
{
 
$vbulletin->options['useforumjump'] = 0;
 
 if (
$vbulletin->userinfo['usergroupid'] == '9') {
  if (empty(
$vbulletin->userinfo['field6']) OR empty($vbulletin->userinfo['field7']) OR empty($vbulletin->userinfo['field9']) OR empty($vbulletin->userinfo['field12'])) {
  eval(
standard_error(fetch_error('updateprofilefields'$vbulletin->session->vars['sessionurl'])));
  }
 }
 
 else {
 eval(
standard_error(fetch_error('updateprofilefields'$vbulletin->session->vars['sessionurl'])));
 }

This has allowed us to create a new usergroup which we will use for those members that have the okay to bypass the member filters in the user profile however it will require them to fill in a value for First Name ('field6'), Last Name ('field7'), Firm Name ('field9') and Chapter ('field12').

The problem I have run into is centered around the profile.php page. With the various member filters being required fields, if one of these users tries to edit their profile vBulletin won't let them as it will detect required fields as not being filled out. I thought I'd be able to use code similar to the above to bypass the profile.php page's required field check which appears to be housed inside the class_dm_user.php page. I've tried to use this code:

PHP Code:
// check for empty required fields
   
if (($profilefield['required'] == OR $profilefield['required'] == 3) AND $value === false AND $verify)
   {
    if (
$vbulletin->userinfo['usergroupid'] == '9') {
    }
    
    else {
    
$this->error('required_field_x_missing_or_invalid'$profilefield['title']); }
   }
   
$this->setfields["$varname"] = true;
   
$this->userfield["$varname"] = htmlspecialchars_uni($value);
  }
  
$this->dbobject->free_result($profilefields);
  return 
$customfields;
 } 
The problem is that I can't get the profile.php?do=updateprofile action to recognize the 'usergroupid' variable. I've tried all types of different calls and have tried to print each variable to this page without any luck.

Can anyone assist me or has anyone already put together a mod that accomplishes what we are trying to do here?
Reply With Quote
  #2  
Old 02-07-2008, 10:50 AM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Inside a class you need to use $this->registry->userinfo instead of $vbulletin->userinfo
Reply With Quote
  #3  
Old 02-07-2008, 04:28 PM
keith1995 keith1995 is offline
 
Join Date: Sep 2007
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Opserty,

Thanks for that. Another question about variables. Is there anyway to get a variable to display within a vBulletin phrase? For example, the Standard Phrase: updateprofilefields, Varname $vbphrase[updateprofilefields], if I wanted to update the link that shows up for "profile page" so it went to a specific user page referenced by the userid, how would I do that? I've tried the following:

PHP Code:
You have empty profile fields that are required to be filled inPlease visit your <a href="http://www.lisiserver.com/pecfoa/site/vb/profile.php?u=$this->registry->userinfo['userid']">profile page</ato update these fields
But the link shows the $this->registry->userinfo['userid'] as opposed to the userid from the database.
Reply With Quote
  #4  
Old 02-07-2008, 04:49 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Use this for the phrase code:
Code:
You have empty profile fields that are required to be filled in. Please visit your <a href="http://www.lisiserver.com/pecfoa/site/vb/profile.php?u={0}">profile page</a> to update these fields.
And this PHP code:
PHP Code:
$thephrase construct_phrase('thephrasename'$this->registry->userinfo['userid']); 
Reply With Quote
  #5  
Old 02-07-2008, 05:04 PM
keith1995 keith1995 is offline
 
Join Date: Sep 2007
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Opserty,

Where does the PHP code get added?
Reply With Quote
  #6  
Old 02-07-2008, 05:45 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Erm, wherever your doing the rest of the PHP stuff will be fine. It just needs to be done before it comes to the fetch_template() bit. (You need to use $thephrase in your template to get it displayed.)
Reply With Quote
  #7  
Old 02-07-2008, 05:51 PM
keith1995 keith1995 is offline
 
Join Date: Sep 2007
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Opserty,

Thanks for the constant replies. I'm a bit confused here. The updateprofilefields phrase is called inside the global.php page when vBulletin recognizes that a required field is empty. What I need to do is change the link that shows up in the phrase text. I've edited the phrase code as you detailed above but now I'm not quite sure where the PHP code goes. Inside global.php, I have this code:

PHP Code:
// #############################################################################
// check required profile fields
if ($vbulletin->session->vars['profileupdate'] AND THIS_SCRIPT != 'login' AND THIS_SCRIPT != 'profile')
{
    
$vbulletin->options['useforumjump'] = 0;
    
    if (
$vbulletin->userinfo['usergroupid'] == '9') {
        if (empty(
$vbulletin->userinfo['field6']) OR empty($vbulletin->userinfo['field7']) OR empty($vbulletin->userinfo['field9']) OR empty($vbulletin->userinfo['field12'])) {
        eval(
standard_error(fetch_error('updateprofilefields'$vbulletin->session->vars['sessionurl'])));
        }
    }
    
    else {
    eval(
standard_error(fetch_error('updateprofilefields'$vbulletin->session->vars['sessionurl'])));
    }

Where should the PHP code go and how do I make the call to $thephrase in conjunction to the eval(standard_error(fetch_error('updateprofilefiel ds', $vbulletin->session->vars['sessionurl']))); code that is already in there calling the 'updateprofilefields' phrase?
Reply With Quote
  #8  
Old 02-09-2008, 03:35 PM
keith1995 keith1995 is offline
 
Join Date: Sep 2007
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Opserty,

Any ideas on where the PHP code should go to get the userid to work in the phrase?
Reply With Quote
  #9  
Old 02-09-2008, 07:30 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What is the content of the 'updateprofilefields' phrase? {0} will be the first variable, {1} will be the 2nd variable. e.t.c..

Edit fetch_error to include the 2nd variable...so
PHP Code:
...fetch_error('...'$first$second); 
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 03:22 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.04122 seconds
  • Memory Usage 2,269KB
  • 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
  • (1)bbcode_code
  • (6)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete