Skip to content

Instantly share code, notes, and snippets.

@gsibert
gsibert / LearnDash Profile to My Account
Last active February 25, 2021 06:37 — forked from danielmcclure/functions.php
Add LearnDash Enrolled Courses Grid to My Account Tab in WooCommerce
/* Add LearnDash Profile to My Account Tab in WooCommerce */
/* Add Courses Link to My Account menu */
add_filter ( 'woocommerce_account_menu_items', 'wc_ld_link', 40 );
function wc_ld_link( $menu_links ){
$menu_links = array_slice( $menu_links, 0, 5, true )
+ array( 'courses' => 'My Courses' )
+ array_slice( $menu_links, 5, NULL, true );
return $menu_links;
@gsibert
gsibert / incodebox.php
Last active February 3, 2024 03:01
Gets the profile picture URL of a user from the ACF custom field profile_picture.
<?php
function get_associated_rm_profile_picture_url($post_id) {
// Get the user object related to this residential post
$residential_manager = get_field('residential_manager', $post_id);
// Proceed if we have a residential manager defined
if ($residential_manager) {
// Check if 'residential_manager' returns a User Object and extract the user ID
$user_id = is_array($residential_manager) && isset($residential_manager['ID']) ? $residential_manager['ID'] : null;