Press "Enter" to skip to content

PHP: Flow of data: WordPress – MagicMembers Plugin

Last updated on May 19, 2014

I hope this post comes in handy to any one else which has to support/deal with the MagicMembers plugin for WordPress.

The [user_register\ calls mgm_content_hooks.php “function mgm_shortcode_parse” which then calls mgm_user_register_form which is in mgm_form_functions.

If fetches the main registration fields using:
$register_fields = mgm_get_config(‘default_register_fields’,array());
[fields such as username, email address]
and the custom ones using:
$cf_register_page = mgm_get_class(‘member_custom_fields’)->get_fields_where(array(‘display’=>array(‘on_register’=>true)));
[fields such as subscription_options, password, and all others]

However, it then calls the filter mgm_register_form via the line:
$form_html .= apply_filters(‘mgm_register_form’, $form_html);
which calls, via mgm_user_hooks.php, the function mgm_wp_register_form_additional which is defined in core/hooks/mgm_user_hooks.php .

Using the templates it gets from two other filters (mgm_generate_register_form_template and mgm_register_form_template), it then tries to build the template using the filter mgm_generate_register_form_html. This filter (again defined in core/hooks/mgm_user_hooks.php) calls the function mgm_generate_register_form_html (again defined in mgm_user_hooks.php) and then the mgm_register_form_additional_html filter – which isn’t defined.

So, in short:

shortcode [user_register\ -> function mgm_shortcode_parse -> function mgm_user_register_form -> filter mgm_register_form -> function mgm_user_hooks -> function mgm_wp_register_form_additional -> filter mgm_generate_register_form_html -> function mgm_generate_register_form_html -> filter mgm_register_form_additional_html