×

Error

Please login first

AutoAction excecute PHP

12 years 4 months ago #186236 by bornakke
AutoAction excecute PHP was created by bornakke
Hi CB-community,

I having playing around with auto action the last few weeks and have nearly only had great experiences with this plugin - what a fantastic tool you have developed there. So good we in our firm has been talking about making a joomla plugin with some of the same functionality (we have done quiet a lot of joomla overriding, but just never made a administration panel for it).

Well thats all another story. The reason i'm writting here is that i keep having problems with the php autoaction functionality. I want to do a simple insert of some extra columns in the user overview screen and I have the working php code and the correct trigger (onBeforeBackendUsersListBuildQuery), but I just can't make anything come out on the other side.

Using the 'php eval' doesn't return nothing while the 'php function' reports this error:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE in components/com_comprofiler/plugin/user/plug_cbautoactions/models/code.php(38) : runtime-created function on line 5

Fatal error: Function name must be a string in /components/com_comprofiler/plugin/user/plug_cbautoactions/models/code.php on line 39

Also I keep getting a tilde last in the code when I press the save button.

Hope that someone can show me how to return some simple values from the plugin.

Best regards
Tobias

Please Log in to join the conversation.

12 years 4 months ago #186274 by krileon
Replied by krileon on topic Re: AutoAction excecute PHP
Please ensure you're using the latest release of CB Auto Actions. Joomla version? CB version? Please provide the code you're attempting to use so may try to duplicate.

It's likely eval is disabled on your host and why it doesn't work or it could be working and there's a problem with your code. create_function can be tricky, you can't write code as you normally do as it doesn't just accept PHP in any format; you must be careful to escape what needs escaping or you'll get errors such as what you've received.

All of the code is self contained so you can't exactly inject into another PHP file as that'd be a vulnerability. What exactly are you trying to do with the Code action?


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 to join the conversation.

12 years 4 months ago #186298 by bornakke
Replied by bornakke on topic Re: AutoAction excecute PHP
Thanks for your answear and happy christmas!

I want to do a simple insert of some extra columns in the user overview screen. I'm using CB and Autoaction in newest version (CB: 1.7.1 AC: 2.1).

We have our own dedicated server so adjusting the setup is quiet posible. It is also quiet posible that my code is with error. However what I could really need is an example of how a php eval or php function call could look like?

Best regards
Tobias

Please Log in to join the conversation.

12 years 4 months ago #186325 by krileon
Replied by krileon on topic Re: AutoAction excecute PHP
I'm not so sure you can do that with CB Auto Actions, but likely need a custom plugin to utilize the triggers as the Code action keeps it self contained you've no access to the variables where the trigger executed. Best way to test your code is simply supply it then perform whatever is necessary to fire the trigger while debug mode is enabled and maximum error reporting set. Typically you just supply normal PHP, but more complex operations should probably be done with a custom plugin.


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 to join the conversation.

12 years 4 months ago #186335 by bornakke
Replied by bornakke on topic Re: AutoAction excecute PHP
Maybe your right. I just believe that the code really do look like it is possible. In the controller.users.php on line 327 I see the following line:
$pluginAdditions		=	$_PLUGINS->trigger( 'onAfterBackendUsersList', array( 1, &$rows, &$pageNav, &$search, &$lists, $option, $select_tag_attribs ) );
		$pluginColumns			=	array();
		foreach ( $pluginAdditions as $addition ) {
		
			if ( is_array( $addition ) ) {
				$pluginColumns	=	array_merge( $pluginColumns, $addition );
			}
		}

The pluginColumns is later inserted in the view.users.php (line 480);
foreach ( $pluginColumns as $name => $content ) {
?>
	  <td><?php echo $content[$row->id]; ?></td>

<?php

As I see it the only thing I need is a return statement, but even that I can't seem to get to work...

Please Log in to join the conversation.

12 years 4 months ago #186392 by krileon
Replied by krileon on topic Re: AutoAction excecute PHP
That's using onAfterBackendUsersList, but you mentioned using onBeforeBackendUsersListBuildQuery; which trigger exactly are you trying to act on? Indeed onAfterBackendUsersList should work if the code action is configured properly as it will cause a return/echo (if configured to do so). Please ensure debug mode and maximum error reporting are configured within Joomla global configuration when attempting to view your results. Note this trigger only works in backend User Management and no where else does it apply.


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 to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.216 seconds

Facebook Twitter LinkedIn