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

Reply
 
Thread Tools Display Modes
  #1  
Old 11-18-2010, 08:49 PM
yotsume's Avatar
yotsume yotsume is offline
 
Join Date: Dec 2006
Posts: 844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Custom Banned Reason Template

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.
Attached Images
File Type: jpg vBulletin Banned Message.jpg (33.1 KB, 0 views)
Reply With Quote
  #2  
Old 11-19-2010, 08:32 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 11-19-2010, 08:54 AM
yotsume's Avatar
yotsume yotsume is offline
 
Join Date: Dec 2006
Posts: 844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #4  
Old 11-19-2010, 09:28 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh...In that case you did understand all that and I didn't understand the question. Sorry.
Reply With Quote
  #5  
Old 11-19-2010, 09:33 AM
yotsume's Avatar
yotsume yotsume is offline
 
Join Date: Dec 2006
Posts: 844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 11-19-2010, 09:36 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

...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.
Reply With Quote
  #7  
Old 11-19-2010, 09:43 AM
yotsume's Avatar
yotsume yotsume is offline
 
Join Date: Dec 2006
Posts: 844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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...
Reply With Quote
  #8  
Old 11-19-2010, 02:13 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #9  
Old 11-19-2010, 05:40 PM
yotsume's Avatar
yotsume yotsume is offline
 
Join Date: Dec 2006
Posts: 844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the help... what am I to do with your code exactly to be able to create a vba block?
Reply With Quote
  #10  
Old 11-19-2010, 05:50 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
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 04:48 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.04650 seconds
  • Memory Usage 2,291KB
  • Queries Executed 14 (?)
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
  • (1)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)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_postinfo_query
  • fetch_postinfo
  • 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_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete