- Posts: 1
- Thank you received: 2
PHP Scripting
- David Berg
- Topic Author
- Offline
- New Member
-
Less
More
9 years 1 month ago - 9 years 1 month ago #78660
by David Berg
PHP Scripting was created by David Berg
After a great deal of research and testing, the php scripting feature is obviously in great need of examples and documentation. I'm putting this here to help others until that can be done. Feel free to share any examples to help each other out.
Topic #1
don't use <?, <?php, or ?> they aren't needed
Topic #2
echo and redirects don't work as you'd expect due to internal re-directs that prevent you from seeing them.
details from a help ticket I submitted:
"The echo command could not used to check in this case because right after subscription completed, you will be redirected to a different page, so you won't see the output of your echo command"
Here is some code to test in the PHP Script Settings tab to see if php is working on your server
die('The PHP code is running');
if it is working you will get the text echoed to a blank page
Keep in mind that this feature uses php's eval() to work so if you don't get the code above to work start looking to insure eval() is supported on your server.
using this code in a test php file (ie test.php) might be useful should you need to look into this further
<?php
$isevalfunctionavailable = false;
$evalcheck = "\$isevalfunctionavailable = true;";
eval($evalcheck);
if ($isevalfunctionavailable === true) {
echo "\$isevalfunctionavailable is true.\n";
echo var_dump($isevalfunctionavailable);
}
?>
Topic #3
$row only supports the predefined fields that come with the installation i.e. first_name, last_name, email, etc.
custom fields like osmRace, osmSex, osmBirthDate, etc. can't be accessed with $row. You will need to write custom SQL to obtain these values.
Good luck and I hope others find this useful
Topic #1
don't use <?, <?php, or ?> they aren't needed
Topic #2
echo and redirects don't work as you'd expect due to internal re-directs that prevent you from seeing them.
details from a help ticket I submitted:
"The echo command could not used to check in this case because right after subscription completed, you will be redirected to a different page, so you won't see the output of your echo command"
Here is some code to test in the PHP Script Settings tab to see if php is working on your server
die('The PHP code is running');
if it is working you will get the text echoed to a blank page
Keep in mind that this feature uses php's eval() to work so if you don't get the code above to work start looking to insure eval() is supported on your server.
using this code in a test php file (ie test.php) might be useful should you need to look into this further
<?php
$isevalfunctionavailable = false;
$evalcheck = "\$isevalfunctionavailable = true;";
eval($evalcheck);
if ($isevalfunctionavailable === true) {
echo "\$isevalfunctionavailable is true.\n";
echo var_dump($isevalfunctionavailable);
}
?>
Topic #3
$row only supports the predefined fields that come with the installation i.e. first_name, last_name, email, etc.
custom fields like osmRace, osmSex, osmBirthDate, etc. can't be accessed with $row. You will need to write custom SQL to obtain these values.
Good luck and I hope others find this useful
Last edit: 9 years 1 month ago by David Berg.
The following user(s) said Thank You: Tuan Pham Ngoc, Jonathan Colls
Please Log in or Create an account to join the conversation.
Support
Documentation
Information
Copyright © 2025 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.