MemberPress: Display Corporate Account Logo for Sub-Users

add_shortcode(‘mepr-sub-logo’, function() { global $wpdb; $logo_slug = ‘mepr_logo’; // Custom field logo slug // Get current user $user = MeprUtils::get_currentuserinfo(); $caid = get_user_meta($user->ID, ‘mpca_corporate_account_id’); if (empty($caid)) { return; // Return if no corporate account ID is found } // Get…Continue reading

Unattached Media Cleanup (copy)

// Schedule the event if it is not already scheduled function schedule_unattached_media_cleanup() { if (!wp_next_scheduled(‘delete_unattached_media_event’)) { wp_schedule_event(time(), ‘daily’, ‘delete_unattached_media_event’); } } add_action(‘wp’, ‘schedule_unattached_media_cleanup’); // Hook the function to the scheduled event add_action(‘delete_unattached_media_event’, ‘delete_unattached_media’); // Function to delete unattached media function…Continue reading

Login Redirect

function my_login_redirect($redirect_to, $request, $user) { return (in_array(‘administrator’, $user->roles)) ? $redirect_to : home_url(‘/gesetzesportal’); } add_filter(‘login_redirect’, ‘my_login_redirect’, 10, 3);Continue reading

Download Details Featured Image (copy)

function sd_edd_download_details_widget_thumbnail( $instance ) { $download_id = isset( $instance[‘download_id’] ) ? $instance[‘download_id’] : 0; if ( ‘current’ === $instance[‘display_type’] ) { $download_id = get_the_ID(); } if ( empty( $download_id ) || ! has_post_thumbnail( $download_id ) || ‘download’ !== get_post_type( $download_id…Continue reading

custom-add-to-cart-or-resume

function ld_course_resume_or_buy_shortcode( $atts ) { $atts = shortcode_atts( [ ‘course_id’ => get_the_ID(), // use current course if none passed ‘resume_label’ => ‘Resume Course’, ‘buy_label’ => ‘Buy Now’, ], $atts ); $course_id = intval( $atts[‘course_id’] ); $user_id = get_current_user_id(); // Check…Continue reading