mikebuck
Forum Replies Created
-
Forum: Plugins
In reply to: [Participants Database] Subdomain as hidden fieldHi,
Thanks for replying… so soon..
Infact I finally solved it with a small mod to formelement.class.ph
I agree with you on the risk…
How do i create a custom template… to display my form with my mods
All i want to achieve is to capture the subdomain part of the url and insert it into the participants record.. just as one would insert any other custom field data.
The only difference is that when the field that is supposed to capture the subdomain is rendered. I want it to be hidden with the value prefilled as a result of a function that extracts the subdomain from the wordpress function file.
At this time my solution has been as follows:
created a custom function in function.php of theme to extract subdomain part
modified the FormElement.class.php file at line 775 as follows to call the function to get subdomain and populate the field value where field name is subdomain:
if ( $this->name == 'subdomain' ) { return '<input type="' . $type . '" name="' . $this->name . ( $group ? '[]' : '' ) . '"' . $size . ( false !== $select ? $this->_set_selected( $value, $this->value, $select ) : '' ) . ' ' . $this->_attributes() . ' value="'. my_subdomain() .'" />'; } else { return '<input type="' . $type . '" name="' . $this->name . ( $group ? '[]' : '' ) . '"' . $size . ( false !== $select ? $this->_set_selected( $value, $this->value, $select ) : '' ) . ' ' . $this->_attributes() . ' value="' . $value . '" />'; }then tested by loading the registration page at the subdomain in question…
and voila… it all works.. after nearly 4 days of frustration..
if i can achieve the above via a custom template then that would be ideal…
Appreciate your feedback and hope this post helps others with a similar requirement.
Thanks
Mike