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 06-29-2009, 06:24 AM
UltimateOreo! UltimateOreo! is offline
 
Join Date: Nov 2006
Location: Missouri
Posts: 462
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default User Profile Fields

Is it possible that a user profile field only be editable by select usergroups?

I don't want anybody other than these select groups to be able to edit this profile field.
Reply With Quote
  #2  
Old 06-29-2009, 01:53 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not with the default vbulletin code, no. You would have to write some code to do that and I'm not really sure how complicated (or perhaps easy) it may be.
Reply With Quote
  #3  
Old 06-29-2009, 03:27 PM
DragonBlade's Avatar
DragonBlade DragonBlade is offline
 
Join Date: May 2006
Posts: 189
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey, buddy, you're in luck.

I recently made something so that our "GFX Crew" usergroup can "class" a user (which changes their "field25" value) in a form at the top of a thread within a specific forum. I'll post the code here and let you peruse it at your leisure.



Plugin 1: "Display Classing Form in Classification Forum"
Hook Location: "showthread_post_start"
Plugin Code:
PHP Code:
if ($thread['forumid'] == 156 AND is_member_of($vbulletin->userinfo6,44))
{
  
$classed_user fetch_userinfo($thread['postuserid']);
  eval(
'$poll .= "' fetch_template('gfx_classing_poll') . '";');

Brief Explaination: Just takes the Form that I made into a template and appends it to the "$poll" variable. It's a cheap and dirty hack, I guess, but it works.

Note the "$forumid == 156" bit--that's because that's the only forum I wanted to allow them to do this in.

Note the "is_member_of()" bit. "6" is Admin, and "44" is the usergroup in question (our GFX Crew).



Plugin 2: "Class User and Move thread"
Hook Location: "showthread_start"
Plugin Code:
PHP Code:
if ($vbulletin->input->clean_gpc('p''gfx_class'TYPE_BOOL) AND ($forumid == 156) AND is_member_of($vbulletin->userinfo6,44))
{
  
$gfx_class =& $vbulletin->input->clean_gpc('p''field25'TYPE_STR);
  switch(
$gfx_class)
  {
    case 
'6'$iconid 0;  break;
    case 
'1'$iconid 18; break;
    case 
'2'$iconid 20; break;
    case 
'3'$iconid 19; break;
    case 
'4'$iconid 17; break;
    case 
'5'$iconid 21; break;
    default; eval(
print_standard_redirect('There has been an unspecified error.  Contact Sarteck.'falsetrue)); die; break;
  }

  
$gfx_userid =& $vbulletin->input->clean_gpc('p''gfx_userid'TYPE_INT);
  
$gfx_user fetch_userinfo($gfx_userid);
  if (!
$gfx_user) {eval(print_standard_redirect('There has been an unspecified error.  Contact Sarteck.'falsetrue)); die;}


  
// Class User
  
$userfield = array('field25' => $gfx_class);
  
$userman =& datamanager_init('User'$vbulletinERRTYPE_STANDARD);
  
$userman->set_existing($gfx_user);
  
$test $userman->set_userfields($userfieldfalse'admin');
  
$userman->save();

  
// Move Thread
  
require_once(DIR '/includes/functions_log_error.php');
  require_once(
DIR '/includes/functions_threadmanage.php');
  require_once(
DIR '/includes/functions_databuild.php');
  
$destforumid 157;
  
$destforuminfo fetch_foruminfo($destforumid);
  
$threadman =& datamanager_init('Thread'$vbulletinERRTYPE_STANDARD'threadpost');
  
$threadman->set_info('skip_moderator_log'true);
  
$threadman->set_existing($threadinfo);
  
$threadman->set('title'$threadinfo['title'], truefalse);
  
$threadman->set('forumid'$destforuminfo['forumid']);
  
$threadman->set('sticky'0);
  
$threadman->set('iconid'$iconid);
  
$threadman->save();
  
log_moderator_action($threadinfo'thread_moved_to_x'$destforuminfo['title']);
  
delete_post_cache_threads(array($threadinfo['threadid']));
  
build_forum_counters($threadinfo['forumid']);
  
build_forum_counters($destforuminfo['forumid']);

  
$phrase $gfx_user['musername'] . ' has been Classed.  Moving thread and redirecting to Classification forum.';
  
$vbulletin->url "forumdisplay.php?f=156" $vbulletin->session->vars['sessionurl'];
  eval(
print_standard_redirect($phrasefalsetrue));

Note the "$forumid == 156" bit--that's because that's the only forum I wanted to allow them to do this in.

Note the "is_member_of()" bit. "6" is Admin, and "44" is the usergroup in question (our GFX Crew).

Field 25 is the field in question on the userfield table.

The "switch($gfx_class)" bit was only for assigning a specific icon to the thread, and you'll likely not need to worry about it (i.e., you can get rid of it).

The bit under "// Class User" creates a User datamanager, and saves field25's new value. The bit under "// Move Thread" creates a Thread datamanager and moves the thread appropriately.

The rest just redirects.



If you've got questions, ask.



Oh, and here's the template I called for the form, if you wanted to take a gander...

HTML Code:
<!-- gfx_classing_poll :: GFX Classing system, written for Tess by Sarteck -->
<form method="post">
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
<input type="hidden" name="gfx_class" value="1" />
<input type="hidden" name="gfx_userid" value="$thread[postuserid]" />

<div class="tborder" style="padding: 4px;">
  <div style="width: 100%;">
    <div style="float: left; width: 50%; text-align: right;">
      <span style="font-variant: small-caps; margin-right: 20px;">Tess Classing System</span>
    </div>
    <div style="float: left; width: 25%;">
      <select name="field25" style="width: 90%; margin-left: auto; margin-right: auto; text-align: center;">
        <option value="6"<if condition="$classed_user['field25'] == 'Terribad!'"> selected="selected"</if>>Terribad!'</option>
        <option value="1"<if condition="$classed_user['field25'] == 'Beginner'"> selected="selected"</if>>Beginner</option>
        <option value="2"<if condition="$classed_user['field25'] == 'Amateur'"> selected="selected"</if>>Amateur</option>
        <option value="3"<if condition="$classed_user['field25'] == 'Experienced'"> selected="selected"</if>>Experienced</option>
        <option value="4"<if condition="$classed_user['field25'] == 'Advanced'"> selected="selected"</if>>Advanced</option>
        <option value="5"<if condition="$classed_user['field25'] == 'Professional'"> selected="selected"</if>>Professional</option>
      </select>
    </div>
    <div style="float: left; width: 25%;">
      <input type="submit" value="Class this user" style="width: 90%; margin-left: auto; margin-right: auto; text-align: center;" />
    </div>
    <div style="clear: both;"> </div>
  </div>
</div>

</form>



Yar, I think that was all of it.

(And no, I am not Tess, I wrote it for Tess. xP)
Reply With Quote
  #4  
Old 06-29-2009, 11:20 PM
UltimateOreo! UltimateOreo! is offline
 
Join Date: Nov 2006
Location: Missouri
Posts: 462
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You're a life-saver. Thanks a lot for the help.
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 02:17 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.04825 seconds
  • Memory Usage 2,237KB
  • 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_html
  • (2)bbcode_php
  • (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