Skip to content

Instantly share code, notes, and snippets.

@BhargavBhandari90
BhargavBhandari90 / buddypress-group-subtab.php
Last active April 8, 2024 01:04
Add custom tab on buddypress group page
<?php
/**
* Add custom sub-tab on groups page.
*/
function buddypress_custom_group_tab() {
// Avoid fatal errors when plugin is not available.
if ( ! function_exists( 'bp_core_new_subnav_item' ) ||
! function_exists( 'bp_is_single_item' ) ||
@shawncarr
shawncarr / mautic-form-preload.js
Last active April 15, 2020 16:39
Pre-populate Mautic Form Data from Query String Parameters
document.onreadystatechange = function () {
if (document.readyState == 'interactive') {
if (document.forms.length !== 0 && location.search) {
var query = location.search.substr(1);
query.split('&').forEach(function (part) {
if (part.indexOf('=') !== -1) {
var item = part.split('=');
var key = item[0];
var value = decodeURIComponent(item[1]);
var inputs = document.getElementsByName('mauticform[' + key + ']');
@kibao
kibao / ApiUploadedFile.php
Last active February 22, 2022 15:14
Symfony2 Form Component. Support upload file through API call (e.g. in json, xml, etc.) as base64 encoded content .
<?php
namespace Infun\HttpFoundation\File;
use Symfony\Component\HttpFoundation\File\File;
class ApiUploadedFile extends File
{
public function __construct($base64Content)