Form email plugin

buildit

Member
I have a many to many relationship set up (table A, table B, linkage table C). I have database joins in the linkage table and the join setup on table A. This all works fine.

Now, on the form what I would like to do is fill in table A data and then on the linkage table with the join (Set to Repeatable) I want to add users (which come from table B) this works fine as well. Now how would I go about using the email plugin to email the users added to the repeatable groups?
 
hi

I'm presuming that in table C you have a user element to select the user? If so then that info gets posted by the form as an array of user ids.

You would need to use the form plugins 'email to (eval) option' (Form plugin email - Fabrik) to get that array and then convert that into a list of corresponding email addresses.

(replace tableC___users with your user element's full name)

PHP:
$userids = (array) $this->data['tableC___users'];
$emails = array();
foreach ($userids as $userid) {
  $user = JFactory::getUser($userid);
  $emails[] = $user->get('email');
}
return implode(',', $emails);
 
So lets say table c users are not joomla registered users, but a table of people with email addresses, who can not log in to joomla because they do not have user accounts. For example Table A data will already be filled out on the form, Table B data is a list of people (not registered in the system) which is set to repeatable, and both table A data and table B data are saved to table C.

So I can not user JFactory::getUser because I am not using joomla users.
 
Those addresses should be in your join data. I think at that point, it'll be in $data['join'][123], where 123 is your numeric form ID (leftmost column in your Forms page). Easiest way to find the data you want is to put:

var_dump($this->data);exit;

... as the first line of your code, and submit a test. That should dump the data array to your browser. Copy and paste the output here, which will give me the element names I need to help you write the query. If it isn't obvious, let me know what the FK (foreign key) is that joins the table(s).

-- hugh
 
So here is the dump I got. The 'aa_papers_reviewers___reviewer_id' is a database join element to another table 'aa_authors' that contains all the email address. When I started this I did not know it will be this complicated so if this is out of your scope of work for my subscription plan I completely understand and will find another alternative. I am trying to learn php as I go, though it is going slowly.

array(53) { ["option"]=> string(10) "com_fabrik" ["task"]=> string(7) "process" ["formid"]=> string(2) "15" ["rowid"]=> string(1) "6" ["join"]=> array(1) { [21]=> array(12) { ["aa_papers_reviewers___id_raw"]=> array(2) { [0]=> int(5) [1]=> int(6) } ["aa_papers_reviewers___id"]=> array(2) { [0]=> int(5) [1]=> int(6) } ["aa_papers_reviewers___date_time_raw"]=> array(2) { [0]=> string(0) "" [1]=> string(0) "" } ["aa_papers_reviewers___date_time"]=> string(0) "" ["aa_papers_reviewers___paper_id_raw"]=> array(2) { [0]=> array(1) { [0]=> string(0) "" } [1]=> array(1) { [0]=> string(0) "" } } ["aa_papers_reviewers___paper_id"]=> array(2) { [0]=> string(34) "
" [1]=> string(34) "" } ["aa_papers_reviewers___reviewer_id_raw"]=> array(2) { [0]=> array(1) { [0]=> string(2) "15" } [1]=> array(1) { [0]=> string(2) "12" } } ["aa_papers_reviewers___reviewer_id"]=> array(2) { [0]=> string(46) "
  • Heb
" [1]=> string(46) "
  • Zed
" } ["aa_papers_reviewers___reviewer_request_raw"]=> array(2) { [0]=> string(1) "1" [1]=> string(1) "1" } ["aa_papers_reviewers___reviewer_request"]=> array(2) { [0]=> string(3) "Yes" [1]=> string(3) "Yes" } ["aa_papers_reviewers___reviewer_accept_raw"]=> array(2) { [0]=> array(1) { [0]=> string(1) "1" } [1]=> array(1) { [0]=> string(1) "1" } } ["aa_papers_reviewers___reviewer_accept"]=> array(2) { [0]=> string(11) "No Response" [1]=> string(11) "No Response" } } } ["listid"]=> string(2) "15" ["listref"]=> string(2) "15" ["Itemid"]=> string(1) "0" ["isMambot"]=> string(0) "" ["returntoform"]=> string(1) "0" ["fabrik_referrer"]=> string(89) "http://localhost:8888/is3/administrator/index.php?option=com_fabrik&task=list.view&cid=15" ["fabrik_ajax"]=> string(1) "0" ["package"]=> string(6) "fabrik" ["packageId"]=> string(1) "0" ["264a47d8f4b1e31350216ab45e0c4893"]=> string(1) "1" ["format"]=> string(4) "html" ["fabrik_repeat_group"]=> array(2) { [20]=> string(1) "1" [23]=> string(1) "2" } ["submit"]=> string(0) "" ["SQLiteManager_currentLangue"]=> string(1) "2" ["142f847a0914bc2cc0479f99c205f51f"]=> string(32) "0b87cc29e4d9ab0c527897325ae04e8c" ["id"]=> int(6) ["date_time"]=> string(19) "2013-05-13 20:15:00" ["title"]=> string(13) "Fabrik How To" ["abstract"]=> string(19) "How to user fabrik " ["keywords"]=> string(10) "fabrik FAQ" ["id_raw"]=> int(6) ["date_time_raw"]=> string(19) "2013-05-13 20:15:00" ["title_raw"]=> string(13) "Fabrik How To" ["abstract_raw"]=> string(19) "How to user fabrik " ["keywords_raw"]=> string(10) "fabrik FAQ" ["reviewer_request"]=> array(1) { [0]=> string(0) "" } ["aa_papers_review___id"]=> string(1) "6" ["aa_papers_review___id_raw"]=> string(1) "6" ["aa_papers_review___date_time_raw"]=> string(19) "2013-05-13 20:15:00" ["aa_papers_review___date_time"]=> string(10) "2013-05-13" ["aa_papers_review___title_raw"]=> string(13) "Fabrik How To" ["aa_papers_review___title"]=> string(13) "Fabrik How To" ["aa_papers_review___abstract_raw"]=> string(19) "How to user fabrik " ["aa_papers_review___abstract"]=> string(19) "How to user fabrik " ["aa_papers_review___keywords_raw"]=> string(10) "fabrik FAQ" ["aa_papers_review___keywords"]=> string(10) "fabrik FAQ" ["aa_papers_reviewers___id_raw"]=> array(2) { [0]=> int(5) [1]=> int(6) } ["aa_papers_reviewers___id"]=> array(2) { [0]=> int(5) [1]=> int(6) } ["aa_papers_reviewers___date_time_raw"]=> array(2) { [0]=> string(0) "" [1]=> string(0) "" } ["aa_papers_reviewers___date_time"]=> string(0) "" ["aa_papers_reviewers___paper_id_raw"]=> array(2) { [0]=> array(1) { [0]=> string(0) "" } [1]=> array(1) { [0]=> string(0) "" } } ["aa_papers_reviewers___paper_id"]=> array(2) { [0]=> string(34) "" [1]=> string(34) "" } ["aa_papers_reviewers___reviewer_id_raw"]=> array(2) { [0]=> array(1) { [0]=> string(2) "15" } [1]=> array(1) { [0]=> string(2) "12" } } ["aa_papers_reviewers___reviewer_id"]=> array(2) { [0]=> string(46) "
  • Heb
" [1]=> string(46) "
  • Zed
" } ["aa_papers_reviewers___reviewer_request_raw"]=> array(2) { [0]=> string(1) "1" [1]=> string(1) "1" } ["aa_papers_reviewers___reviewer_request"]=> array(2) { [0]=> string(3) "Yes" [1]=> string(3) "Yes" } ["aa_papers_reviewers___reviewer_accept_raw"]=> array(2) { [0]=> array(1) { [0]=> string(1) "1" } [1]=> array(1) { [0]=> string(1) "1" } } ["aa_papers_reviewers___reviewer_accept"]=> array(2) { [0]=> string(11) "No Response" [1]=> string(11) "No Response" } }
 
How is the reviewer_id join rendered? Is it a dropdown, or a multiselect / checkbox?

In other words, is it a single selection, or multiple selection?

If you could post a screenshot of the filled-out form that generated this output, it'd be easier for me to grok what the input structure should be.

-- hugh
 
reviewer_id is a drop down. Also, if you know how to make a text area read only that would be great to know as well.

review.png
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top