Skip to Content Skip to Menu

[SOLVED] Auto Action Code PHP

10 years 10 months ago - 10 years 10 months ago #273440 by edmundcheong
[SOLVED] Auto Action Code PHP was created by edmundcheong
Is there a user manual around for this - Auto Action Code PHP?

I tried some samples such as:

Auto Action: CODE

Method: PHP
Trigger: After User Profile Edit Display
Condition: [cb_action] equal to Print
Code:
<?php $txt1 = "Learn PHP"; $txt2 = "W3Schools.com"; $x = 5; $y = 4; echo "<h2>" . $txt1 . "</h2>"; echo "Study PHP at " . $txt2 . "<br>"; echo $x + $y; ?>

Return: Print

Results, is that I loose all templates and a dysfunctional looking page.. I think I am doing it wrongly..
Last edit: 10 years 10 months ago by krileon.

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

10 years 10 months ago #273442 by edmundcheong
Replied by edmundcheong on topic Auto Action Code PHP
Tried this as well..


Auto Action: CODE

Method: PHP
Trigger: After User Profile Edit Display
Condition: [cb_action] equal to Print
Code:
"Hello world!<br>";

Return: Print

Nothing appears as well..

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

10 years 10 months ago #273443 by edmundcheong
Replied by edmundcheong on topic Auto Action Code PHP
Any particular reasons for this?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 50713
  • Thanks: 8692
  • Karma: 1475
10 years 10 months ago #273446 by krileon
Replied by krileon on topic Auto Action Code PHP
You need to provide valid PHP. Do not include the <php tags. All PHP is ran as an anonymous function using create_function.


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.

10 years 10 months ago #273448 by edmundcheong
Replied by edmundcheong on topic Auto Action Code PHP

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..

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

  • nant
  • nant
  • OFFLINE
  • Posts: 12339
  • Thanks: 1467
  • Karma: 877
10 years 10 months ago #273449 by nant
Replied by nant on topic Auto Action Code PHP

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.

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

Moderators: beatnantkrileon
Powered by Kunena Forum