problems sending mass pm....

Makes it posble for admin to specify witch type of users may mass PM any usergroup
Also PM users can be a list of usernames, so PM can be sendt to any number of users

Moderator: Moderators

Forum rules
The content in this forum is dated Dec. 21 2005 and can be used as Archive only. This Forum is LOCKED and READ ONLY !

problems sending mass pm....

Postby ronnan on Sat 20. Nov, 2004 14:15

Hi,

I got these errors....???

Warning: Wrong parameter count for usort() in /var/www/html/bb32/privmsg.php on line 1187

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/bb32/privmsg.php:1187) in /var/www/html/bb32/includes/page_header.php on line 627

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/bb32/privmsg.php:1187) in /var/www/html/bb32/includes/page_header.php on line 629

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/bb32/privmsg.php:1187) in /var/www/html/bb32/includes/page_header.php on line 630

line 1187 : usort ($to_username_array);

it also says user 'Nance does not exist
user does exist
Can anyone help me out....???

greetz Ron
ronnan
Poster
Poster
 
Posts: 1
Joined: Thu 13. Feb, 2003 11:26

Postby chilling on Tue 23. Nov, 2004 16:54

I am getting a similar error .... it is this code where the problem is ...
Code: Select all
#
#-----[ OPEN ]------------------------------------------------
#
privmsg.php

#
#-----[ FIND ]------------------------------------------------
#
$to_username = $HTTP_POST_VARS['username'];

#
#-----[ REPLACE WITH ]----------------------------------------
#

// Start replacement - Custom mass PM MOD
$to_username_array = explode (";", $HTTP_POST_VARS['username']);
usort ($to_username_array);
foreach ($to_username_array as $name) $to_usernames .= "'".htmlspecialchars(trim($name))."',";
$to_usernames[strlen($to_usernames)-1]=" ";
// End replacement - Custom mass PM MOD


The problem is with usort() - should be
PHP Manual wrote:usort
(PHP 3>= 3.0.3, PHP 4 , PHP 5)

usort -- Sort an array by values using a user-defined comparison function
Description
bool usort ( array &array, callback cmp_function)


This function will sort an array by its values using a user-supplied comparison function. If the array you wish to sort needs to be sorted by some non-trivial criteria, you should use this function.

The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.


Note: If two members compare as equal, their order in the sorted array is undefined. Up to PHP 4.0.6 the user defined functions would keep the original order for those elements, but with the new sort algorithm introduced with 4.1.0 this is no longer the case as there is no solution to do so in an efficient way.


Returns TRUE on success or FALSE on failure.


Any thoughts on a fix would be very welcome
Last edited by chilling on Tue 23. Nov, 2004 22:59, edited 1 time in total.
chilling
Poster
Poster
 
Posts: 14
Joined: Mon 26. Jul, 2004 18:29

Postby Niels on Tue 23. Nov, 2004 22:45

I guess your problem is related to the version of php you are runing with

I can see in the history that I did change "sort" to "usort" - sadly I can remember why - try roll it back and use a sort command instead.

in privmsg
Code: Select all
FIND
usort

REPLACE WITH
sort


another way might be this.
Code: Select all
$to_username_array = explode (";", $HTTP_POST_VARS['username']);
usort ($to_username_array);

with this
Code: Select all
$to_username_array = array();
$to_username_array = explode (";", $HTTP_POST_VARS['username']);
sort ($to_username_array);


as it also might help
(if a how-to is EM ready, it will mostly be bullet prof, since a machine is more picky than a human. :D)
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby chilling on Tue 23. Nov, 2004 23:05

Thanks ... changing usort to sort fixes it .....

Now to see what effect the upgrade to 2.0.11 has :)
chilling
Poster
Poster
 
Posts: 14
Joined: Mon 26. Jul, 2004 18:29


Return to Custom mass PM [2.0.6/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron