vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Stack Username markup from usergroups? (https://vborg.vbsupport.ru/showthread.php?t=194450)

DragonBlade 10-24-2008 05:13 PM

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?


Lynne 10-24-2008 06:27 PM

Not with the default vbulletin system. That would take some interesting coding to do.

DragonBlade 10-24-2008 07:00 PM

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! :D

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

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

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

Yay! Completion!


All times are GMT. The time now is 08:22 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.01627 seconds
  • Memory Usage 1,731KB
  • 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
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete