OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Notification subscription problem

Are you a Director, Presenter, Reviewer or Conference Manager in need of help? Want to talk to us about workflow issues? This is your forum.

Moderators: jmacgreg, michael

Forum rules
This forum is meant for general questions about the usability of OCS from an everyday user's perspective: conference managers, presenters, and directors are welcome to post questions here, as are librarians and other support staff. We welcome general questions about the role of OCS and how the workflow works, as well as specific function- or user-related questions.

What to do if you have general, workflow or usability questions about OCS:

1. Read the documentation. We've written documentation to cover from OCS basics to system administration and code development, and we encourage you to read it.

2. take a look at the tutorials. We will continue to add tutorials covering OCS basics as time goes on.

3. Post a question. Questions are always welcome here, but if it's a technical question you should probably post to the OCS Technical Support subforum; if you have a development question, try the OCS Development subforum.

Re: Notification subscription problem

Postby tonreproc » Wed Jan 05, 2011 1:07 am

Hi Alec,

the hash keys in e-mail and database match, that seems to be OK.
The routine you asked for (is this what you mean?, this file is patched with the #5984 patch):

function unsubscribeGuest($email, $password) {
$application =& PKPApplication::getApplication();
$productName = $application->getName();
$context =& Request::getContext();
$contextId = $context->getId();

$result =& $this->retrieve(
'SELECT setting_id FROM notification_settings WHERE setting_name = ? AND product = ? AND context = ?',
array(
'mailList',
$productName,
(int) $contextId
)
);

$row = $result->GetRowAssoc(false);
$userId = (int) $row['setting_id'];

$result->Close();
unset($result);

import('security.AccessKeyManager');
$accessKeyManager = new AccessKeyManager();
$accessKeyHash = AccessKeyManager::generateKeyHash($password);
$accessKey = $accessKeyManager->validateKey('MailListContext', $userId, $accessKeyHash);

if ($accessKey) {
$this->update(
'DELETE FROM notification_settings WHERE setting_name = ? AND setting_value = ? AND product = ? AND context = ?',
array(
'mailList',
$email,
$productName,
(int) $contextId
)
);
$accessKeyDao =& DAORegistry::getDAO('AccessKeyDAO');
$accessKeyDao->deleteObject($accessKey);
return true;
} else return false;
}
tonreproc
 
Posts: 22
Joined: Sat Mar 06, 2010 8:56 am
Location: Netherlands

Re: Notification subscription problem

Postby asmecher » Wed Jan 05, 2011 9:41 am

Hi Cor,

Yes, that's the right function. Could you check in particular whether or not the $userId field is getting read from the DB properly?

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 7710
Joined: Wed Aug 10, 2005 12:56 pm

Re: Notification subscription problem

Postby tonreproc » Wed Jan 05, 2011 10:48 am

Dear Alec,

can you suggest where to place the debug-print code and how that should look like?

Regards,
Cor
tonreproc
 
Posts: 22
Joined: Sat Mar 06, 2010 8:56 am
Location: Netherlands

Re: Notification subscription problem

Postby asmecher » Wed Jan 05, 2011 10:52 am

Hi Cor,

Just after the line where $userId is read from the DB:
Code: Select all
$userId = (int) $row['setting_id'];
...add a line to display the result (and the context ID while we're at it)...
Code: Select all
echo "The user ID is $userId<br/>\n";
echo "The context ID is $contextId<br/>\n";
Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 7710
Joined: Wed Aug 10, 2005 12:56 pm

Re: Notification subscription problem

Postby tonreproc » Wed Jan 05, 2011 10:57 am

Dear Alec,

let me tell you what I did. I placed a line:
print("userId is $UserId");
after line 316:
$userId = (int) $row['setting_id'];

and all I got was a line on top of the screen: UserId is (when trying unsubscribing)
No variable was shown.

Regards,
Cor
tonreproc
 
Posts: 22
Joined: Sat Mar 06, 2010 8:56 am
Location: Netherlands

Re: Notification subscription problem

Postby tonreproc » Wed Jan 05, 2011 11:00 am

Sorry Alec, the email crossed.
With your suggestion I get:

The user ID is 58
The context ID is 1

Regards,
Cor
tonreproc
 
Posts: 22
Joined: Sat Mar 06, 2010 8:56 am
Location: Netherlands

Re: Notification subscription problem

Postby asmecher » Wed Jan 05, 2011 11:50 am

Hi Cor,

OK, that helps. Next, remove that debugging output and step instead into lib/pkp/classes/security/AccessKeyDAO.inc.php. Just before the end of the function:
Code: Select all
return $returner;
...dump out the values of the parameters: $context, $userId, $keyHash, and $assocId. We're trying to figure out why there's no matching entry coming back from the database query in that function.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 7710
Joined: Wed Aug 10, 2005 12:56 pm

Re: Notification subscription problem

Postby tonreproc » Wed Jan 05, 2011 12:04 pm

Hi Alec,

I get a white screen, no output at all.
Should I place the dump just at the end of the file, or at a specific function within it?
Now it is just before the last bracket, starting at line 224
I use:
echo "The context is $context<br/>\n";
echo "The userId is $userId<br/>\n";
echo "The keyHash is $keyHash<br/>\n";
echo "The assocId is $assocId<br/>\n";

right?

regards,
Cor
tonreproc
 
Posts: 22
Joined: Sat Mar 06, 2010 8:56 am
Location: Netherlands

Re: Notification subscription problem

Postby asmecher » Wed Jan 05, 2011 12:14 pm

Hi Cor,

A white screen typically means you've made a typo somewhere. I forgot to include the function name you were debugging; it's getAccessKeyByKeyHash (place it just above the "return" at the end of the function).

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 7710
Joined: Wed Aug 10, 2005 12:56 pm

Re: Notification subscription problem

Postby tonreproc » Wed Jan 05, 2011 12:37 pm

Hi Alec,

this is the result:

The context is MailListContext
The userId is 58
The keyHash is 63cfd5c77e5708278a05876c5747deaa
The assocId is

regards,
Cor
tonreproc
 
Posts: 22
Joined: Sat Mar 06, 2010 8:56 am
Location: Netherlands

Re: Notification subscription problem

Postby tonreproc » Wed Jan 05, 2011 12:46 pm

Dear Alec,

an observation:
if i look in the database table access_keys then I see with the hash key just reported a userId = 57, not 58:

Delete 34 MailListContext 63cfd5c77e5708278a05876c5747deaa 57 57 2011-03-05 20:19:36

does this help?

regards,
Cor
tonreproc
 
Posts: 22
Joined: Sat Mar 06, 2010 8:56 am
Location: Netherlands

Re: Notification subscription problem

Postby asmecher » Thu Jan 06, 2011 12:28 pm

Hi Cor,

I think we're narrowing down the problem -- but debugging remotely takes about ten times the work, unfortunately. Would you mind stepping through the subscription process with a new account, watching these two tables and documenting the changes?

Thanks,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 7710
Joined: Wed Aug 10, 2005 12:56 pm

Re: Notification subscription problem

Postby tonreproc » Thu Jan 06, 2011 1:12 pm

Hi Alec,

I made a notification subscription with a not earlier used e-mail address. I could successfully confirm this subscription with the link in the e-mail.
When unsubscribing, the link in the e-mail did not work,The debug print when unsubscibing was:
The context is MailListContext
The userId is 58
The keyHash is 6f0e4e910716394477c4e3ef63b75014
The assocId is (nothing here)

With the unsubscription link on the website the result is the same.

In the table notification_settings I recognized the new entry with user_id =0 and settings_id=62.

In the table access_keys the data where user_id=assoc_id=62 and access_key_id=39.

So I think that the reported userId in the debug print is wrong?

One different thing: since we had a lot of mailListUncomfirmed in the notification_settings table, someone here removed several (2 or 3) records from this table. Could that be the cause of the problem?

Kind regards,
Cor
tonreproc
 
Posts: 22
Joined: Sat Mar 06, 2010 8:56 am
Location: Netherlands

Re: Notification subscription problem

Postby tonreproc » Thu Jan 06, 2011 1:18 pm

Dear Alec,

adding to the last email: the hash key in the table access_keys is the same as is in the debug output.

At the end of the table notification_settings I see strange entries, all with user_id=58. Is this of any help?
Attachments
2011-01-06_211436.png
2011-01-06_211436.png (16.32 KiB) Viewed 1256 times
tonreproc
 
Posts: 22
Joined: Sat Mar 06, 2010 8:56 am
Location: Netherlands

Re: Notification subscription problem

Postby asmecher » Thu Jan 06, 2011 10:43 pm

Hi Cor,

Are you logged into a user account when you try to unsubscribe? If so, could you try logging out first and see if that changes the situation?

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 7710
Joined: Wed Aug 10, 2005 12:56 pm

PreviousNext

Return to OCS Conference Support and Discussion

Who is online

Users browsing this forum: No registered users and 2 guests