Hi,

I'm wondering if there is a wish of this module users to simplify the send interface (just after clicking the "send-email" button at the bottom of the view)?

I mean hiding following fieldsets:

  • Sender
  • Recipients
  • Additional email options

and also the last options at the bottom of the form.

In fact, just let the "e-mail content" fieldset (subject ad message).

This could be done through permissions.

If I could have some feedback on that, this would help me decide if I make a custom patch, or if I do a patch that could be contributed back.

Thanks!

CommentFileSizeAuthor
#9 views_send_simple_form.zip1.42 KBCollins405
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hansfn’s picture

Status: Active » Postponed (maintainer needs more info)

I typically do this in projects by creating a custom module with form_alter hooks that sets default values for the fields and then hides them. (There are some issues with sample code.) You can of course hide additional email options too for non-admin users.

If you want to make something general, then you have some problems to solve. What is the default value for sender? (Should it be a setting for Views Send?) What is the default for Recipients? (It's solvable if there is just one field that contains valid email addresses - select that field dynamically.) Do you really want to add a separate permission for controlling the display of additional email options? (Isn't there enough permissions in Drupal already?) Maybe that could be a setting for Views Send in stead?

Patches are always welcome, but consider if this is better solved by a custom module.

Ludo.R’s picture

You're asking very good questions. I've already asked me those questions and I don't have answers for each.

It seems to me that this module has a quite large options set, which makes it powerful.
The consequence of that is that the module is perfect for an administrator or advanced users, but quite obscure for lambda users.

The first question to answer is:
What is the audience of this module?
Is it aimed for technical users, or should it be usable for any user that may need to send emails to some users within a Drupal installation?

Ludo.R’s picture

By the way, I did like you said, I implemented a form_alter hook to modify the form.

dbdrupal’s picture

There absolutely is an appetite to have a slimmed down version of this module. It is fine for me as an admin, but I have several views that have lists of people that I'd like power users to be email by checking the boxes. It would be great to only have "Subject", "Message", and "Send Copy to Sender" available for view. I also don't want these users having to choose a token for name and email address. Thanks!

hansfn’s picture

What is the audience of this module?

Currently, out of the box, it's for advanced users, I guess ;-)

There absolutely is an appetite to have a slimmed down version of this module.

Slimmed down version of the user interface, you mean? To repeat, a developer can already modify the form to make it simpler.

Anyway, I don't have any objections to modify the module to make it easier to use. The cost is more settings and permissions. I think we can do the following:

  1. Add a default sender to the configuration and a permission for altering the sender. If a user don't have the permission, the field is hidden and the default sender is used. (Could be the current user, the site mail or some fixed value.)
  2. Add a permission for setting the recipient info. If a user doesn't have that permission, the field is hidden and the recipient name and e-mail is taken from the first and second column of the view, respectively.
  3. Add a permission for access to the additional e-mail options.

I don't have time to implement this in the very near future. Patches will be accepted

Collins405’s picture

Agreed, very interested in a simplified version.

I want to expose a form to authenticated users to send a simple form to multiple e-mail addresses at once.

In my use case I need a date field added to a form. I also want to hide "additional email options", tokens, recipient details, the remember values option, and send using batch api option. I also want default values in the fields, which dont seem to save.

Can you post an example of your custom module for others to start from?

Collins405’s picture

It would also be nice to have an option to disable the review page to reduce steps to send emails.

Collins405’s picture

Working on a module now ill post it when im done

Collins405’s picture

FileSize
1.42 KB

Heres a simple module which...

  • Adds a new permission to view the full form
  • Removes complex form fields
  • Set default sender values based on current user

Its incomplete, needs an if isset for anonymous users, and needs customising to whatever you name your view.

After a bit of work Ive realised Views Send doesnt do what I need it to. I need to leverage the results and reports that come with entity form or webform, so I will be taking a different approach to embed a view into one of those modules.

peerv’s picture

I support the simplyfied version for non techies!

Andrzej7’s picture

I support it also.

thomas.wardin’s picture

Based on Collins405's "modifier module", I managed to tailor the GUI to my user's needs - except for the header info displayed in the preview window which I'd like not to show. Obviously, neither $form['mail']['headers']['#access'] = FALSE; nor $form['mail']['views_send_preview_headers']['#access'] = FALSE; does the job. Any advice?

BTW: The extra permission doesn't work, is commented out in hook_form_FORM_ID_alter anyway.

bc@lyrstrand.dk’s picture

I would very much like to use the simplified version but cant get it working on my site is there anybody here that are able to help ?

how to customise to the name of my view? is it this line that have to be changed:
function views_send_simple_form_form_alter(&$form, &$form_state, $form_id){
dsm($form);

but how

Collins405’s picture

Yeah sorry, the version i posted was incomplete, and only suited to the project I was working on at the time. It was more of a starting point rather than a solution.

@bc@lyrstrand.dk I don't really get what you mean. The view name and info is all edited through views UI.

bc@lyrstrand.dk’s picture

I got this error messages:

Fatal error: Call to undefined function dsm() in /home/www/test.friluftsvejlederne.dk/sites/all/modules/views_send_simple_form/views_send_simple_form.module on line 27

yurg’s picture

Try to comment out line 27 of views_send_simple_form.module file by entering two slashes before dsm($form);
Should be like this:
// dsm($form);

Not sure if it helps you, since module uses hard-coded Views' names and IDs which has to be changed. Try to find out how to find your View name via Google, there are a lot of (video/image)tutorials.

francescosciamanna’s picture

@Collins405
I'd really like to use your simplfy module, however I am not able to identify which are the harcoded variables in the file "views_send_simple_form" that I should modify. Could you please add some comment to the file "views_send_simple_form" (something like /*change this variable with your views Views' names and IDs*/ is sufficient)? It will really help people to implement faster the simplfied form.

Thank you again for attention,
Francesco

Collins405’s picture

@francescosciamanna
It's not meant to be used as it is. Its far too specific to my use case, and even then I ditched in favour of something else. I only posted it to save someone a bit of time, you'll need to install the Devel module or comment out line 27. Use Devel module to get your form ID, and then drill down your options to hide/show certain fields.

You'll need to read up on Form API.

jehon’s picture

Hello,

Reading all this, I see a opportunity to use form_alter hooks to prefill the values and hide some tabs.

Could you share some code?

Thanks in advance
Jean

Collins405’s picture

Something like...

/*
 * Implementation of hook_form_alter()
 */
function YOURMODULE_form_alter(&$form, &$form_state, $form_id){
  if($form_id == "views_form_pinboard_page"){

    global $user; 
    // You need this to access user name / email values.

    $form['from']['views_send_from_name']['#default_value'] = $user->name; 
    //Automatically take logged in username.

    $form['from']['views_send_from_mail']['#default_value'] = $user->mail;  
    // Automatically fill logged in users email.

    $form['to']['#access'] = FALSE; 
    // Falsify the access to hide the field as its prefilled anyway.

  }
}
ashrafabed’s picture

I posted a patch for this here: https://www.drupal.org/project/views_send/issues/2935687#comment-13079981

Still needs to be tested, but it accomplishes what this issue is asking for.

hansfn’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

Sorry, but I don't see that I will have time to fix any D7 issues.