Skip to Content Skip to Menu

[SOLVED] Query regarding code auto action

  • abrbhat
  • abrbhat
  • OFFLINE
  • Posts: 78
  • Thanks: 0
  • Karma: 0
12 years 2 months ago - 12 years 2 months ago #207153 by abrbhat
hi,
here is the situation:
There are user profile of type 'brand' and 'store'. Each store may or may not be linked to a 'brand'. The stores of a brand have a common value of a CB field cb_brand. Now I want to setup the brand profile such that when a user of brand profile posts an update, it gets registered with the profilebook and activity plugins of the stores associated with that brand and gets displayed as their brand/activity. For that purpose i create two fields cb_brandupdate and cb_brandupdatetitle for use as the description and title fields of profilebook updates. They are accessible only to brand profile owners during profile update. Now, I am running a code auto action as:

accesslevel:Brands
trigger:onAfterUserUpdate
method:php(eval)
return:silent.
The code is following:

$now = date("Y-m-d H:i:s");

$result = mysql_query("SELECT user_id FROM joomla_comprofiler WHERE cb_brand=[cb_brand]");

while($row = mysql_fetch_array($result))
{
mysql_query("INSERT INTO `backup5aug`.`joomla_comprofiler_plug_profilebook` (`id`, `mode`, `posterid`, `posterip`, `postername`, `posteremail`, `posterlocation`, `posterurl`, `postervote`, `postertitle`, `postercomment`, `date`, `userid`, `feedback`, `editdate`, `editedbyid`, `editedbyname`, `published`, `status`) VALUES (NULL, 'b', '[user_id]', '[user_ip]', '[cb_shopname]', '
Last edit: 12 years 2 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
12 years 2 months ago #207158 by krileon
Replied by krileon on topic Re: Query regarding code auto action
Enable debug mode and maximum error reporting within Joomla global configuration then test to see if any fatal error occurs. If none then consult with a contract developer or MYSQL specialist. Also some hosts have "eval" disabled, try create_function PHP method.


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.

  • abrbhat
  • abrbhat
  • OFFLINE
  • Posts: 78
  • Thanks: 0
  • Karma: 0
12 years 2 months ago #207181 by abrbhat
Replied by abrbhat on topic Re: Query regarding code auto action
ok...i'll see about the specific implementation but the code auto action seems not to be working.
i've set it up as:
trigger:onBeforeUserProfileDisplay
method:php(eval)/php(create_func)
code:echo 'test';
return:echo
nothing is displayed while if method is html, then the output gets printed

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
12 years 2 months ago #207186 by krileon
Replied by krileon on topic Re: Query regarding code auto action
You can't use an echo, you need to use a return. It doesn't output echoes, because they're self contained in ob_ functions. I've confirmed the below works fine.

Type: Code
Triggers: onBeforeUserProfileDisplay
Access: Everybody
Method: Code (eval)
Code: return 'TEST';
Return: Echo

Type: Code
Triggers: onBeforeUserProfileDisplay
Access: Everybody
Method: Code (create_function)
Code: return 'TEST';
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.

  • abrbhat
  • abrbhat
  • OFFLINE
  • Posts: 78
  • Thanks: 0
  • Karma: 0
12 years 2 months ago #207370 by abrbhat
Replied by abrbhat on topic Re: Query regarding code auto action
have u disabled use of mysql_query in php code auto action?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
12 years 2 months ago #207374 by krileon
Replied by krileon on topic Re: Query regarding code auto action
No, nothing is disabled; your code is probably just wrong. You don't need mysql_query, you can use Joomla/CB API in the code.


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.

Moderators: beatnantkrileon
Powered by Kunena Forum