Skip to:
Content
Pages
Categories
Search
Top
Bottom

Mass-PM users


  • sx1001
    Participant

    @sx1001

    Hi all,
    I want to create a code which sends a mass PM to all my plattform members using messages_new_message:

    Something like that, iterating over all my user ids:

    		$msg = array(
    			'recipients' => [$uid], 
    			'subject' => $subject, 
    			'content' => $content
    		);
    
    		messages_new_message ($msg);

    The downside is: It sends a mail notification to everyone and thus, it takes quite some time if you execute this code for 1000 members.

    Is there a way to disable a mail notification solely for this single PM message sent?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)

  • sx1001
    Participant

    @sx1001

    I think I found it:
    Remocving this hook before calling “messages_new_message”:

    remove_action( 'messages_message_sent', 'messages_notification_new_message', 10 );


    sx1001
    Participant

    @sx1001

    Why the heck is messages_new_message() so damn slow?
    I can merely send ONE PM per second… even though I already disabled the mail notification.

    There must be an incredible overhead in messages_new_message …. What do you think?


    VibeThemes
    Participant

    @vibethemes

    This is not necessarily a messages problem.
    The messages are also sending a notification and an email.

    This user can manage from settings.

    Also, note that these actions are also depended on the number of plugins in use.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar