Skip to Content Skip to Menu

[SOLVED] Attaching PHP script

13 years 1 month ago - 13 years 1 month ago #159073 by bruceisaacson
[SOLVED] Attaching PHP script was created by bruceisaacson
"Adding php script to registration sequence"

Greetings,

I have written a php script designed to take a block of html code, do a str_replace to insert the newly registered user's name, then update the appropriate field in the comprofiler table. This should happen only once per user, at the end of the registration sequence.
My question is where do I attach the script? Should it be in the "URL for first login visit" field in the registration setting page? If so, what would be the specifics?

Any help would be appreciated.

Thanks,
Gizmogle

joomla 1.5.22
CB 1.3.1
Last edit: 13 years 1 month ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 68625
  • Thanks: 9109
  • Karma: 1434
13 years 1 month ago #159078 by krileon
Replied by krileon on topic Re: Attaching PHP script
Using incubator project CB Code you could execute your PHP file on the CB trigger after registration. This would do what you're wanting. Aside from that you'll need to develop a new integration to execute your code or place the code directly into CBs core (not recommend and can't advise you as to how).


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.

13 years 1 month ago #159366 by bruceisaacson
Replied by bruceisaacson on topic Re: Attaching PHP script
Thanks for your quick reply.
I downloaded the cb_code plugin, and I am impressed. I do have a few questions, however.
The CODE: Edit page has the option of using the POST URL request method. Does this mean that the variables from the system come to the plugin as a $_POST associative array, as they might to a form handler?

thanks

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 68625
  • Thanks: 9109
  • Karma: 1434
13 years 1 month ago #159375 by krileon
Replied by krileon on topic Re: Attaching PHP script

Does this mean that the variables from the system come to the plugin as a $_POST associative array, as they might to a form handler?

Yes, you can use whatever method fits best. You can use a GET request for instance and append them to the URL directly such as &username=[username]. I recommend using whatever method works best for you.


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.

13 years 1 month ago - 13 years 1 month ago #159460 by bruceisaacson
Replied by bruceisaacson on topic Re: Attaching PHP script
Thanks again!
I've been trying to examine the content of the $_POST array as it comes from the cb_code plugin. I set the trigger to onAfterUserRegistration and the user to Automatic. The Access is Everybody, the condition is empty, the URL is orlindaroadmusic.com/posttest.php , which has the following code which should create a text file with the POST array's contents ( I thought...):

<?php
ob_start();
print_r( $_POST );
$output = ob_get_clean();
file_put_contents( 'post_log.txt', file_get_contents( 'post_log.txt' ) . $output )
?>

The method is Post, and the Request field has username=[username].

The text file is not created, so I get no info.

I know I must be doing something wrong. Can you point me in the right direction?
Thanks once more.
Last edit: 13 years 1 month ago by bruceisaacson. Reason: omission of conclusion

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 68625
  • Thanks: 9109
  • Karma: 1434
13 years 1 month ago #159479 by krileon
Replied by krileon on topic Re: Attaching PHP script
Please ensure you're performing your tests from frontend. The after registration trigger does not affect backend unless you also include the backend registration trigger. Please also do not exclude http:// and/or www. if your site is accessed in such a manner. You can also add "return 'PASS';echo 'PASS';var_dump( 'pass' );" in the bottom of your script then within the trigger set return and errors to show. Once done re-test to see if script is executed.


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

Facebook Twitter LinkedIn