FlexiContent + RSForm Pro

More
10 years 6 months ago #41449 by mauriestate
Hi,

I found a solution to integrate RSForm Pro to 'work' with FlexiContent, however, I am having a small SQL issue and hope you might be able to help me about this.

RSForm Pro has the possibility to retrieve the email of the content author through SQL, hence, a form added within FlexiContent as a module should use the following php scripts:
Code:
$db = JFactory::getDBO(); $articleid = JRequest::getInt('id'); $db->setQuery('SELECT created_by FROM #__content WHERE id='.$articleid); $myid=$db->loadResult(); $db->setQuery('SELECT email FROM #__users WHERE id='.$myid); $adminEmail['to'] = $db->loadResult();

This enable RSForm Pro to grab the email address of the article author and when someone send an inquiry using the form, the email is directly sent to the author of the article.

However, since we are using RSForm Pro with FlexiContent rather than Joomla default article (com_content), it seems there is an SQL mistake/error somewhere in the code that we need to update/change so that it can work with FlexiContent, can you please guide me through the right solution? Thanks.

Offering professional real estate and investment services in Mauritius. Visit us at www.sjkestate.com to also see the power of Flexicontent with Joomla to promote our services.

Please Log in or Create an account to join the conversation.

More
10 years 6 months ago #41450 by mauriestate
Just to mention:

Using FlexiContent 2.1.1 (Latest)
Joomla 3.1.5

Error Generated:
Code:
1064 Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 SQL=SELECT email FROM r739w_users WHERE id=

Offering professional real estate and investment services in Mauritius. Visit us at www.sjkestate.com to also see the power of Flexicontent with Joomla to promote our services.

Please Log in or Create an account to join the conversation.

More
10 years 6 months ago #41469 by ggppdk
Replied by ggppdk on topic FlexiContent + RSForm Pro
Hello

we have an extensive FAQ article for using FC with RS-forms

- have you seen it ??

Retrieving item data e.g. for use in RSforms


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
10 years 6 months ago #41477 by mauriestate
Hi,

Maybe I am stupid or simply not finding the right way to do it :(

Yes, I did see the FAQ www.flexicontent.org/documentation/faq/7...rsforms.html#content but getting confused somewhere!

I have also make some search in the forum and found this thread www.flexicontent.org/forum/index.php?f=2...b_v=viewtopic#p24544 and this one as well www.flexicontent.org/forum/index.php?f=3...v=viewtopic&start=10 .

All discussions are about the code to retrieve FC fields in RSForms but none of them is mentioning where to put the code! So, maybe with some screenshots and more details, this will help you to understand my current situation, which seems similar to all mention above, but I really can't make it alone!

Step 1: I have created a field in FC, an email type field and the field ID is 70.

Step 2: I have created a form in RSForm, in the form properties, there are two possible spaces where I could add the code:

First Possibility (Under the PHP Script dropdown see screenshot):

[attachment=1:1sv2tjt0]<!-- ia1 -->php_scripts_dropdown.jpg<!-- ia1 -->[/attachment:1sv2tjt0]

Second Possibility (Under the PHP Email Script dropdown see screenshot):

[attachment=0:1sv2tjt0]<!-- ia0 -->php_email_script.jpg<!-- ia0 -->[/attachment:1sv2tjt0]

Now about the code, I want to retrieve the email field from FC so that it is added to RSForm while sending the email so that the user who has created the item, added his email address and can receive inquiries sent through the form as well, and this is the code I got from the FAQ:
Code:
$db = & JFactory::getDBO(); $fcitem_id= JRequest::getInt('id',0); $fccat_id= JRequest::getInt('cid',0); $view= JRequest::getVar('view'); if ($view!='items' && $view!='item' && $view!='article') { return "not in items view"; } $field_id=70; if ($fcitem_id) { $query = 'SELECT c.title, c.alias, f.value' .' FROM '.'#'.'__content AS c ' .' LEFT JOIN '.'#'.'__flexicontent_fields_item_relations AS f' .' ON f.item_id = c.id AND f.field_id='.(int)$field_id .' WHERE c.id = ' . $fcitem_id; $db->setQuery($query); $itemdata = $db->loadObject(); $item_title = $itemdata->title; } return $itemdata->value;

Note: I have removed the comments:
Code:
// Set a different item id if you don't want the current item ...
and
Code:
// CHANGE THIS TO THE ID OF YOUR FIELD
from the code and I have changed the field ID from 45 to 70 which is the ID of my email field in FC.

So, where should I place the code in RSForm and is the code the good one please?

Offering professional real estate and investment services in Mauritius. Visit us at www.sjkestate.com to also see the power of Flexicontent with Joomla to promote our services.
Attachments:

Please Log in or Create an account to join the conversation.

More
10 years 6 months ago #41478 by ggppdk
Replied by ggppdk on topic FlexiContent + RSForm Pro
Hello

please see RS Form documentation / FAQ

it will surely says how to use PHP code to set value of a field

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.279 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline