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

Reply
 
Thread Tools Display Modes
  #11  
Old 06-07-2009, 07:26 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What exactly are you trying to do? Why are you dumping the username you just fetched?
Reply With Quote
  #12  
Old 06-08-2009, 12:29 PM
powerful_rogue powerful_rogue is offline
 
Join Date: Jan 2007
Location: Kent
Posts: 603
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Im trying to get the members name in the "subject" line, however as they are not logged in when they verify their email address, its coming up as "Hello unregistered".

Im trying to grab their username by the email activation id thats stored in the database, and then use that to place their username in the subject line.
Reply With Quote
  #13  
Old 06-08-2009, 01:03 PM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It looks like you are trying to send an email upon successful activation? If so, why not just use the built-in vBulletin feature to do so?
Reply With Quote
  #14  
Old 06-08-2009, 02:43 PM
powerful_rogue powerful_rogue is offline
 
Join Date: Jan 2007
Location: Kent
Posts: 603
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ive created a mod to create a thread to welcome the member when the register. It works fine when email verficiation is switched off, however the problem occurs when its switched on.

It will create the thread, but instead of saying "Welcome Username" it says "Welcome Unregistered"

This is because when you click on the email verification link it dosent sign you into the forum. The only way around this would be to check the email verification ID thats assisgned to the userID and then get the members username from that - however thats where im really struggling at the moment.

Hope that makes sense!
Reply With Quote
  #15  
Old 06-08-2009, 02:49 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have you tried using other hook locations? Maybe the one you are picking is not the best one for this.
Reply With Quote
  #16  
Old 06-08-2009, 03:14 PM
powerful_rogue powerful_rogue is offline
 
Join Date: Jan 2007
Location: Kent
Posts: 603
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
Have you tried using other hook locations? Maybe the one you are picking is not the best one for this.
Hi Lynne,
Thanks for your reply./
The only hook location I could find to do this was register_activate_process .
Reply With Quote
  #17  
Old 06-08-2009, 04:09 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

And exactly what do you have in the plugin located at that hook location?
Reply With Quote
  #18  
Old 06-08-2009, 04:58 PM
powerful_rogue powerful_rogue is offline
 
Join Date: Jan 2007
Location: Kent
Posts: 603
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Lynne,
This is what ive currently got at the moment. Ive been trying to work with the SQL queries in this thread, but no luck.

PHP Code:
<plugin active="1">
            <
title>welcome thread upon registration</title>
            <
hookname>register_activate_process</hookname>
            <
phpcode><![CDATA[if ($vbulletin->options['wtur_active'] AND $vbulletin->options['wtur_activewhen'] == 0)
            {
    
    
// Backend Files
    
require_once('./global.php');
    require_once(
'./includes/class_dm.php');
    require_once(
'./includes/class_dm_threadpost.php');
    require_once(
'./includes/functions_databuild.php');

$threaddm =& datamanager_init('Thread_FirstPost'$vbulletinERRTYPE_ARRAY'threadpost');
$foruminfo fetch_foruminfo($foruminfo['forumid']);
$threadinfo = array();
$vboptions =& $vbulletin->options;
$bbuserinfo    =& $vbulletin->userinfo
$username htmlspecialchars_uni($vbulletin->userinfo['username']);  
$forumid $vbulletin->options['wtur_fid'];
eval(
'$title1 = "' addslashes($vbulletin->options['wtur_title1']) . '";');  
eval(
'$title2 = "' addslashes($vbulletin->options['wtur_title2']) . '";');
eval(
'$title3 = "' addslashes($vbulletin->options['wtur_title3']) . '";');
eval(
'$title4 = "' addslashes($vbulletin->options['wtur_title4']) . '";');
$title = array("$title1""$title2""$title3""$title4");
$rand_title array_rand($title4);
$wtur_userids_get explode(","$vbulletin->options['wtur_postinguserid']);
$wtur_userids $wtur_userids_get[array_rand($wtur_userids_get)];
$wtur_userid fetch_userinfo($wtur_userids);
eval(
'$pagetext1 = "' addslashes($vbulletin->options['wtur_content1']) . '";');
eval(
'$pagetext2 = "' addslashes($vbulletin->options['wtur_content2']) . '";');
eval(
'$pagetext3 = "' addslashes($vbulletin->options['wtur_content3']) . '";');
eval(
'$pagetext4 = "' addslashes($vbulletin->options['wtur_content4']) . '";');
$pagetext = array("$pagetext1""$pagetext2""$pagetext3""$pagetext4");
$rand_text array_rand($pagetext4);
$wtur_posticons_get explode(","$vbulletin->options['wtur_posticon']);
$wtur_posticons $wtur_posticons_get[array_rand($wtur_posticons_get)];
$allowsmilie '1';
$visible $vbulletin->options['wtur_moderate'];

$threaddm->set_info('forum'$foruminfo);
$threaddm->set_info('thread'$threadinfo);
$threaddm->setr('forumid'$forumid);
$threaddm->setr('userid'$wtur_userid['userid']);
$threaddm->setr('pagetext'$pagetext[$rand_text[0]]);
$threaddm->setr('title'$title[$rand_title[0]]);
$threaddm->set('iconid'$wtur_posticons['iconid']);
$threaddm->set('allowsmilie'$allowsmilie);
$threaddm->set('visible'$visible);


$threaddm->pre_save();
if(
count($threaddm->errors) < 1)
{
    
$threadid $threaddm->save();
    unset(
$threaddm);
    
build_thread_counters($threaddm);
}
 
build_forum_counters($forumid);
 
 
// update post count for user
    
$posts $vbulletin->db->query_first("
        SELECT posts
        FROM " 
TABLE_PREFIX "user
        WHERE userid = "
.$wtur_userid['userid']."
    "
);
    
    
$newpostcount $posts['posts'] + 1;
    
    
$vbulletin->db->free_result($posts);
    
    
$vbulletin->db->query_write("
        UPDATE " 
TABLE_PREFIX "user
        SET posts = "
.$newpostcount."
        WHERE userid = "
.$wtur_userid['userid']."
    "
);  
 
 ]]>}</
phpcode>
        </
plugin>        
    </
plugins
Reply With Quote
  #19  
Old 06-08-2009, 05:35 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

First off, I'm not sure if you need to include global.php again. Does that cause you any problems at all? I don't even see where you are putting the queries from this thread into that plugin. What is the result of your plugin at this point?

Also, have you looked at register.php? It looks to me like they delete the activation id a few lines above that hook.
Reply With Quote
  #20  
Old 06-08-2009, 05:44 PM
powerful_rogue powerful_rogue is offline
 
Join Date: Jan 2007
Location: Kent
Posts: 603
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Lynne,

I tried replacing
PHP Code:
$username htmlspecialchars_uni($vbulletin->userinfo['username']); 
with

PHP Code:
$username $db->query_first("
SELECT useractivation.userid, username 
FROM useractivation 
LEFT JOIN user ON (useractivation.userid = user.userid) 
WHERE activationid = '" 
$db->escape_string($vbulletin->GPC['i']) . "'
AND emailchange=0;
    "
);

$subjectname $vbulletin->userinfo['username'] != '' $vbulletin->userinfo['username'] : $username['username']; 
and it just left an empty space where the username should have been. It seems it does grab their useractivation id as I made an error in one of my sql statements and it threw this back

Quote:
SELECT useractivation.userid, user.userid FROM useractivation

WHERE activationid = '9ffcacf1f2f6e1776f23d90fa62a1f0219aaf368'
AND emailchange=0;;

MySQL Error : Unknown column 'user.userid' in 'field list'
and the activationid was exactly the same as the one received in the email asking for verification.

Regarding including global.php again, would I just place "require_once('./global.php');" above the sql statement?
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 01:02 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.04528 seconds
  • Memory Usage 2,321KB
  • Queries Executed 12 (?)
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
  • (3)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)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
  • (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_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_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete