Skip to:
Content
Pages
Categories
Search
Top
Bottom

Welcome pack plugin errors : missing argument

  • Hi,

    I get this messages for every new inscription (but the emails are sent, and the welcome pack seems to work) :

    Warning: Missing argument 3 for dp_welcomepack_defaultfriend() in /home/casualgames/www/wp-content/plugins/welcome-pack/welcome-pack.php on line 102

    Warning: Missing argument 3 for dp_welcomepack_defaultgroup() in /home/casualgames/www/wp-content/plugins/welcome-pack/welcome-pack.php on line 132

    Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /home/casualgames/www/wp-includes/wp-db.php on line 499

    Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /home/casualgames/www/wp-includes/wp-db.php on line 499

    Warning: Missing argument 3 for dp_welcomepack_welcomemessage() in /home/casualgames/www/wp-content/plugins/welcome-pack/welcome-pack.php on line 74

Viewing 11 replies - 1 through 11 (of 11 total)
  • @xevo

    Participant

    As far as I know the creator hasn’t been that actively working on the plugin which is why it doesn’t work perfectly/not at all anymore. Just wait till the creator updates his plugin or just send him a mail and ask if he could help you further.

    Do you know where I can find his email? He just provide a twitter account…

    @djpaul

    Keymaster

    I have seen your Twitter message and emailing me isn’t going to come any sooner. Rest assured things have not been abandoned.

    @DJPaul,

    Great, so an update is planned?

    I was not sure the Paul of the Plugin and DJPaul was the same person :)

    @stwc

    Participant

    Thanks DJPaul!

    @pangloss

    Participant

    I was able to correct this problem with some mods to the welcome-pack.php file.

    And I must preface this by saying that this fix is a hack. I am really not that familiar with the plugin and don’t know that my changes won’t result in some problem.

    Basically, it appeared that none of the following functions were using the $meta value being passed in. So, I removed it. Here is the simple change. For each of these three, around lines 74, 102 and 132, respectively – change them from this:

    function dp_welcomepack_welcomemessage( $user_id, $password, $meta )

    function dp_welcomepack_defaultfriend( $user_id, $password, $meta )

    function dp_welcomepack_defaultgroup( $user_id, $password, $meta )

    to this:

    function dp_welcomepack_welcomemessage( $user_id, $password )

    function dp_welcomepack_defaultfriend( $user_id, $password )

    function dp_welcomepack_defaultgroup( $user_id, $password )

    That will correct your undefined argument problems.

    After that, you will need to add the following code to the function “dp_welcomepack_defaultfriend” which starts at line 102. At the end of the function, just before the line “friends_add_friend( $friend, $user_id );” add the following conditional code:

    if(is_array($user_id)){

    $user_id = implode($user_id);

    }

    This should solve your array problem. Note!!! I am not entirely sure why the user_id value was being converted to an array in the first place, so, make these changes with that in mind. I don’t believe it will be a problem but it is possible that somehow you might get an actual array of more than one value and that would be an issue. One way to check this that I did not add would be to get an array count if it is an array and only set the value if it’s equal to 1.

    Thanks so much, I’m testing this!

    It works!

    But I add a new error during the account activation, not specificaly linked to the welcomepack?

    It is :

    Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /home/casualgames/www/wp-includes/wp-db.php on line 499

    Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /home/casualgames/www/wp-includes/wp-db.php on line 499

    @pangloss

    Participant

    The second piece of code is to fix that. you need to add the little if statement to the dp_welcomepack_defaultfriend function. That will convert the array casted user_id back to a string.

    @pangloss

    Participant

    !!!!!


    !!!!!!!!!

    New Instructions – DO NOT USE THE ABOVE INSTRUCTIONS, USE THESE. I left out a couple of things earlier and changed some other things.

    !!!!!


    !!!!!!!!!

    I was able to correct this problem with some mods to the welcome-pack.php file.

    And I must preface this by saying that this fix is a hack. I am really not that familiar with the plugin and don’t know that my changes won’t result in some problem.

    Basically, it appeared that none of the following functions were using the $meta value being passed in. So, I removed it. Here is the simple change. For each of these three, around lines 74, 102 and 132, respectively – change them from this:

    function dp_welcomepack_welcomemessage( $user_id, $password, $meta )

    function dp_welcomepack_defaultfriend( $user_id, $password, $meta )

    function dp_welcomepack_defaultgroup( $user_id, $password, $meta )

    to this:

    function dp_welcomepack_welcomemessage( $user_id, $password )

    function dp_welcomepack_defaultfriend( $user_id, $password )

    function dp_welcomepack_defaultgroup( $user_id, $password )

    NEW!!!: Change the following lines in “dp_welcomepack_onuserandblogregistration” from this:

    dp_welcomepack_defaultfriend( $user_id, $password, $meta );

    dp_welcomepack_defaultgroup( $user_id, $password, $meta );

    dp_welcomepack_welcomemessage( $user_id, $password, $meta );

    to this:

    if(is_array($user_id)){

    $user_id = implode($user_id);

    }

    dp_welcomepack_defaultfriend( $user_id, $password );

    dp_welcomepack_defaultgroup( $user_id, $password );

    dp_welcomepack_welcomemessage( $user_id, $password );

    That will correct your undefined argument problems and should solve your array problem. Note!!! I am not entirely sure why the user_id value was being converted to an array in the first place, so, make these changes with that in mind. I don’t believe it will be a problem but it is possible that somehow you might get an actual array of more than one value and that would be an issue. One way to check this that I did not add would be to get an array count if it is an array and only set the value if it’s equal to 1.

    If for some reason you are experiencing other problems, feel free to message me privately and I can investigate further.

    @djpaul

    Keymaster

    Just uploaded new version of Welcome Pack. I tested it again the trunk revision as that’s very close to release as BP 1.1.3 (just noticed the readme says BP 1.2, but meh).

    It’ll *probably* work with BP 1.1.2!

    @pangloss thanks for helping people work around the problem before I got this release out! It’s appreciated.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Welcome pack plugin errors : missing argument’ is closed to new replies.
Skip to toolbar