vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   vB Staff Titles (https://vborg.vbsupport.ru/showthread.php?t=93783)

Xplorer4x4 02-08-2006 02:20 AM

Quote:

Originally Posted by Wild-Wing
well ive achieved that i think. but cant post hack till i get approval from live wire

As long as your not releasing it on your own(like in a new thread) you can post it in this thread.


Well....I'm not looking to add group specific "user titles"..i already have the default User Title system...

Quote:

Let me give you the example through my orum...I run a big Music forum and I have a group for "Musicians"...What i'm trying to do is lets say...add 2-3 additional custom profile fields such as "Instrument Played", "Band Name"..etc etc...the idea is..when they give an input of these fields from their UserCP, the fields will be displayed in the postbit (doesn't matter where in postbit). The only problem I'm having is that the fields are UNIVERSAL and not group specefic...anyone and add the input and it will be showed...I want to have different criteria for different groups..

Any kind of help would be appriciated...
Just had an idea. Set up multiple user groups, and then allow them to be publicly joinable, and set ranks(inturment title) per usergroup.

Wild-Wing 02-08-2006 02:45 PM

ill release the code here
admin cp code
Code:

<?php

/*======================================================================*\
|| #################################################################### ||
|| # Staff Titles Hack Version 1.0.0                                      # ||
|| # ---------------------------------------------------------------- # ||
|| #                          # ||
|| # PHP Code by:  Wild-Wing                                # ||
|| #  ||
|| #                        # ||
|| #################################################################### ||
\*======================================================================*/

// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// ##################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', 'staff_titles_admin');
define('STAFFTITLE_VERSION', '1.0.0');

// #################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array('');

// ########################## REQUIRE BACK-END ############################
require_once('./global.php');

// ############################# LOG ACTION ###############################
//log_admin_action();
log_admin_action(($_REQUEST['usergroupid'] != 0 ? "usergroupid = ".$_REQUEST['usergroupid'] : ''));

print_cp_header("Staff Title  ".STAFFTITLE_VERSION." Admin");

if (!isset($_REQUEST['do']) || empty($_REQUEST['do'])) {
        $_REQUEST['do'] = "dotitles";
}

// ##################### LIST ALL STAFF TITLES ########################
if ($_REQUEST['do'] == "dotitles") {
       
       
        print_form_header('staff_titles_admin', 'nowhere');
        print_table_header("Staff Titles Admin");
        print_description_row("You can change usergroup staff titles here.");
        $grouptitle = $db->query_read("SELECT usergroupid, title, staffrank AS stafftitle, staffrank_opentag AS opentag, staffrank_closetag AS closetag FROM ".TABLE_PREFIX."usergroup order by usergroupid asc");
        while ($groupstitle = $db->fetch_array($grouptitle)) {
                print_form_header('staff_titles_admin', 'set_update');
                construct_hidden_code('usergroupid', $groupstitle['usergroupid']);
                construct_hidden_code('usergroup', $groupstitle['title']);
                print_table_header($groupstitle['title']." ID: ". $groupstitle['usergroupid']);
        //        print_yes_no_row($vbphrase['enable_staff_title'], 'groupstitle[isstaffrank]', $groupstitle['isstaffrank']);
                print_input_row($vbphrase['staff_title'], 'staffrank', $groupstitle['stafftitle']);
                print_label_row($vbphrase['staff_title_markup'],
        '<span style="white-space:nowrap">
        <input size="15" type="text" class="bginput" name="opentag" value="' . htmlspecialchars_uni($groupstitle['opentag']) . '" tabindex="1" />
        <input size="15" type="text" class="bginput" name="closetag" value="' . htmlspecialchars_uni($groupstitle['closetag']) . '" tabindex="1" />
        </span>', '', 'top', 'htmltags');
                print_submit_row("Set Usergroup Staff Title");
        }
        print_table_footer();
}

if ($_REQUEST['do'] == "set_update") {
$staffrank = $_REQUEST['staffrank'];
$opentag = $_REQUEST['opentag'];
$closetag = $_REQUEST['closetag'];
if ($opentag == ""){
$opentag ="";}
else{
$opentag =", staffrank_opentag='".$opentag."',";}
if ($closetag == ""){
$closetag ="";}
else{
$closetag ="staffrank_closetag='".$closetag."'";}
        $db->query_write("UPDATE ".TABLE_PREFIX."usergroup SET staffrank='$staffrank' $opentag $closetag where usergroupid =$_REQUEST[usergroupid]");//usergroup update
        $uStaff = $db->query_read("SELECT usergroupid, username, isstaffrank, staffrank AS stafftitle, staffrank_opentag AS opentag, staffrank_closetag AS closetag FROM ".TABLE_PREFIX."user where usergroupid = $_REQUEST[usergroupid]");
        while ($uStaffT = $db->fetch_array($uStaff)) {
        if ($uStaffT['isstaffrank']==0){
        $db->query_write("UPDATE ".TABLE_PREFIX."user SET staffrank='$staffrank' $opentag $closetag");//user update
        }
        else{
        $uStaffTs .= "<b>$uStaffT[username]</b>: could not be updated you have chosen to give them their own Staff Title.<br />\n";
        }
        }
        print "$_REQUEST[usergroup] Staff Title Updated and Users";
        print "<br />\n$uStaffTs";
        $_REQUEST['do'] = "dotitles";
}

//################## LIST ALL CUSTOM STAFF TITLES ######################
if ($_REQUEST['do'] == "custom") {
        print_form_header('staff_titles_admin', 'set_update');
        print_table_header("View Custom Admin Set Staff Titles");
        $userstaff = $db->query_read("SELECT userid, username, staffrank AS stafftitle, staffrank_opentag AS opentag, staffrank_closetag AS closetag FROM ".TABLE_PREFIX."user where isstaffrank = 1 order by userid asc");
        while ($userstafftitle = $db->fetch_array($userstaff)) {
        $userstafftitles .= "$userstafftitle[username] has the Staff Title of : ".$userstafftitle['opentag'].$userstafftitle['stafftitle'].$userstafftitle['closetag']."<br />\n";
        }
        print_description_row("$userstafftitles");
        print_table_footer();
}

//print_description_row();
print_cp_footer();


?>

sql note:this is comming from straight from the xml file
Code:

$db->query_write("ALTER TABLE " . TABLE_PREFIX . "usergroup ADD (staffrank VARCHAR(250) NOT NULL DEFAULT '')");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "usergroup ADD (staffrank_opentag  VARCHAR(250) NOT NULL DEFAULT '')");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "usergroup ADD (staffrank_closetag  VARCHAR(250) NOT NULL DEFAULT '')");

oh yea the nav group
Code:

<navgroups product="livewires_staff_titles">

        <navgroup text="Staff Titles" permissions="canadminpermissions" displayorder="121">

                <navoption displayorder="10">
                        <text>Set Usergroup Staff Titles</text>
                        <link>staff_titles_admin.php?do=dotitles</link>
                </navoption>
               
                <navoption displayorder="20">
                        <text>View Custom Set Staff Titles</text>
                        <link>staff_titles_admin.php?do=custom</link>
                </navoption>
               
        </navgroup>

</navgroups>


Nathan L 02-12-2006 10:04 AM

Great hack, installed today and working fine :)

Also added this code below so the name shows up on the memberlist, however it only shows up in the forum text colour. Not the colour chosen in the html fields. Is there anyway to make this showup in the memberlist, with the chosen colour?




Quote:

Originally Posted by optrex
in memberlist_resultsbit

find:

Code:

<if condition="$show['usertitlecol']"><div class="smallfont">$userinfo[usertitle]</div></if>
and above or below (depending where you want it add:

Code:

<if condition="$show['usertitlecol']"><div class="smallfont">$userinfo[staffrank]</div></if>


The_Rayman 02-20-2006 08:23 PM

Very very nice Hack m8!

Works like a charm

Xplorer4x4 02-21-2006 05:26 PM

PHP Code:

Database error in vBulletin 3.5.3:

Invalid SQL:
UPDATE user SET
    
### Bitfield: user.options ###
        
options = IF(options 8options 8options),
        
options = IF(options 1024optionsoptions 1024),
        
options = IF(options 16optionsoptions 16),
        
options = IF(options 256options 256options),
        
options = IF(options 512optionsoptions 512),
        
options = IF(options 32options 32options),
        
options = IF(options 2048optionsoptions 2048),
        
options = IF(options 4096options 4096options),
        
options = IF(options 1optionsoptions 1),
        
options = IF(options 2optionsoptions 2),
        
options = IF(options 4optionsoptions 4),
        
options = IF(options 64optionsoptions 64),
        
options = IF(options 128options 128options),
        
options = IF(options 32768options 32768options),
    
usertitle 'Administrator',
    
customtitle 0,
    
username 'Xplorer4x4',
    
email '',
    
languageid 0,
    
homepage 'http://www.domsforums.net/',
    
birthday_search '1984-10-22',
    
birthday '10-22-1984',
    
showbirthday 2,
    
icq '',
    
aim '',
    
yahoo '',
    
msn '',
    
skype '',
    
parentemail '',
    
posts 1097,
    
referrerid 0,
    
ipaddress '',
    
isstaffrank '1',
    
staffrank 'Tech Admin',
    
staffrank_opentag '<b>',
    
staffrank_closetag '</B>',
    
vbookie_cash 500,
    
alerts 0,
    
warnings 0,
    
warning_level 0,
    
warning_bans 0,
    
ucash '11242.37',
    
usergroupid 6,
    
displaygroupid 6,
    
membergroupids '25',
    
reputationlevelid 7,
    
reputation 167,
    
pmpopup 1,
    
autosubscribe = -1,
    
threadedmode 0,
    
showvbcode 2,
    
styleid 0,
    
timezoneoffset '-6',
    
daysprune 0,
    
joindate 1132099380,
    
lastactivity 1140546840,
    
lastpost 1140540000
WHERE userid 
1;

MySQL Error  Unknown column 'isstaffrank' in 'field list'
Error Number 1054
Date         
TuesdayFebruary 21st 2006 06:35:04 PM
Script       
: [url]http://www.domsforums.net/admincp/user.php[/url]
Referrer     : [url]http://www.domsforums.net/admincp/user.php?do=edit&u=1[/url]
IP Address   
Username     Xplorer4x4
Classname    
vb_database 

For some reason it is not adding the "isstaffrank" table under the users table.

Xplorer4x4 03-03-2006 10:33 PM

bump

kira 03-05-2006 10:59 PM

Great plugin, thank you very much, LiveWire! :)

kizzmet 03-06-2006 04:06 AM

This is an awesome hack, I edited the default font and color so I don't have to add tags each time. This is going to save me sooo much time since most of my members have more than one title to set for different reasons. Thank you.

TPOCJames 03-16-2006 11:55 PM

so this will not work for vB 3.5.x?

Jordan17 03-28-2006 05:46 PM

Thank you very much! Great hack, just what i've been looking for!


All times are GMT. The time now is 10:24 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.01471 seconds
  • Memory Usage 1,822KB
  • 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
  • (5)bbcode_code_printable
  • (1)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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