Advertisement
Guest User

opensource-socialnetwork checkbox

a guest
Oct 21st, 2021
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.08 KB | None | 0 0
  1. <?php
  2.  
  3. function interest_in_init() {
  4.     ossn_add_hook('user', 'default:fields', 'interest_in');
  5. }
  6.  
  7. function interest_in($hook, $type, $fields) {
  8.     echo "<div id=\"interest-in\">";
  9.     echo "<label class=\"checkbox-block\">" . ossn_print('interest_in') . "</label>";
  10.  
  11.     //Male
  12.     $interestMale_checkbox = array(
  13.         'name' => 'interestMale',
  14.         'label' => ossn_print('male'),
  15.             //'checked' => $user->interestMale == true ? 'checked' : null,
  16.     );
  17.     if ($user->interestMale == true) {
  18.         $interestMale_checkbox['checked'] = 'checked';
  19.     }
  20.     echo ossn_plugin_view('input/checkbox', $interestMale_checkbox);
  21.  
  22.     //Female
  23.     $interestFemale_checkbox = array(
  24.         'name' => 'interestFemale',
  25.         'label' => ossn_print('female'),
  26.         'checked' => $user->interestFemale == true ? 'checked' : null, //different test. Not working also
  27.     );
  28.     echo ossn_plugin_view('input/checkbox', $interestFemale_checkbox);
  29.  
  30.     /* others options here */
  31.    
  32.     echo "</div>";
  33. }
  34.  
  35. ossn_register_callback('ossn', 'init', 'interest_in_init', 100);
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement