This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

Integration
#1

Hello, first of all i'd like to thank you steven for sharing such a quality tool.

Now I'd have a few questions about it :

I'm showing comment box in some modal that is filled from php with some ajax. Means I couldn't directly use require frontend/index.php, had to create some php
PHP Code:
<?php
session_start
();
$id filter_input(INPUT_GET"id"FILTER_VALIDATE_INT);
$titlefilter_input(INPUT_GET"title"FILTER_SANITIZE_STRING);
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>

<?php
$cmtx_identifier 
$id;
$cmtx_reference  $title;
$cmtx_folder     '/comments/';
require(
$_SERVER['DOCUMENT_ROOT'] . $cmtx_folder 'frontend/index.php');
?>
</body>
</html> 
Thats working fine, tho is it the right/best way to do it ?

Okay so thats kinda not that much the problem anyway.


My website already got an user table in sql, they can register and login (login handled by sessionid = userid in sql user table).
I'd like commentics to check if a name/email already exist there, and by then not to create or associate new emails/names.

I guess I'd just have to change a bit the code before sending comment to check different database, I've checked system/lib/comment.php, doesn't seem to be coded here ? Where can I find that ?

Also and finally, I'd need to auto set name, email, country and a few values without displaying them on screen, only if user is connected, using $_SESSION['name'] if it is set for example. Should I append code directly to the php written above ? like just setting $cmtx_set_name_value?

Thanks in advance, btw I wanna let you know that if I can get to use your project the way I want to, I'm definitely translating it to french and later spanish, I'll share this of course
Reply
#2

Hi MG2K4,

The place to add your code would be in /upload/frontend/controller/main/form.php in the submit() method. In there you can get the name and email that was posted and do any checks you want to do against your other database.

Yes it'd be best to append the code which sets the user's details to the integration code. It might then look something like this:

PHP Code:
<?php
if (isset($_SESSION['name'])) {
$cmtx_name $_SESSION['name'];
$cmtx_email $_SESSION['email'];
$cmtx_country $_SESSION['country'];
}

$cmtx_identifier $id;
$cmtx_reference  $title;
$cmtx_folder     '/comments/';
require(
$_SERVER['DOCUMENT_ROOT'] . $cmtx_folder 'frontend/index.php');
?>

In the admin panel, if you go to 'Settings -> Layout -> Form', you can edit each of those three fields and change the 'Filled (Login)' setting to 'Hide'. This way, if you provide the login info, the user will never see those fields. If you don't provide it (i.e. the user is not logged in), the fields will be visible and work like normal.

Also it's worth pointing out about the country that you'll need to match the exact value from the select field for it to work. So in your code if for example you provide the value 'United States' it won't select 'US'. As such, you may need to do a few if statements or a switch statement in your integration code to convert them first. One of the improvements I'm considering is to allow the 3 letter ISO code of the country to be provided as a value so that there isn't this discrepancy of how they're named. Would that help with integrations like yours?

That would be great if you could share some translations. It's something which the project is lacking following the major update.

Have you completed the interview?
Reply
#3

Yep your answer definitely gives me hints to start working on it, thanks !

And will be a pleasure to give you help on this ! As soon as I got it well set up I take care of that Smile
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post
Last Post by Steven
23-Jan-2019, 02:07 PM
Last Post by news
18-Dec-2017, 09:15 AM
Last Post by Steven
19-Dec-2016, 10:22 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)