Page MenuHomePhabricator
Paste P844

What I did to get the print_r result
ActivePublic

Authored by 01tonythomas on Jun 25 2015, 3:28 PM.
diff --git a/includes/SpecialNewsletters.php b/includes/SpecialNewsletters.php
index be4375a..6ffc228 100644
--- a/includes/SpecialNewsletters.php
+++ b/includes/SpecialNewsletters.php
@@ -68,6 +68,10 @@ class SpecialNewsletters extends SpecialPage {
* @return bool
*/
static function onSubscribe( array $formData ) {
+ echo "The subscribe part";
+ print_r( $formData );
+ $wasPosted = RequestContext::getMain()->getRequest()->wasPosted();
+ echo "subscribe action was $wasPosted";
if ( isset( $formData['available-newsletters'] ) && isset( $formData['subscriber'] ) ) {
$dbr = wfGetDB( DB_SLAVE );
//get newsletter id user is subscribing to
@@ -123,6 +127,7 @@ class SpecialNewsletters extends SpecialPage {
}
$newsletterNames = array();
+ $defaultOption = array( '' => null );
//get newsletter names
foreach ( $newsletterIds as $value ) {
$result = $dbr->select(
@@ -138,9 +143,9 @@ class SpecialNewsletters extends SpecialPage {
return array(
'subscribed-newsletters' => array(
'required' => true,
- 'type' => 'selectorother',
+ 'type' => 'select',
'label' => $this->msg( 'subscribed-newsletters-field-label' )->text(),
- 'options' => $newsletterNames
+ 'options' => array_merge( $defaultOption, $newsletterNames )
),
'un-subscriber' => array(
'type' => 'hidden',
@@ -156,6 +161,10 @@ class SpecialNewsletters extends SpecialPage {
* @return bool
*/
static function onUnSubscribe( array $formData ) {
+ echo "The unsubscribe part";
+ print_r( $formData );
+ $wasPosted = RequestContext::getMain()->getRequest()->wasPosted();
+ echo "Unsubscribe action was $wasPosted";
if ( isset( $formData['subscribed-newsletters'] ) && isset( $formData['un-subscriber'] ) ) {
$dbr = wfGetDB( DB_SLAVE );
//remove entry from subscriptions table
(END)

Event Timeline

01tonythomas changed the title of this paste from untitled to What I did to get the print_r result.
01tonythomas updated the paste's language from autodetect to autodetect.