Skip to Content Skip to Menu

[SOLVED] Auto Action Code PHP

8 years 11 months ago - 8 years 11 months ago #273450 by edmundcheong
Replied by edmundcheong on topic Auto Action Code PHP

nant wrote:

edmundcheong wrote:

krileon wrote: You need to provide valid PHP. Do not include the <php tags. All PHP is ran as an anonymous function using create_function.


In fact, i have used basic examples from www.w3schools.com/php/showphp.asp?filename=demo_print1
Code:
<?php print "<h2>PHP is Fun!</h2>"; print "Hello world!<br>"; print "I'm about to learn PHP!"; ?>


Auto Action: CODE

Method: PHP
Trigger: After User Profile Edit Display
Condition: [cb_action] equal to Print
Return: Print

Still nothing appears as well..


As Kyle said:

Do not include <php tags.
Means remove the first and last lines.


Sorry to disappoint you Nant.. I accidentally cut and paste the php tags when I posted in the forum..

The auto action does not have the php tags and yet nothing is being displayed.. changed "Return" to echo, print, silent, var_dump;

and nothing is displayed.. what results am I supposed to expect actually? I am guessing it should show (the print out below in blue) at the bottom of the page?

PHP is Fun!
Hello world!
I'm about to learn PHP!
Last edit: 8 years 11 months ago by edmundcheong.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48435
  • Thanks: 8275
  • Karma: 1443
8 years 11 months ago #273461 by krileon
Replied by krileon on topic Auto Action Code PHP
You need to write your code as if it was ran through create_function. This behavior is a little bit different from just executing a PHP script. The code is isolated for security purposes to prevent exploiting. Try the below usage for example.

Code:
Code:
return "PASS";
Return: Echo


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 or Create an account to join the conversation.

8 years 11 months ago #273477 by edmundcheong
Replied by edmundcheong on topic Auto Action Code PHP

krileon wrote: You need to write your code as if it was ran through create_function. This behavior is a little bit different from just executing a PHP script. The code is isolated for security purposes to prevent exploiting. Try the below usage for example.

Code:

Code:
return "PASS";
Return: Echo


Thanks Kyle. It works..

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

Moderators: beatnantkrileon
Powered by Kunena Forum