[SOLVED] Setting Registration default values

13 years 5 months ago #145139 by krileon
Replied by krileon on topic Re:Setting Registration default values
What I've provided is the correct usage. Sorry, I can't develop this for you; review other working integrations as examples is the best I can advise. You need to hook and adjust the blank user object as the function in my previous post does. Another good approach is to modify the field object it self using field triggers and changing $field->default to whatever you need; believe you'll need onBeforegetFieldRow for that. We're working on a CB API documentation for future release to better assist developers, but for the time being you'll need to just review source of other integrations. Our documentation subscriber incubator contains many of my personal projects that could be of great learning resource.


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.

13 years 5 months ago #145394 by themick88
Replied by themick88 on topic Re:Setting Registration default values
Unfortunately I could never get any of Kyle's suggestions to work, including the use of the API triggers.

Here's the solution I came up with...

On line 3070 of comprofiler.html.php, I added the following NEW trigger after the registration template builds:
[code:1]$results = $_PLUGINS->trigger( 'onAfterRegisterFormDisplay', array( &$user, $regErrorMSG ) );
[/code:1]

Then, I followed Kyle's Tutorial on building a plug-in and calling a trigger.

Within my trigger function, I add a Javascript function that sets the form field default value:

[code:1]$cb_fname = JRequest::getVar('mem_user_fname');
echo "<script type = \"text/javascript\">";
echo "document.adminForm.firstname.value = \"$cb_fname\";";
echo "</script>";
[/code:1]

I ended up hardcoding a lot of stuff, including the name of the incoming values (access through a POST var) and the name of the form fields (document.adminForm.firstname.value). But that still better than not having anything at all.

Hope this helps someone else!

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.171 seconds

Facebook Twitter LinkedIn