vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Custom Banned Reason Template (https://vborg.vbsupport.ru/showthread.php?t=253909)

yotsume 11-18-2010 08:49 PM

Custom Banned Reason Template
 
1 Attachment(s)
Custom Banned Reason Template

How can I pull the banned reason message that we type into the vbAdminCP when we ban a member?

I am trying to create a custom page that has the info but the calls for that phrase show blank when I make my own template for it.

Code:

<!-- BANNED REASON -->
<tr>
  <td class="$altbgclass">
      <table border="0" cellpadding="10"><tr>
        <tr><td><phrase argument_list>$vbphrase[nopermission_banned]</phrase></td></tr>
      </table>
  </td>
</tr>
<!-- BANNED REASON -->

How can I code this?

I want to be able to use the info in my attached image in my own template.

kh99 11-19-2010 08:32 AM

Where is your template used? I'm asking because you can't necessarily just use a phrase in your template and have the reason filled in. You would need to have code (like in a plugin) read the reason from the database first. The exception might be if your template happens to be used in a place where it's already been read (like if you're just trying to replace the standard error message template).

But maybe you already know all that - in that case, check out the function print_no_permission() in includes/functions.php.

yotsume 11-19-2010 08:54 AM

I plan to use it in a vbadvanced cmps block. I want to pull the banned reason to show inside a vba block. Other VB phrases seem easy to pull but this one is proving to be difficult. :(

kh99 11-19-2010 09:28 AM

Oh...In that case you did understand all that and I didn't understand the question. Sorry.

yotsume 11-19-2010 09:33 AM

Oh im with you I just am lost as to how to get the message to show in a vba block. I am gonna need some help with this one.

kh99 11-19-2010 09:36 AM

...but I think I might know what the problem is: that phrase is in a phrase group that isn't loaded. The error message functions call function fetch_phrase() in includes/functions_misc.php to load it when needed.

yotsume 11-19-2010 09:43 AM

You I found that out and do not how to proceed. I am guessing I am going to have to code my own plug-in??? to pull the data from the database in a similar manner that is done in the functions.php

I was hoping there was another easier way...

kh99 11-19-2010 02:13 PM

Well, you didn't ask but I thought I'd do it anyway:

PHP Code:

global $vbulletin;

$ugid $vbulletin->userinfo['usergroupid'];
if (!(
$vbulletin->usergroupcache["$ugid"]['genericoptions'] & $vbulletin->bf_ugp_genericoptions['isnotbannedgroup']))
{
    require_once(
DIR '/includes/functions_misc.php'); 
    
$banreason$vbulletin->db->query_first_slave("
        SELECT reason, liftdate
        FROM " 
TABLE_PREFIX "userban
        WHERE userid = " 
$vbulletin->userinfo['userid']
    );

    
// Check for a date or a perm ban
    
if ($banreason['liftdate'])
    {
        
$unbandate vbdate($vbulletin->options['dateformat'] . ', ' $vbulletin->options['timeformat'], $banreason['liftdate']);
    }
    else
    {
        
$unbandate $vbphrase['never'];
    }
    if (!
$banreason['reason'])
    {
        
$banreason['reason'] = fetch_phrase('no_reason_specified''error');
    }
    
$vbulletin->userinfo['banned_reason_text'] = sprintf(fetch_phrase('nopermission_banned''error'), $banreason['reason'], $unbandate );


then you can use $bbuserinfo[banned_reason_text] in a template.

I tried this using the global_start hook, I don't know if it's the best hook to use but none of the vba_ hooks I tried worked.

yotsume 11-19-2010 05:40 PM

Thanks for the help... what am I to do with your code exactly to be able to create a vba block?

kh99 11-19-2010 05:50 PM

It depends on what kind of vBa module you're working with. It looks like you wanted to use it in a template, so you could create a new plugin with hook location "global_start" and use the above code (remember to select "Yes" to make it active), then put $bbuserinfo[banned_reason_text] in the template where you want the text to appear (it will be blank if the user isn't banned).

If you were making a php-type module you could use the above code directly in the module instead of creating a plugin.


All times are GMT. The time now is 11:12 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.01040 seconds
  • Memory Usage 1,746KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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