Skip to content

Настроить отправку PM из формы

Господа, с Новым годом всех! :)

 

Возвращаясь к работе возникают новые вопросы:

как правильно добиться отправки информации на личное сообщение участника из формы для такой отправки?

 

Иными словами, создал форму (прикр. файл) в шаблоне Функции модераторов - warn_add_note_form (мод устных предупреждений), но разобраться в привязке к PM не получается. Где рулить, подскажите, пожалуйста.

post-26013-1230895680_thumb.jpg

Featured Replies

гы

 

позже скажу.

ну или вот, если вам что-то скажут эти строки

		 		require_once( ROOT_PATH.'sources/lib/func_msg.php' );

		$this->msglib = new func_msg();
	 		$this->msglib->to		   = $toWhoNickName; // основной НИК кому будет послано уведомление
	 		$this->msglib->from_member = $fromMember;
	 		$this->msglib->msg_title   = "Титл";
	 		$this->msglib->msg_post	= "сообщение";
			$this->msglib->force_pm	= 1;
			$this->msglib->send_pm();

			if ( $this->msglib->error )
			{
				print $this->error;
				exit();
			}

  • Author

Я пока далеко не грамотный в программировании, поэтому говорит только то, что в соответствии с приведенным Вами кодом система должна работать. Но куда его добавлять (предположительно в /sources/action_public/misc/warn.php) и как в соответствии с ним настроить форму, к сожалению пока нет.

  • Author

:) А может еще кто знает?

 

С Рождеством всех! :)

У народа сессия...

С Рождеством!

сегодня напишу. попозже.

Скиньте мне только код измененной формы, что у вас на скрине

открыть

./sources/misc/warn.php

найти

		$this->output .= $this->ipsclass->compiled_templates['skin_mod']->warn_add_note_form( $this->warn_member['id'], $this->warn_member['members_display_name'] );

заменить на

		$this->output .= $this->ipsclass->compiled_templates['skin_mod']->warn_add_note_form( $this->warn_member['id'], $this->warn_member['members_display_name'], $this->warn_member['members_disable_pm'] );

найти

		if ( $note )
	{
		//-----------------------------------------
		// Ready to save?
		//-----------------------------------------

		$save['wlog_notes']  = "<content>{$note}</content>";
		$save['wlog_notes'] .= "<mod></mod>";
		$save['wlog_notes'] .= "<post></post>";
		$save['wlog_notes'] .= "<susp></susp>";

		$save['wlog_mid']	 = $this->warn_member['id'];
		$save['wlog_addedby'] = $this->ipsclass->member['id'];
		$save['wlog_type']	= 'note';
		$save['wlog_date']	= time();

		//-----------------------------------------
		// Enter into warn loggy poos (eeew - poo)
		//-----------------------------------------

		$this->ipsclass->DB->do_insert( 'warn_logs', $save );

ниже добавить

			// New code
		if ( (isset($this->ipsclass->input['subject']) AND $this->ipsclass->input['subject'] != '') 
		AND (isset($this->ipsclass->input['contact']) AND $this->ipsclass->input['contact'] != ''))
		{
			//-----------------------------------------
			// Load emailer
			//-----------------------------------------

			require ROOT_PATH."sources/classes/class_email.php";
			$this->email = new emailer();
			$this->email->ipsclass =& $this->ipsclass;
			$this->email->email_init();	

			//-----------------------------------------
			// Load and config the std/rte editors
			//-----------------------------------------

			require_once( ROOT_PATH."sources/handlers/han_editor.php" );
			$this->han_editor		   = new han_editor();
			$this->han_editor->ipsclass =& $this->ipsclass;
			$this->han_editor->init();

			if ( $this->ipsclass->input['contactmethod'] == 'email' )
			{
				$this->parser->parse_smilies   = 0;
				$this->parser->parse_html	  = 1;
				$this->parser->parse_bbcode	= 1;
				$this->ipsclass->input['contact']		= $this->parser->pre_display_parse( $this->parser->pre_db_parse( $this->ipsclass->input['contact'] ) );

				//-----------------------------------------
				// Send the email
				//-----------------------------------------

				$this->email->get_template("email_member");

				$this->email->build_message( array(
													'MESSAGE'	 => str_replace( "<br>", "\n", str_replace( "\r", "",  $this->ipsclass->input['contact'] ) ),
													'MEMBER_NAME' => $this->warn_member['members_display_name'],
													'FROM_NAME'   => $this->ipsclass->member['members_display_name']
												  )
											);

				$this->email->subject = $this->ipsclass->input['subject'];
				$this->email->to	  = $this->warn_member['email'];
				$this->email->from	= $this->ipsclass->vars['email_out'];
				$this->email->send_mail();
			}
			else
			{
				//-----------------------------------------
				// PM :o
				//-----------------------------------------

				require_once( ROOT_PATH.'sources/lib/func_msg.php' );

 				$this->lib = new func_msg();
 				$this->lib->ipsclass =& $this->ipsclass;

 				$this->lib->init();

		 		$this->ipsclass->input['Post'] = $this->lib->postlib->han_editor->process_raw_post( 'contact' );

		 		$this->lib->postlib->parser->parse_smilies	= 1;
		 		$this->lib->postlib->parser->parse_nl2br   	= 1;
		 		$this->lib->postlib->parser->parse_html		= $this->ipsclass->vars['msg_allow_html'];
		 		$this->lib->postlib->parser->parse_bbcode   = $this->ipsclass->vars['msg_allow_code'];

		 		$this->ipsclass->input['Post'] = $this->lib->postlib->parser->pre_db_parse( $this->ipsclass->input['Post'] );
		 		$this->ipsclass->input['Post'] = $this->lib->postlib->parser->pre_display_parse( $this->ipsclass->input['Post'] );
		 		$this->ipsclass->input['Post'] = $this->lib->postlib->parser->bad_words( $this->ipsclass->input['Post'] ); 

				$this->lib->to_by_id	= $this->warn_member['id'];
 				$this->lib->from_member = $this->ipsclass->member;
 				$this->lib->msg_title   = $this->ipsclass->input['subject'];
 				$this->lib->msg_post	= $this->ipsclass->remove_tags($this->ipsclass->input['Post']);
				$this->lib->force_pm	= 1;

				$this->lib->send_pm();

				if ( $this->lib->error )
				{
					print $this->error;
					exit();
				}
			}
		}

вот весь HTML формы warn_add_note_form

<form method="post" action="{$this->ipsclass->base_url}&act=warn&CODE=save_note&mid=$id" id='postingform'>
<div class="borderwrap">
   <div class="maintitle"><{CAT_IMG}> {$this->ipsclass->lang['mod_warn_new_note']} <a href="{$this->ipsclass->base_url}showuser=$id">$name</a></div>
   <div class='row2' style='padding:4px'>
       <fieldset>
           <legend><strong>{$this->ipsclass->lang['mod_warn_fieldset']}</strong></legend>
           <textarea name='note' style='width:95%;height:250px'>{$_POST['note']}</textarea>
           <br />
           <div align='center'><input class='button' type='submit' value='{$this->ipsclass->lang['mod_warn_note_save']} без уведомления' /></div>

            <center><b>{$this->ipsclass->lang['w_contact']}</b>
                        <br />({$this->ipsclass->lang['w_contact2']})</center>
                        <br /><b>{$this->ipsclass->lang['w_c_subj']}</b>
           <input type="input" name="subject" value="{$this->ipsclass->input['subject']}" size="30" />
                {$this->ipsclass->lang['w_c']} 
               <select name="contactmethod">
				<if="$no_pm != 1"><option value="pm">{$this->ipsclass->lang['w_c_p']}</option></if>
				<option value="email">{$this->ipsclass->lang['w_c_e']}</option>
               </select>
               <br />
               <textarea rows="6" cols="70" class="textinput" name="contact">{$this->ipsclass->input['contact']}</textarea>
       <div align="center" class="formsubtitle"><input type="submit" class='button' value="Добавить предупреждение с уведомлением" /></div>
   </div>
       </fieldset>
   </div>
</div>
</form>

на последок надо во входящих переменных шаблона warn_add_note_form добисать в конце

, $no_pm

С ЗАПЯТОЙ

 

сохранить и проверить. Если заголовок письма или текст будут пусты, уведомления не будет. Иначе оно пошлется.

Если работает отпишите. Ибо я не проверял

  • Author

Безумное спасибо!! В ближайшие часы проверю

  • Author

Всё отлично работает. Огромнейшее спасибо!!! :)

  • Author

Сегодня потребовалось выставить реальное предупреждение пользователю и на последней стадии, при самом выставлении уже (через кнопку "+" под аватаркой, заполнение формы) перекинуло на страницу с ошибкой:

Fatal error: Call to a member function cache_add_query() on a non-object in Z:\home\ДОМЕН\www\sources\lib\func_msg.php on line 723

 

Снятие любого предупреждения завершалось тем же :) зато устные предупреждения работали на ура :)

 

Восстановил файл /sources/action_public/misc/warn.php из резерва - всё прошло, но, разумеется, пропала форма для отправки в ЛС уведомления об устном предупреждении.

 

В чем может быть ошибка?

файлик warn.php измененный в приват киньте. Видимо отредактировали вы не так или что то пропустили

  • Author

Переустановил файл warn.php и всё заработало пока :)

Ничего не понимаю... Но пока приятно :)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.