Beecee – Disables selected fields in WP Admin

// disable non admin editing of school profile field // h/t https://wp-qa.com/how-to-make-custom-field-in-wordpress-user-profile-read-only add_action(‘admin_init’, ‘wordplace_user_profile_fields_disable’); function wordplace_user_profile_fields_disable() { global $pagenow; // apply only to user profile or user edit pages if ($pagenow!==’profile.php’ && $pagenow!==’user-edit.php’) { return; } // do not change…Continue reading

Beecee + WPForms – Smart Tags in the HTML

/** * Process Smart Tags inside HTML / Code Block form fields. * * @link https://wpforms.com/developers/how-to-process-smart-tags-in-html-fields/ */ function wpf_dev_html_process_smarttags( $properties, $field, $form_data ) { $properties[ ‘inputs’ ][ ‘primary’ ][ ‘code’ ] = apply_filters( ‘wpforms_process_smart_tags’, $properties[ ‘inputs’ ][ ‘primary’ ][ ‘code’…Continue reading

Beecee – Display Wp Form without Entry (wpforms_display)

function FN_display_wpforms_if_no_entry($atts) { // Extract shortcode attributes $atts = shortcode_atts(array( ‘id’ => ”, ‘title’ => ‘false’, ), $atts, ‘wpforms’); // Get the current user’s ID $current_user_id = get_current_user_id(); // Check if the current user has any entries in the form…Continue reading

ESSAI – TEMPORAIRE (SC_my_shortcode_form)

function FN_my_shortcode_function($atts) { if (isset($_POST[‘action’]) && $_POST[‘action’] === ‘Beecee_GroupLeader_user_do’) { $user_id = intval($_POST[‘user-id’]); } else { $user_id = intval($atts[‘user_id’]); } if (empty($user_id)) { return ‘Pas de saisie’; } return ‘utilisateur sélectionné est : ‘ . $user_id; } add_shortcode(‘SC_my_shortcode_form’, ‘FN_my_shortcode_function’);Continue reading

ESSAI – Output Learndash group ID (SC_administrators_group_ids)

function FN_display_administrators_group_ids() { global $wpdb; $user_id = get_current_user_id(); $is_group_leader = learndash_is_group_leader_user($user_id); if ($is_group_leader) { $group_ids = learndash_get_administrators_group_ids( $user_id ); if (empty($group_ids)) { return “No groups found.”; } $output = ‘ ‘; foreach ($group_ids as $group_id) { $output .= ‘ ‘…Continue reading

ESSAI – Forms User List of a Group leader (SC_GroupLeader_Forms_UserList)

function FN_GroupLeader_Forms_UserList() { $current_user_id = get_current_user_id(); if (learndash_is_group_leader_user($current_user_id)) { // Get the current user’s group IDs $group_ids = learndash_get_administrators_group_ids($current_user_id); // Build the droplist of users $output = ”; $output .= ‘Select a user:‘; $output .= ”; foreach ($group_ids as $group_id)…Continue reading

Essai – Display User role (SC_user_roles)

function FN_display_user_roles() { $user_id = get_current_user_id(); $is_admin = learndash_is_admin_user($user_id); $is_group_leader = learndash_is_group_leader_user($user_id); $output = ”; if ($is_admin && $is_group_leader) { $output = ‘This user is both an administrator and a group leader.’; } elseif ($is_admin) { $output = ‘This user…Continue reading

Beecee – User of a Group Leader (SC_Beecee_GroupLeader_user)

function FN_GroupLeader_user_shortcode() { $current_user_id = get_current_user_id(); if (learndash_is_group_leader_user($current_user_id)) { // Get the current user’s group IDs $group_ids = learndash_get_administrators_group_ids( $current_user_id ); // Build the list of users $output = ‘ ‘; foreach ($group_ids as $group_id) { // Get the list…Continue reading