Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 4255
Latest: andreios
New This Month: 3
New This Week: 1
New Today: 0
Stats
Total Posts: 43259
Total Topics: 7518
Most Online Today: 201
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 1
Guests: 183
Total: 184

Author Topic: Function to report to admins  (Read 3914 times)

0 Members and 1 Guest are viewing this topic.

Offline shuban

  • Hero Member
  • *****
  • Posts: 665
    • View Profile
    • Biology Forums
Function to report to admins
« on: October 05, 2014, 01:47:35 am »
Code: [Select]
function report($memID)
{
global $context, $txt, $scripturl, $db_prefix, $user_info, $ID_MEMBER, $modSettings, $sourcedir, $language;

is_not_guest();

if ($memID == $ID_MEMBER)
fatal_lang_error('profile_report_own', false);

if (isset($_POST['sc']) || isset($_POST['submit'])) {
checkSession();
spamProtection('spam');

$reporterName = un_htmlspecialchars($user_info['name']) . ($user_info['name'] != $user_info['username'] && $user_info['username'] != '' ? ' (' . $user_info['username'] . ')' : '');
require_once($sourcedir . '/Subs-Post.php');

// Find all of this forum's administrators.
$request = db_query("
SELECT ID_MEMBER, emailAddress, lngfile
FROM {$db_prefix}members
WHERE ID_GROUP = 1 OR FIND_IN_SET(1, additionalGroups)
AND notifyTypes != 4
ORDER BY lngfile", __FILE__, __LINE__);

// Send every moderator an email.
while ($row = mysql_fetch_assoc($request))
{
loadLanguage('UltimateProfile', empty($row['lngfile']) || empty($modSettings['userLanguage']) ? $language : $row['lngfile'], false);

// Send it to the administrator.
sendmail($row['emailAddress'], $txt['profile_report_subject'] . ': ' . $context['member']['name'],
sprintf($txt['profile_report_email1'], $context['member']['name']) . $txt['profile_report_email2'] . ' ' . (empty($ID_MEMBER) ? $txt['guest'] . ' (' . $user_info['ip'] . ')' : $reporterName) . ' ' . $txt['profile_report_email3'] . ":\n\n" .
$scripturl . '?action=profile;u=' . $context['member']['id'] . "\n\n" .
$txt['profile_report_comment'] . ":\n" .
$_POST['comment'] . "\n\n" .
$txt[130], $user_info['email']);
}
mysql_free_result($request);
redirectexit('action=profile;u=' . $memID . '');
}

$context['sub_template'] = 'report_profile';
}



This function isn't sending emails like it should. I believe the issue lies here:

Code: [Select]
// Find all of this forum's administrators.
$request = db_query("
SELECT ID_MEMBER, emailAddress, lngfile
FROM {$db_prefix}members
WHERE ID_GROUP = 1 OR FIND_IN_SET(1, additionalGroups)
AND notifyTypes != 4
ORDER BY lngfile", __FILE__, __LINE__);

I tried to do a print_r of this and it prints Resource id #39 (don't know what that means).

Could someone correct this for me?

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16436
    • View Profile
Re: Function to report to admins
« Reply #1 on: October 05, 2014, 09:48:35 am »
I normally do a print_r on $row varaible.
One tip I do for sendemail function is pass as $subject, $message variable instead of doing all the code in the function call a little cleaner. I think the issue lies there.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline shuban

  • Hero Member
  • *****
  • Posts: 665
    • View Profile
    • Biology Forums
Re: Function to report to admins
« Reply #2 on: October 05, 2014, 12:13:49 pm »
I tried this and still nothing shows up :-\

Code: [Select]
global $context, $txt, $scripturl, $db_prefix, $user_info, $ID_MEMBER, $modSettings, $sourcedir, $language;

// Find all of this forum's administrators.
$request = db_query("
SELECT ID_MEMBER, emailAddress, lngfile
FROM {$db_prefix}members
WHERE ID_GROUP = 1 OR FIND_IN_SET(1, additionalGroups)
AND notifyTypes != 4
ORDER BY lngfile", __FILE__, __LINE__);

// Send every moderator an email.
while ($row = mysql_fetch_assoc($request))
{

print "<pre>";
print_r($row);
print "</pre>";

loadLanguage('UltimateProfile', empty($row['lngfile']) || empty($modSettings['userLanguage']) ? $language : $row['lngfile'], false);

// Send it to the administrator.
sendmail($row['emailAddress'], $txt['profile_report_subject'] . ': ' . $context['member']['name'],
sprintf($txt['profile_report_email1'], $context['member']['name']) . $txt['profile_report_email2'] . ' ' . (empty($ID_MEMBER) ? $txt['guest'] . ' (' . $user_info['ip'] . ')' : $reporterName) . ' ' . $txt['profile_report_email3'] . ":\n\n" .
$scripturl . '?action=profile;u=' . $context['member']['id'] . "\n\n" .
$txt['profile_report_comment'] . ":\n" .
$_POST['comment'] . "\n\n" .
$txt[130], $user_info['email']);
}
mysql_free_result($request);

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16436
    • View Profile
Re: Function to report to admins
« Reply #3 on: October 05, 2014, 12:16:42 pm »
Try changing the query to
Code: [Select]
SELECT ID_MEMBER, emailAddress, lngfile
FROM {$db_prefix}members
WHERE (ID_GROUP = 1 OR FIND_IN_SET(1, additionalGroups) )
AND notifyTypes != 4
ORDER BY lngfile
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline shuban

  • Hero Member
  • *****
  • Posts: 665
    • View Profile
    • Biology Forums
Re: Function to report to admins
« Reply #4 on: October 05, 2014, 01:55:15 pm »
No, still nothing :(

 

Related Topics

  Subject / Started by Replies Last post
0 Replies
3482 Views
Last post March 17, 2007, 09:46:30 pm
by ikick
1 Replies
5529 Views
Last post February 10, 2009, 11:35:34 pm
by SMFHacks
0 Replies
3908 Views
Last post August 08, 2009, 08:45:52 am
by vkot
1 Replies
2953 Views
Last post September 08, 2011, 12:20:31 am
by ApplianceJunk
2 Replies
5657 Views
Last post February 25, 2023, 02:11:06 pm
by mickjav

+- Recent Topics

No thumbnails on new uploads by SMFHacks
March 27, 2024, 02:10:41 pm

Display the Contact Page for guests by SMFHacks
March 27, 2024, 10:55:43 am

is it possible to add support for odysee.com by fvlog19
March 21, 2024, 08:47:51 am

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

an idea for new mod (( content type with different display )) by SMFHacks
February 27, 2024, 01:36:27 pm

[Mod] RSS Feed Poster by SMFHacks
February 27, 2024, 11:57:18 am

find duplicate pictures by fvlog19
February 14, 2024, 02:22:40 pm

Error uploading video. by SMFHacks
February 08, 2024, 02:04:16 pm

Gallery icon as last added image by fvlog19
February 01, 2024, 01:04:56 pm

Powered by EzPortal