Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-24-2008, 06:13 PM
DragonBlade's Avatar
DragonBlade DragonBlade is offline
 
Join Date: May 2006
Posts: 189
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Stack Username markup from usergroups?

In order to "stack" the HTML markups for User Groups, you need to do the following:
  1. Create a new TINYINT(1) field on your usergroup table
  2. Add the following plugin for the "fetch_musername" hook:
    PHP Code:
    $gids explode(','$user['membergroupids']);
    foreach (
    $gids AS $gid)
    {
      
    $info $vbulletin->db->query_first(sprintf("SELECT stack_markup FROM " TABLE_PREFIX "usergroup WHERE usergroupid='%s'"$vbulletin->db->escape_string($gid)));
      if (
    $info['stack_markup'] == '1')
      {
        
    $user['musername'] = $vbulletin->usergroupcache["$gid"]['opentag'] . $user['musername'] . $vbulletin->usergroupcache["$gid"]['closetag'];
      }

  3. For the "admin_usergroup_edit" hook, add the following plugin (so you can change the value via AdminCP and not have to do it manually in your SQL)
    PHP Code:
    print_table_header('Stack HTML Markup?');
    print_yes_no_row('Would you like to stack the Usergroup markup for this group?''usergroup[stack_markup]'$usergroup['stack_markup']);
    print_table_break(); 
    NOTE: Change stack_markup to whatever you named the table field in Step 1.






Quote:
Originally Posted by Original Post
Hey, all. I'm programming a "shop" system, and I was wondering, is there a way to "stack" the username markup from usergroups?

For example, if a user was part of the "Items -- Bold", "Items -- Italic", and "Items -- Color: red" usergroups, can I combine those markups?
Reply With Quote
  #2  
Old 10-24-2008, 07:27 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 system. That would take some interesting coding to do.
Reply With Quote
  #3  
Old 10-24-2008, 08:00 PM
DragonBlade's Avatar
DragonBlade DragonBlade is offline
 
Join Date: May 2006
Posts: 189
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ah! I think I finally understand this hook system!

All I have to do is write the XML stuff like described here.

Then all I have to do is write the code in the CDATA tag?

Like my code could be something like this:


PHP Code:
$gids explode(','$user['membergroupids']);
foreach (
$gids AS $gid)
{
  if 
is_stacked_display_usergroup($gid)
  {
    
$user['musername'] = $vbulletin->usergroupcache["$gid"]['opentag'] . $user['musername'] . $vbulletin->usergroupcache["$gid"]['closetag'];
  }

Then all I have to do is write the "is_stacked_usergroup()" function and maybe add a field to the membergroups table or something?

Is that really just how simple it is? :O

--------------- Added [DATE]1224887791[/DATE] at [TIME]1224887791[/TIME] ---------------

One more question, though.

How would I go about modding the AdminCP so that I can have a Yes/No radio button or a checkbox or something when adding/altering usergroups?

I've been looking at this thread, but I'm not sure if that's what I'm looking for. O.o

--------------- Added [DATE]1224895257[/DATE] at [TIME]1224895257[/TIME] ---------------

Oh, I see now! I can just make a plugin for the admin_usergroup_edit hook!

I understand now. :3 Yes yes yes...

[high]* DragonBlade goes back to coding.[/high]

--------------- Added [DATE]1224902957[/DATE] at [TIME]1224902957[/TIME] ---------------

Yay! Completion!
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 10:06 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.03645 seconds
  • Memory Usage 2,192KB
  • Queries Executed 11 (?)
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
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)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