virtudraft / virtuNewsletter

Yet another MODX's newsletter package
9 stars 3 forks source link

read on site link redirecting to homepage #31

Closed nick2687 closed 10 years ago

nick2687 commented 10 years ago

link from email is redirecting to home page when &newsid is included in the url.

example link to view email on site:

http://localhost:8888/Blossoms/index.php?id=31&newsid=6

this seems to redirect to resource id 1 (the home page), nothing is showing up within the error logs.

resource 21 ( the reader page) simply uses the modx base template with only [[!virtuNewsletter.reader]] in the content.

i'm not sure what i'm missing, any suggestions?

matdave commented 10 years ago

It looks like you may have set your reader page to 31 instead of 21.

nick2687 commented 10 years ago

Sorry that was a miss type, the reader page is 31.

goldsky commented 10 years ago

Is the 31 published? Or has restricted resource group?

nick2687 commented 10 years ago

31 is published and not apart of any resource groups.

Also http://localhost:8888/Blossoms/index.php?id=31

on its own will load, it only does this redirect thing when I add newsid=6 (the id of the newsletter).

On Wed, Mar 5, 2014 at 12:56 PM, rico notifications@github.com wrote:

Is the 31 published? Or has restricted resource group?

Reply to this email directly or view it on GitHubhttps://github.com/virtudraft/virtuNewsletter/issues/31#issuecomment-36765195 .

matdave commented 10 years ago

I'm having a similar error now. I keep getting a 503 response when I include the "newsid" variable on my "blank" reader page. If i take the "newsid" variable off, it just loads a white page.

goldsky commented 10 years ago

You are missing the user's identification, either their email or hash. On the reader snippet, this part blocks the unauthorized reader:

$subscriberHash = isset($_GET['h']) ? $_GET['h'] : '';
$subscriberEmail = isset($_GET['e']) ? $_GET['e'] : '';
if (!empty($subscriberHash)) {
    $subscriber = $virtuNewsletter->getSubscriber(array('hash' => $subscriberHash));
} elseif (!empty($subscriberEmail)) {
    $subscriber = $virtuNewsletter->getSubscriber(array('email' => $subscriberEmail));
}
if (empty($subscriber)) {
    $modx->sendUnauthorizedPage();
}
goldsky commented 10 years ago

Ah... doc was missing them too. Sorry for the confusion.