Thread: Miscellaneous Hacks - VSa - Advanced Registration
View Single Post
  #133  
Old 07-19-2010, 06:01 PM
aimsln aimsln is offline
 
Join Date: Dec 2009
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Creating mastercode for Invation system:


Replace the plug-in code of "VSa - Advanced Registration - MN"
PHP Code:
if ($vbulletin->options['vsaareg_enable'] AND $vbulletin->options['vsaareg_enable_questions'])
        {
            
$vbulletin->db->hide_errors();
            
$vbulletin->input->clean_array_gpc('p', array(
                
'vsaareg_id' => TYPE_UINT,
                
'vsaareg_answer' => TYPE_STR)
            );
            if (
$vbulletin->GPC['vsaareg_id']>0)
            {
                
$vsaareg_tqinfo $vbulletin->db->query_first("
                    SELECT id, question, answer
                    FROM " 
TABLE_PREFIX "vsa_advreg AS vsa_advreg
                    WHERE id = '"
.$vbulletin->db->escape_string($vbulletin->GPC['vsaareg_id'])."'
                "
);
                if (
strtoupper($vbulletin->GPC['vsaareg_answer']) != strtoupper($vsaareg_tqinfo['answer']))
                {
                    
$userdata->error('vsaareg_wrong_answer'$vbphrase['vsaareg_random_question']);
                }
            }
            
$vbulletin->db->show_errors();
        }
    
        if (
$vbulletin->options['vsaareg_enable'] AND $vbulletin->options['vsaareg_enable_invite'])
        {
            
$vsaareg_invonly "";
            if (
$vbulletin->options['vsaareg_enable_invite_only'])
            {
                
$vsaareg_aregcode $vbulletin->input->clean_gpc('p''vsaareg_code'TYPE_STR);
                
$vsaareg_invonly "AND code = $vsaareg_aregcode";
            }
            if(
$vsaareg_aregcode != 'masterinvitecode'
            {
                
$vbulletin->db->hide_errors();
                
$vsaareg_tiinfo $vbulletin->db->query_first("
                    SELECT id, inviter, invited, code
                    FROM " 
TABLE_PREFIX "vsa_advreg_invite AS vsa_advreg_invite
                    WHERE invited = '"
.$vbulletin->db->escape_string($vbulletin->GPC['email'])."' AND done = '0' $vsaareg_invonly
                "
);
                if (
$vsaareg_tiinfo['id']>0)
                {
                    if (empty(
$userdata->errors))
                    {
                        
$vbulletin->db->query_write(" UPDATE " TABLE_PREFIX "vsa_advreg_invite SET done = '1' WHERE id = '".                        $vbulletin->db->escape_string($vsaareg_tiinfo['id'])."' ");
                        
$vsaareg_refinfo $vbulletin->db->query_first("
                            SELECT username
                            FROM " 
TABLE_PREFIX "user AS user
                            WHERE userid = '"
.$vbulletin->db->escape_string($vsaareg_tiinfo['inviter'])."'
                        "
);
                        
$userdata->set('referrerid'$vsaareg_refinfo['username']);
                    }
                }
                else if (
$vbulletin->options['vsaareg_enable_invite_only'])
                {
                    
$userdata->error('vsaareg_wrong_invcode');
                }
                
$vbulletin->db->show_errors();
            } else {
                
$userdata->set('referrerid'useridnumber);
            }
        } 
Replace masterinvitecode by your string. Sample would be: funnyday
PHP Code:
if($vsaareg_aregcode != 'funnyday'
And change the useridnumber to the user who will be listed as the referer:
PHP Code:
$userdata->set('referrerid'1); 
Not the username but the userid!

In my case this is our admin.

Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06425 seconds
  • Memory Usage 1,829KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete