vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Show usergroup name in emails? (https://vborg.vbsupport.ru/showthread.php?t=282221)

kpmedia 04-29-2012 07:01 PM

Show usergroup name in emails?
 
In one of the email templates (in languages), the following variables are available:

$bbuserinfo[username]
$vboptions[bburl]/showthread.php?t=$threadinfo[threadid]
$threadinfo[prefix_plain]$threadinfo[title]
$post[message]

I want to show not just the username, but the usergroup, too. This way, for example, a person receiving the email will know right away if the posted reply was from a moderator, admin, or a specific member group -- without having to go to the forum first.

But what's the variable to add this?

##

kh99 04-29-2012 10:55 PM

I don't think there is an existing variable. You could write a plugin using hook location newpost_notification_start that sets a variable, then insert it in the phrase. I took a look at that code (in function exec_send_notification() in includes/functions_newpost.php), but it doesn't look like the group of the replying user is available, or even the userid in some cases, so you might have to do a query to look up the information by username.

kpmedia 04-30-2012 07:37 PM

I can use $bbuserinfo[usergroupid], and it'll echo the number in the emails.
But I can't seem to find a way to make it echo the name of the group. I tried to write a plugin, but it did nothing.

This is where I started...
PHP Code:

if ( $bbuserinfo['usergroupid'] == "6" ) {echo "Site Administrators";} 

... but it's just not working well, regardless of what I try.

Any ideas on what plugin syntax would need to be?

##

kh99 04-30-2012 07:54 PM

Hmm...OK, fair enough. I guess I just didn't understand what was going on in that function, because it didn't look like all the info in $bbuserinfo was always the user who replied. Anyway, try this:

Code:

if ( $bbuserinfo['usergroupid'] == "6" ) {$usergorupname = "Site Administrators";}

Then put $usergroupname in the phrase somewhere.

kpmedia 04-30-2012 09:19 PM

Yep, that's almost identical to what I had tried earlier. Doesn't work. :(

#

kh99 04-30-2012 11:15 PM

Oh, right...try this instead:

Code:

if ( $vbulletin->userinfo['usergroupid'] == "6" ) {$usergroupname = "Site Administrators";}

Badshah93 05-03-2012 04:05 AM

For Usergroup Title, Use this variable

Code:

$vbulletin->usergroupcache[$vbulletin->userinfo[usergroupid]][title]


All times are GMT. The time now is 04:07 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.01081 seconds
  • Memory Usage 1,723KB
  • 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_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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