Last active
April 19, 2019 14:57
-
-
Save kimcoleman/391a537ffabf1d2f0c3027e988b291ea to your computer and use it in GitHub Desktop.
Creates custom fields for admins to assign member "badge" icons. Display these icon badges on the Profile page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Creates custom fields for admins to assign member "badge" icons. Display these icon badges on the Profile page. | |
| * | |
| * Include this custom CSS to display the icons on the member's frontend Profile page: | |
| * https://gist.github.com/kimcoleman/83f8d089ae35fd9d4cc05cb11fd66e79 | |
| * | |
| */ | |
| function custom_member_badges_fields() { | |
| // Don't break if Register Helper is not loaded. | |
| if( ! function_exists( 'pmprorh_add_registration_field' ) ) { | |
| return false; | |
| } | |
| // Define the fields. | |
| $fields = array(); | |
| $fields[] = new PMProRH_Field( | |
| 'php_developer', | |
| 'checkbox', | |
| array( | |
| 'label' => 'PHP Experience', | |
| 'profile' => 'only_admin' | |
| ) | |
| ); | |
| $fields[] = new PMProRH_Field( | |
| 'javascript_developer', | |
| 'checkbox', | |
| array( | |
| 'label' => 'JavaScript Experience', | |
| 'profile' => 'only_admin' | |
| ) | |
| ); | |
| $fields[] = new PMProRH_Field( | |
| 'mysql_developer', | |
| 'checkbox', | |
| array( | |
| 'label' => 'MySQL Experience', | |
| 'profile' => 'only_admin' | |
| ) | |
| ); | |
| // Add the fields to the profile only. | |
| foreach ( $fields as $field ) { | |
| pmprorh_add_registration_field( | |
| 'just_profile', | |
| $field | |
| ); | |
| } | |
| } | |
| add_action( 'init', 'custom_member_badges_fields' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment