Drupal Simplenews - How to subscribe all existing users? - email
Registered users were created first, then Simplenews was added.
How to set up mailing to all already registered users?
I get that you can send emails only to those who joined after you install the module. But I need the existing users' addresses included also.
I found a solution only cure addresses from the database, then export, and put them in a mass subscription.
I just did the following successfully on an up-to-date Simplenews module, with a 3000+ user base. The answer comes from http://cc.com.au/2010/02/03/drupal-simplenews-mass-subscribe
So what I do first is select the uid and email address for all authenticated users (the anonymous user has uid 0, so I select only users with a higher uid) and insert those into the simplenews_subscriptions table.
INSERT INTO simplenews_subscriptions(activated,mail,uid) SELECT 1,mail,uid FROM users WHERE uid > 0 ORDER BY uid ASC;
This automatically assigns a snid (subscription id) to each entry. You'll notice that rather than selecting a column value into the activated field, I just set it to 1.
Next, I need to find the taxonomy term ID (tid) for the particular newsletter to which I want to subscribe all users. You can find this either by listing the terms in the Newsletter vocabulary or by listing all newsletters. In both cases the term id will be shown in your web browser's status bar if you hover the mouse over the edit link: http://example.com/admin/content/simplenews/types/edit/42
On my Drupal site the tid is 42, so that is the newsletter number I want to subscribe my users to. I need to refer to them via the automatically assigned snid from the simplenews_subscriptions table, so I select that and insert it directory into the simplenews_snid_tid table, together with the correct tid.
INSERT INTO simplenews_snid_tid(snid,tid) SELECT snid,42 FROM simplenews_subscriptions;
D7 Solution
To add all users that are not already subscribers run this query
insert into simplenews_subscriber(activated, mail, uid) select 1, mail, uid from users where uid not in (select uid from simplenews_subscriber) and uid > 0;
And to subscribe them to a newsletter run this query
insert into simplenews_subscription(snid, tid, status, timestamp, source) select snid, 31, 1, unix_timestamp(), 'manual' from simplenews_subscriber where snid not in (select snid from simplenews_subscription);
Remmember to replace the number 31 by the number of your newsletter.
You should be able to implement this using Views, VBO and Rules.
Create a view that lists your users (with filters, if you want), create a rules component that receives a user as argument and then subscribe the mail address of that user using the provided action (make sure you've enabled the simplenews rules module).
Then enable bulk operations on the view with that rules component.
Credit #Berdir https://www.drupal.org/project/simplenews/issues/1564988
Related
How does MongoDB keep data in sync
Lets say I have a social media app. There is a Group model that has a field called invitedUsers which is simply an array of user ids that are a part of that group. On my backend I have a route that a user hits to join that Group. In that route I do something like the following: group.invitedUsers = lodash.concat(group.invitedUsers || [], userId) group.save() where group is the group that the user wants to join and userId is the id of the user that wants to join the group. Upon save everything is updated properly and the user is now a part of the group. But what happens if two users hit the route at exactly the same time? How does MongoDB ensure that the group will always have both users ids added via the above method. Is there not a chance that group.invitedUsers could be referencing a stale value if both these group.save() are being triggered around the same time?
How do I set my hasura permission to only see the rows of my table corresponding to a user?
Here's the thing. I have the 3 tables depicted here: People on my application can place orders. Then, I want a user with rex permission to see all the orders table's rows a user with delivery permission to only see the rows of the orders table that have the zip column set to the delivery user's zip From the orders table, I can get for each order a zip. With the table zip_user, I can get a user_id out of a zip. Out of that user_id, I can get the delivery user from the users table. While it is trivial to get the rex to see all of the orders table, I have not yet been able to configure the permissions for the delivery user. What do I need to do? In other words, given the user performing a select on the orders table has x-hasura-user-id set to some user id and x-hasura-role set to delivery, how does that user get only the rows from the orders table that match with the zips associated with that user's user_id?
Hasura has the concept of relations. If you have foreign keys, it makes the relations automatically, if not you can make them yourself in the UI. Once the relationships have been set up, you will be able to set deep permissions, so on the orders table, you'll be able to use users.id. Start here: https://hasura.io/docs/1.0/graphql/manual/schema/relationships/index.html
Generate email once order is changed to filled in netsuite
Once someone clicks on the fulfill button on the Sales Order I want it to send an email to someone.How can make this occur in Netsuite?
You can create a custom workflow on sales order and configure the worflow to send email to the specific email id. The email id can be either custom one / a field value from the sales order record (ex. customer, salesperson etc.,) The condition for the workflow will be OldRecord.Status!="Pending Fulfillment" && NewRecord.Status!="Pending Fulfillment" Thanks Frederick D
you can write a user event on Item Fulfillment record type and send email using nlapiSendEmail() You may want to put a check in script if type == 'create' to avoid sending email on other record operation.
Filemaker Pro: How can I limit exported records returned from a layout with a portal?
I'm creating a database for a small magazine in Filemaker Pro 14. Each subscriber can have multiple subscription records, so in the 'Subscriber' layout, I have inserted a portal which shows the list of related subscription records for the subscriber I'm viewing. When I run a Find operation to view only current subscribers and then export this as a CSV (adding the subscription start and end date as an exported field), I get a list of all current subscribers, but also all the subscription records for each one. I want to limit this so that I only get the current, active subscription record for each subscriber. It looks like this: ID, firstname, lastname, address, city, state, zip, begin_issue, end_issue 1, John, Doe, 123 Anystreet, Anytown, ST, ZIP, 32.4, 33.3 , , , , , , , 33.4, 34.3 , , , , , , , 34.4, 35.3 I just want to get: ID, firstname, lastname, address, city, state, zip, begin_issue, end_issue 1, John, Doe, 123 Anystreet, Anytown, ST, ZIP, 34.4, 35.3 I have created a layout with a portal that includes a filter which only returns the active subscription. However when I export from this layout, I get exactly the same result - it includes all related records. Thanks for any thoughts on this.
I want to limit this so that I only get the current, active subscription record for each subscriber. Exports work at the data layer, so it doesn't matter what you have on the layout. You can have a filtered portal, or no portal at all; still, when you include a related field in the export field order, data from all related records will be exported. To export all (and only) current subscriptions, do your export from the Subscriptions table, after finding only current subscriptions, and include the necessary fields from the Subscribers table.
Simply duplicate this layout, move the fields from the related table directly onto the layout itself, then delete the layout. Only fields from the first related record will be exported. (If you don't get the related record you want, you'll need to adjust the sort order of the relationship you're using).
Alfresco filter people by creator name
I want to modify the webscript alfresco-remote-api-5.0.d.jar\alfresco\templates\webscripts\org\alfresco\repository\person\people.get.js. I need to display for the connected user only user he has created. I have modify the filter to include username in query. filter = filter + " AND cm:creator:admin"; people.getPeoplePaging(filter, paging, sortBy, sortAsc); This must display only users created by admin. But it's not working(no user is returned). How can i select only users created by a certain user ?
By looking at below definition of content model I sure , what you want to achieve is not possible ,as person(user) does not have creator property.Below link shows the content model for users. https://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/COMMUNITYTAGS/V4.2c/root/projects/repository/config/alfresco/model/contentModel.xml https://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/COMMUNITYTAGS/V4.2c/root/projects/repository/config/alfresco/model/systemModel.xml