Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Send Private Message to Public Group Leader on Join Requests Details »»
Send Private Message to Public Group Leader on Join Requests
Version: 1.00, by amykhar amykhar is offline
Developer Last Online: Nov 2013 Show Printable Version Email this Page

Version: 3.0.5 Rating:
Released: 01-18-2005 Last Update: 01-19-2005 Installs: 20
 
No support by the author.

This quick and dirty little hack sends a PM to the leaders of a public group when a join request has been made.

I am surprised this isn't built into vbulletin.

Amy

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 01-20-2005, 04:38 PM
kall's Avatar
kall kall is offline
 
Join Date: Apr 2004
Location: New Zealand
Posts: 2,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by the Sandman
Someone finally put in a join request and the PM was properly generated so I can verify that this works (on a security patched vB 3.0.3 Board).
On 3.0.6 it 'works' .. I get a PM called something like "Join request:*username*" but no more details.

Amy: is it possible to get the group name in the body of the message somewhere?
Reply With Quote
  #13  
Old 01-20-2005, 04:51 PM
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Location: PA
Posts: 4,438
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'll look at making the message more robust.

Amy
Reply With Quote
  #14  
Old 01-20-2005, 05:32 PM
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Location: PA
Posts: 4,438
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK. I updated the instructions to include the group name and a link to the validation page. If you have already installed, do the following to upgrade:

Find:
Code:
if ($_POST['do'] == 'insertjoinrequest')
{
Add After:
Code:
  require_once('./includes/functions_bbcodeparse.php');
  require_once('./includes/functions_newpost.php');
Find the code block originally added in the hack.

Replace with:
Code:
		
	       $leaders = $DB_site->query("
				SELECT ugl.userid, username
				FROM " . TABLE_PREFIX . "usergroupleader AS ugl
				INNER JOIN " . TABLE_PREFIX . "user AS user USING(userid)
				WHERE ugl.usergroupid = $usergroupid
			");
			$groupname = $DB_site->query_first("
			SELECT title
			FROM " . TABLE_PREFIX . "usergroup
			WHERE usergroupid = $usergroupid
			ORDER BY usergroupid DESC
			LIMIT 1
		    ");
			if ($DB_site->num_rows($leaders))
			{
				
				$_groupleaders = array();
                        $tostring = array(); 

				while ($leader = $DB_site->fetch_array($leaders))
				{
                           // Send a PM to the leaders letting them know a join request has been made.
						   $message = construct_phrase($vbphrase['group_memberships_message'], $groupname[title]);
						   $message = convert_url_to_bbcode($message);
                           $tostring["$leader[userid]"] = $leader['username']; 

                           $DB_site->query("INSERT INTO " . TABLE_PREFIX . "pmtext\n\t(fromuserid, fromusername, title, message, touserarray, iconid, dateline, showsignature)\nVALUES\n\t($bbuserinfo[userid], '" . addslashes($bbuserinfo['username']) . "', 'Join Request:', '".addslashes(htmlspecialchars($message))."', '" . addslashes(serialize($tostring)) . "', 0, " . TIMENOW . ", 1)");
                           $pmtextid = $DB_site->insert_id(); 
                           $DB_site->query("INSERT INTO " . TABLE_PREFIX . "pm (pmtextid, userid, messageread) VALUES ($pmtextid, $leader[userid], 0)"); 
                           $DB_site->shutdown_query("UPDATE " . TABLE_PREFIX . "user SET pmtotal=pmtotal+1, pmunread=pmunread+1 WHERE userid = $leader[userid]"); 

			}
               }
Reply With Quote
  #15  
Old 01-20-2005, 05:51 PM
trackpads's Avatar
trackpads trackpads is offline
 
Join Date: Aug 2003
Location: Armyville
Posts: 1,074
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by amykhar
OK. I updated the instructions to include the group name and a link to the validation page. If you have already installed, do the following to upgrade:

Find:
Code:
if ($_POST['do'] == 'insertjoinrequest')
{
Add After:
Code:
  require_once('./includes/functions_bbcodeparse.php');
  require_once('./includes/functions_newpost.php');
Find the code block originally added in the hack.

Replace with:
Code:
		
	       $leaders = $DB_site->query("
				SELECT ugl.userid, username
				FROM " . TABLE_PREFIX . "usergroupleader AS ugl
				INNER JOIN " . TABLE_PREFIX . "user AS user USING(userid)
				WHERE ugl.usergroupid = $usergroupid
			");
			$groupname = $DB_site->query_first("
			SELECT title
			FROM " . TABLE_PREFIX . "usergroup
			WHERE usergroupid = $usergroupid
			ORDER BY usergroupid DESC
			LIMIT 1
		    ");
			if ($DB_site->num_rows($leaders))
			{
				
				$_groupleaders = array();
                        $tostring = array(); 

				while ($leader = $DB_site->fetch_array($leaders))
				{
                           // Send a PM to the leaders letting them know a join request has been made.
						   $message = construct_phrase($vbphrase['group_memberships_message'], $groupname[title]);
						   $message = convert_url_to_bbcode($message);
                           $tostring["$leader[userid]"] = $leader['username']; 

                           $DB_site->query("INSERT INTO " . TABLE_PREFIX . "pmtext\n\t(fromuserid, fromusername, title, message, touserarray, iconid, dateline, showsignature)\nVALUES\n\t($bbuserinfo[userid], '" . addslashes($bbuserinfo['username']) . "', 'Join Request:', '".addslashes(htmlspecialchars($message))."', '" . addslashes(serialize($tostring)) . "', 0, " . TIMENOW . ", 1)");
                           $pmtextid = $DB_site->insert_id(); 
                           $DB_site->query("INSERT INTO " . TABLE_PREFIX . "pm (pmtextid, userid, messageread) VALUES ($pmtextid, $leader[userid], 0)"); 
                           $DB_site->shutdown_query("UPDATE " . TABLE_PREFIX . "user SET pmtotal=pmtotal+1, pmunread=pmunread+1 WHERE userid = $leader[userid]"); 

			}
               }
Excellent work Amy! I dont know why this isnt in the stock vb either!
Reply With Quote
  #16  
Old 01-22-2005, 05:10 AM
ricker ricker is offline
 
Join Date: Jun 2003
Location: Apple Valley, CA
Posts: 108
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

great hack! thanks.
*installed*
Reply With Quote
  #17  
Old 02-18-2005, 06:18 AM
settimio settimio is offline
 
Join Date: Feb 2005
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well...
I've applied the send html hack shown in another post and I'd like to send a periodical newsletter to people who joined a public group called Newsletter.
The standard Vbulletin doesn't allow to send email to public groups...
Is there a fast and simpler way to hack the forum so I can send bulk email to members of a public group?
Reply With Quote
  #18  
Old 02-18-2005, 10:13 AM
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Location: PA
Posts: 4,438
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Setti, your question is off topic for this thread. You should probably start a new thread in general mod discussion if you are going to do it yourself or in one of the request forums if you need somebody to do it for you.
Reply With Quote
  #19  
Old 02-19-2005, 03:53 PM
the Sandman's Avatar
the Sandman the Sandman is offline
 
Join Date: Aug 2003
Location: Tampa, FL
Posts: 229
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The upgrade instructions for early adopters need to include the new phrase addition.
Reply With Quote
  #20  
Old 03-07-2005, 04:44 AM
Cyricx Cyricx is offline
 
Join Date: Aug 2002
Location: Missouri
Posts: 1,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm this doesn't seem to be working with 3.0.7

Anyone have this workin on that version? If so I'll try a clean profile.php
Reply With Quote
  #21  
Old 03-07-2005, 10:09 AM
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Location: PA
Posts: 4,438
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's working on my 3.0.7 with no problems and no changes required.
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 11:05 AM.


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.05198 seconds
  • Memory Usage 2,319KB
  • Queries Executed 25 (?)
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
  • (6)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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