[SOLVED] Email form

2 years 2 months ago #327906 by krileon
Replied by krileon on topic Email form

is using com_comprofiler to send an email to the user. It is an internal process where the visitor does not know the email address of the user. Now, if I need to use a form extension how will the form extension understand to whom to send the email after clicking the button of the HTML field within the userlist? When the visitor will fill in the form extension, the uid=[user_id] will have no meaning to the form extension, correct?

I've no idea. I didn't create your form extension. Ideally it should be able to support sending an email to a specific user id. If it has no such functionality I suggest contacting the developer of your form extension.

to the "Before Form" part of the component could help the process somehow?

That just gives you access to CBs API if you need it. It doesn't do anything by itself.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

2 years 2 months ago - 2 years 2 months ago #327915 by galanopd
Replied by galanopd on topic Email form
At the moment I have added the formextension module linked to a payment gateway (or maybe I will add an eshop product for the payments) under the emailoptions field which is in a userlist.

Using jquery I Hide/Show as
1. Option "free" hides module and shows submit button
2. Option "paid" hides submit button and shows module

If option "free" is chosen visitor sees only submit button that links to CBemailform
If option "paid" is chosen visitor sees only a form that has a link to the payment gateway (or maybe an eshop product module that would take visitor to payment gateway.)

Two issues so far

A. The submit button link does take the visitor to the CBemailform but it shows another user on the form title and not the one clicked on the userlist. Actually in this case if I could intergrate CB's "Send Email" link into submit button, would solve this issue since "Send Email" does what I need.
B. I can't show/hide formextension module and submit button independently for each user in the userlist. Showing submit button (free option) for one user, all submit buttons of all users in userlist appear (same for form extension module).

Here is the JQuery AutoAction Code
$(document).ready(function() {
    $("select").on('change',function() {
        var x = this.selectedIndex;

        if (x != "1") {
           $(".cbEmailUserSubmit").hide();
           $("#brform39").show();
        } else {
           $(".cbEmailUserSubmit").show();
           $("#brform39").hide();
        }
    });
    $(".cbEmailUserSubmit").css("display","none");
    $("#brform39").css("display","none");
});

$('.cbEmailUserSubmit').click(function(){ 

    var urldata = $('#dropDownId :selected').val();
    window.open("index.php?option=com_comprofiler&view=emailuser&uid=[user_id]&emailoptions=free")
});

Please Log in to join the conversation.

2 years 2 months ago #327925 by krileon
Replied by krileon on topic Email form
Your show/hide JS isn't per-row specific is why that's happening. You need cbEmailUserSubmit to be per-row specific to prevent that. I've no idea what the structure of your HTML is, but usually you'd just make that a sibling or a child of a sibiling of your select element. That'd let you do things like $( this ).siblings( '.cbEmailUserSubmit' ) to only toggle the immediate sibling of the select element.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: galanopd

Please Log in to join the conversation.

2 years 2 months ago - 2 years 2 months ago #327982 by galanopd
Replied by galanopd on topic Email form

A. The submit button link does take the visitor to the CBemailform but it shows another user on the form title and not the one clicked on the userlist. Actually in this case if I could intergrate CB's "Send Email" link into submit button, would solve this issue since "Send Email" does what I need.


Thank you for the .siblings advice it is now implemented.
The A part of my question still remains an issue for me though...
$('.cbEmailUserSubmit').click(function(){ 

    var urldata = $('#dropDownId :selected').val();
    window.open("index.php?option=com_comprofiler&view=emailuser&uid=[user_id]&emailoptions=free")
});

Please Log in to join the conversation.

2 years 2 months ago #327985 by krileon
Replied by krileon on topic Email form
You're not going to be able to use substitutions like that. We don't have a trigger that's fired per-row so the [user_id] is just going to be the user id of whoever is viewing the userlist. However there is an easy way to get their user id. Each users row has a cbUserListRow CSS class on it and that row also has a data attribute of data-id. That data attribute is their user id. So you can get it using something like the below.

var userId = $( this ).closest( '.cbUserListRow' ).data( 'id' );

You can then just concat that into your URL or use a URL object and append it.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

2 years 2 months ago - 2 years 2 months ago #327990 by galanopd
Replied by galanopd on topic Email form

... is just going to be the user id of whoever is viewing the userlist


The userlist is viewed by either a user or a visitor (not registered).

In case I have understood correctly, this should give me what I need.
$('.cbEmailUserSubmit').click(function(){ 

    var userId = $(this).closest( '.cbUserListRow' ).data( 'id' );
    window.open("index.php?option=com_comprofiler&view=emailuser&userId&emailoptions=free");
});

1. Instead I get
"You are not allowed to send an email to yourself!" and I am not logged in as a user. I am a visitor

2. Using userId&emailuser I get
"Error
Please log in or sign up to view or modify your profile."

3. Viewing the userlist as a user (logged in), it simply takes me to my profile

4. Neither this userId=[user_id] or uid=userId works...

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.295 seconds

Facebook Twitter LinkedIn