Skip to content

Instantly share code, notes, and snippets.

import jwt from 'jsonwebtoken';
import User from '../models/User';
class SessionController {
async store(req, res) {
const { email, password } = req.body;
const user = User.findOne({ where: { email } });
@nelsonogueh
nelsonogueh / gist:adc6b74c86118fe024273575c61c8125
Created April 16, 2021 03:36 — forked from mikejolley/gist:2176823
WooCommerce - Show products from current product category (when viewing a single product)
<?php
if ( is_singular('product') ) {
global $post;
// get categories
$terms = wp_get_post_terms( $post->ID, 'product_cat' );
foreach ( $terms as $term ) $cats_array[] = $term->term_id;
<?php
$args = array(
'label' => '', // Text in Label
'class' => '',
'style' => '',
'wrapper_class' => '',
'value' => '', // if empty, retrieved from post meta where id is the meta_key
'id' => '', // required
'name' => '', //name will set from id if empty
@nelsonogueh
nelsonogueh / LearnDash Profile to My Account
Created February 25, 2021 06:37 — forked from gsibert/LearnDash Profile to My Account
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;
@nelsonogueh
nelsonogueh / functions.php
Created February 25, 2021 06:36 — forked from danieljwonder/functions.php
Add LearnDash Enrolled Courses Grid to My Account Tab in WooCommerce
<?php
/* Add LearnDash Enrolled Courses Grid 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 );