vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Send Private Message to Public Group Leader on Join Requests (https://vborg.vbsupport.ru/showthread.php?t=74623)

kall 01-20-2005 04:38 PM

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?

amykhar 01-20-2005 04:51 PM

I'll look at making the message more robust.

Amy

amykhar 01-20-2005 05:32 PM

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]");

                        }
              }


trackpads 01-20-2005 05:51 PM

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!

ricker 01-22-2005 05:10 AM

great hack! thanks.
*installed*

settimio 02-18-2005 06:18 AM

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?

amykhar 02-18-2005 10:13 AM

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.

the Sandman 02-19-2005 03:53 PM

The upgrade instructions for early adopters need to include the new phrase addition. :)

Cyricx 03-07-2005 04:44 AM

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

amykhar 03-07-2005 10:09 AM

It's working on my 3.0.7 with no problems and no changes required.


All times are GMT. The time now is 12:39 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.02859 seconds
  • Memory Usage 1,764KB
  • 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
  • (6)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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