Hi,

So I just installed the module, but I can't figure out how to get it to work the way it's supposed to.

At first, I tried installing and it threw the site into an error. I refreshed, and saw that the module had been enabled anyway, but I couldn't find any site of it on the site. To resolve that issue, I had to disable, uninstall and clear the cache, then try re-installing again before it occured to me to check the Newsletter blocks to see the Real Name field (I really feel this should have been documented somewhere).

Okay fine, the real Name field is on the Newsletter block but that's the only sign I see of it. It's not showing up in my tokens, and when I add a subscriber there's no realname in the subscriber list. Heck there isn't even a column for it. I read in the instructions that the RealName module wasn't 100% necessary (the site I'm using it on will only ever have on registered user: me) but I decided to install it anyway. Nothing. Still no sign of the Real Name token. Did I do something wrong?

Comments

Ony’s picture

Priority: Normal » Critical
heyehren’s picture

Yes, i have exactly the same issues that you've described. I get the following error:

Notice: Undefined index: simplenews_subscription in simplenews_realname_form_alter() (line 123 of /mysite/public_html/drupal/sites/all/modules/simplenews_realname/simplenews_realname.module).

emilorol’s picture

Hi,

The error is generated when the module try to load the name field for an anonymous user and since the anonymous user does not have an email define the error is printed. Here is a solution:

Locate the function "simplenews_realname_form_alter(&$form, $form_state, $form_id)" and in a new line after global $user; add

<?php
/**
 * Implementation of hook_form_alter().
 */
function simplenews_realname_form_alter(&$form, $form_state, $form_id) {
  global $user;
  
  // Have an empty email for the anonymous user
  if (!$user->uid) {
    $user->mail = '';
  }

// Add textfield for real name to subscription forms.
.....
?>
emilorol’s picture

Hi,

I was also getting the error:

Notice: Trying to get property of non-object in _simplenews_realname_get_realname() (line 516 of /home/account/public_html/demo/sites/all/modules/simplenews_realname/simplenews_realname.module).

and I was able to fix it by doing this:

1. Locate function "_simplenews_realname_get_realname($mail)"

2. Find:

<?php
$account = user_load_multiple(array(), array('mail' => $mail));
?>

3. Replace:

<?php
$account = user_load_by_mail($mail);
?>

That should be all.

emilorol’s picture

Hi,

My last 3 bugs of the day:

Notice: Undefined index: #description in simplenews_realname_form_alter() (line 163 of /home/account/public_html/demo/sites/all/modules/simplenews_realname/simplenews_realname.module).

Notice: Undefined index: body in simplenews_realname_form_alter() (line 163 of /home/account/public_html/demo/sites/all/modules/simplenews_realname/simplenews_realname.module).

Notice: Undefined index: body_field in simplenews_realname_form_alter() (line 163 of /home/account/public_html/demo/sites/all/modules/simplenews_realname/simplenews_realname.module).

The reason for this issue is the use of:

<?php
$form['body_field']['body']['#description'] .= ......
?>

That code was good and valid for Drupal 6, but it does not work in Drupal 7. The fix is simple:

Find:

<?php
$form['body_field']['body']['#description']
?>

Replace:

<?php
$form['body'][$form['#entity']->language][0]['#description']
?>

I know a patch file with all the mention issues will be good, but I don't have access to shell right now.

emilorol’s picture

Hi (again),

I got one more little bug when the user try to subscribe from the subscription block and the module try to replace the token in the outgoing email.

Notice: Undefined index: body in simplenews_realname_mail_alter() (line 424 of /home/account/public_html/demo/sites/all/modules/simplenews_realname/simplenews_realname.module).

The reason for this bug is that in the function "simplenews_realname_mail_alter(&$message)" there is check to see if "$message['body']" is an array and when test TRUE it calls:

<?php
$message['body']['body'] = strtr($message['body']['body'], $variables);
?>

The solution is simple since $message['body'] is an array of strings, find the above line and replace it with:

<?php
foreach ($message['body'] as $msg_key=>$msg_value) {
  $message['body'][$msg_key] = strtr($msg_value, $variables);
}
?>

One more bug down.

emilorol’s picture

One more to keep it intresting:

Error:

Notice: Undefined index: simplenews_subscription in simplenews_realname_form_alter() (line 135 of /home/account/public_html/demo/sites/all/modules/simplenews_realname/simplenews_realname.module).

Notice: Undefined index: subscription_mail in simplenews_realname_form_alter() (line 135 of /home/account/public_html/demo/sites/all/modules/simplenews_realname/simplenews_realname.module).

Notice: Undefined index: simplenews_subscription in simplenews_realname_form_alter() (line 135 of /home/account/public_html/demo/sites/all/modules/simplenews_realname/simplenews_realname.module).

Find:

<?php
$form['simplenews_subscription']['account']['simplenews_sync_account']['#description'] .= .........
$form['simplenews_subscription']['subscription_mail']['#description'] .= .........
?>

Replace:

<?php
$form['account']['simplenews_sync_account']['#description'] .= .........
$form['subscription_mail']['simplenews_use_combined']['#description'] .= .........
?>
emilorol’s picture

StatusFileSize
new3.65 KB

Hi,

Here is a patch with the latest correction to the module. A lot of the issues had to do with the changes in DB and Field API from D6 to D7. The only thing I didn't had time to change was the export features so that you can export the name with the email address.

Thank you.

heyehren’s picture

Awesome emilacosta! This fixed the issue for me! Thank you very much.

emilorol’s picture

StatusFileSize
new13.61 KB

Hi,

Here is the latest version of the patch with a couple more bugs fix for the subscription block.

One thing that is not included in this patch is the fix for the install file mention here: http://drupal.org/node/1894202

As for the TODOs:

1. Creation and re-use of helper functions for operations that repeat over and over like subscribe, unsubscribe

2. Ability for the user and/or admin to edit a name after registration in form: admin/people/simplenews/users/edit/-->UID

3. Map the realname field to any profile field without using the "Real Name" module

4. Hopefully one day make it an entity that can be fielded (a better solution than http://drupal.org/node/127178)

Thank you,

Emil

heyehren’s picture

When i try to bulk import a list of users i get the following error:

Notice: Trying to get property of non-object in simplenews_realname_subscription_list_add_submit() (line 274 of mydomain.com/public_html/drupal/sites/all/modules/simplenews_realname/simplenews_realname.module). PDOException: SQLSTATE23000: Integrity constraint violation: 1048 Column 'tid' cannot be null: INSERT INTO {simplenews_subscription} (tid, snid, status, timestamp, source) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => [:db_insert_placeholder_1] => 7 [:db_insert_placeholder_2] => 1 [:db_insert_placeholder_3] => 1361519120 [:db_insert_placeholder_4] => ) in simplenews_subscription_save() (line 1501 of mydomain.com/public_html/drupal/sites/all/modules/simplenews/simplenews.module).

I'll try your new patch later and see if this will fix the issue.

emilorol’s picture

Hi,

Try applying the latest patch and clean your cache, so far when I go to: http://mysite.com/admin/people/simplenews/import to import address it works for me.

A couple of tips:

1. Only 1 name and 1 email per line (NAME LAST;EMAIL@ACCOUNT.COM)

Example:

John Doe;jdoe@email.com
Jane Doe;jdoe2@email.com

2. Since you are using the realname module the import has to have the name and the email and if there is no name you still have to put the semicolon (;) in front of the email

Example:

John Doe;jdoe@email.com
John;jdoe2@email.com
;jdoe3@email.com

3. Don't forget to select the newsletter otherwise there will be no subscription action.

To add to the previews TODOs List:

1. Make the subscription selection required (maybe this should be done by simplenews itself)
2. Improve error handeling to let the user know what it wrong with the data he/she is trying to import
3. Import from a CSV file or Feeds

Thank you.

heyehren’s picture

I still can't get it working on my website, but i applied the patch to a fresh Drupal installation and there it works.

I have tried the following steps on my website:

- disable the simplenews and simplenews realname modules
- uninstall the simplenews and simplenews realname modules
- removed the remaining simplenews tables in the database (field_data_field_simplenews_term and field_revision_field_simplenews_term), although they didn't have any content anyway)
-cleared the cache
-activated the simplenews and simplenews realname modules

I've tried all of this with both the dev and the recommended release of the simplenews and simplenews realname modules (including your latest patch).

I still get the error when trying to mass subscribe:

Notice: Trying to get property of non-object in simplenews_realname_subscription_list_add_submit() (line 274 of mydomain/drupal/sites/all/modules/simplenews_realname/simplenews_realname.module).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'tid' cannot be null: INSERT INTO {simplenews_subscription} (tid, snid, status, timestamp, source) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 1 [:db_insert_placeholder_3] => 1361591176 [:db_insert_placeholder_4] => ) in simplenews_subscription_save() (line 1501 of mydomain/drupal/sites/all/modules/simplenews/simplenews.module).
The website encountered an unexpected error. Please try again later.

Could this be related to another module that i have installed? Or a remaining database entry that hasn't been removed during the uninstall?

heyehren’s picture

strangely i still couldn't find the root of this issue. But i found a few more hints. Any help would be greatly appreciated.

I found out that even though i get the non-object error message (http://drupal.org/node/1912712#comment-7100014), the name and email address is still added in the database table. but for some reason it doesn't show in the subscriber list.

And i have deactivated almost all modules on my test site, but the error still occurs, so it might not even be a compadibility issue with another module?!

jw100’s picture

I'm seeing exactly the same error as kleinermann in #13 when trying to mass subscribe.

Ditto for the database table updates in #14.

We've also done the same version testing as kleinermann, and always receive the error.

Has anyone found a solution to this import problem? Any input would be greatly appreciated!

emilorol’s picture

StatusFileSize
new14.45 KB

This patch should make the error go away.

jw100’s picture

Thank you emilacosta and wow! Your new patch has fixed the import error.

I'm very interested to know what you changed in the patch?

Again, thanks for your time, effort and community contribution!

emilorol’s picture

You are welcome jw100, I am glad to know the patch worked for you.

The change if I remember correctly was due to a change in how the taxonomy term is handle to connect the user with the right newsletter.

Ronni-1’s picture

I had the same issues in the mass subscribe. The patch solved that issue. But there are a few more problems -

When i go to the Newsletter Subscriptions page and i hit next at the bottom of the page for the next subscribers, it still shows me the first set. The bottom menu changes from page 1 to 2 but the display is still showing the first 30 subscribers.

And when i Export all subscribers then only the email ids are shown comma separated. There are no names.

deggertsen’s picture

Component: User interface » Code
Status: Active » Reviewed & tested by the community

There are lots of problems with this module right now in D7. #16 is a huge step in the right direction in my opinion. I had started debugging and had made many of the same changes found in the patch in #16 before I found this issue and simply used that patch. With it, the module appears to be at least mostly working. The patch fixes a whole slew of incorrect variables, and random bug fixes that appear all over the place when the dev version is first installed.

This issue has become a bit of a mess, as it covers a whole slew of issues. I propose that the patch in #16 be committed to the dev branch and that this issue be closed and any other specific issues can then be opened separately. I have opened one specifically for token issues: #2018487: Integrate with Tokens instead of using text replacement method. A separate issue should probably be opened for #19.

Whether the patch in #16 is perfect or not I really can't say, but it's makes the module a whole lot more stable than it was before the patch. This is why I think it should simply be committed and then we can go from there. Obviously I am not the maintainer though so we will have to wait and see what @sgabe says.

deggertsen’s picture

StatusFileSize
new14.87 KB

I decided to reroll the patch so that it's not a .txt file. Not that it matters too much...

cehfisher’s picture

I added the patch in #21 to the dev version and it seemed to make the module work. I am doing further testing now, but I was able to add an anonymous user to the newsletter subscription list. Thanks!

jjmackow’s picture

I also added patch #21 to the latest dev version and removed the
Notice: Trying to get property of non-object in _simplenews_realname_get_realname()
error message; and the module functions as described with the patch.

Nice work folks! thankyou.

jjmackow’s picture

I also added patch #21 to the latest dev version and removed the
Notice: Trying to get property of non-object in _simplenews_realname_get_realname()
error message; and the module functions as described with the patch.

Nice work folks! thankyou.

sgabe’s picture

Title: Module not Functioning properly » Module not functioning properly
Status: Reviewed & tested by the community » Fixed
StatusFileSize
new15.79 KB

Committed, thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nofue’s picture

Issue summary: View changes

I installed this module only two days ago and the initial error message (from the original post) still appeared.

I applied the fixe from #3 and the problem was gone.

Trying to subscribe an anonymous user gave me the same issue as described in #6.
Applying the fix suggested by emilorol (thxs for your support) worked for me as well.

Now the module doesn't issue any messages at least (testing still pending) but I strongly suggest that these fixes are also applied to the module as it was obviously overlooked when posting #25 …

Addition: Seems things are fine with the .dev version. So by all means, commit the .dev to alpha2 or whatever pleases you to help non-programmers to get things done.
Thanks you.

nofue’s picture

Priority: Critical » Normal
Status: Closed (fixed) » Needs review
kreatil’s picture

Status: Needs review » Closed (fixed)

Closing this issue again, since the current dev version seems to work for @nofue, so it does for me on a Drupal 7.41 installation with Simplenews 7.x-1.1+1-dev and Simplenews Realname 7.x-1.0-alpha2+1-dev