Skip to content

Instantly share code, notes, and snippets.

View BhargavBhandari90's full-sized avatar
🏠
Working from home

Bhargav(Bunty) BhargavBhandari90

🏠
Working from home
View GitHub Profile
@BhargavBhandari90
BhargavBhandari90 / add_fieldPjob_submit.php
Created December 6, 2024 07:20
Add field to job manager submit job form
<?php
/**
* Add a Field to the Job Submission Form:
*/
add_filter( 'submit_job_form_fields', 'custom_job_submission_fields' );
function custom_job_submission_fields( $fields ) {
$fields['job']['custom_field'] = array(
'label' => __( 'Custom Field', 'text-domain' ),
'type' => 'text',
'required' => false,
@BhargavBhandari90
BhargavBhandari90 / bb_tab_account_setting.php
Created October 5, 2024 11:55
Add new tab Under BB Account Setting
<?php
/**
*
*Setup tab under Account Setting.
*/
function custom_settings_tab() {
bp_core_new_subnav_item( array(
'name' => __( 'BB Member Info', 'buddyboss' ),
'slug' => 'bb-member-info',
@BhargavBhandari90
BhargavBhandari90 / get_sf_contact.php
Last active October 23, 2024 12:05
get Salesforce contact in WordPress
<?php
$access_token = 'Your access token';
if (!$access_token) {
return 'Error: Unable to retrieve access token';
}
$api_url = 'https://yourdomain.my.salesforce.com/services/data/v55.0/sobjects/Contact/' . $contact_id;
$response = wp_remote_get($api_url, array(
'headers' => array(
@BhargavBhandari90
BhargavBhandari90 / add_account_sales_force.php
Created October 4, 2024 09:50
Add Account in Salesforce for WordPress
<?php
$access_token = 'your_access_token';
if (!$access_token) {
return 'Error: Unable to authenticate with Salesforce';
}
$instance_url = 'https://youraccount.salesforce.com'; // Replace with your instance URL
$endpoint = $instance_url . '/services/data/v55.0/sobjects/Account';
$account_data = array(
'Name' => $first_name,
@BhargavBhandari90
BhargavBhandari90 / syntaxt_highliter.php
Created July 6, 2024 14:00
Syntax Highliter for BB
<?php
function bbtest_the_content( $content ) {
$search = array( '<pre>' );
$replace = array( '<pre class="wp-block-syntaxhighlighter-code">' );
$content = str_replace( $search, $replace, $content );
$syntax_obj = new SyntaxHighlighter();
<?php
function bbtest_render_app_page_data( $app_page_data, $block_data ) {
if ( isset( $app_page_data['type'] ) && 'bbapp/notifications' === $app_page_data['type'] ) {
$app_page_data['data']['data_source']['route'] = '/buddyboss-app/v1/notifications?&sort_order=DESC&order_by=date_notified';
}
return $app_page_data;
@BhargavBhandari90
BhargavBhandari90 / play_video_in_viewpart.js
Created May 28, 2024 11:37
Play video when in view part
document.addEventListener('DOMContentLoaded', function() {
const video = document.getElementById('video-22_html5_api'); // SET your Video tag ID
let previewStarted = false;
function isElementInViewport(el) {
const rect = el.getBoundingClientRect();
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
@BhargavBhandari90
BhargavBhandari90 / bb_block.php
Last active May 11, 2024 11:08
Make Custom Block compatible with BuddyBoss App's App Editor
<?php
/**
* Get rid of BBApp block compatibility error.
*
* @param [type] $allow_blocks_for_editor_to_app_editor
* @return void
*/
function bb_allow_blocks_for_editor_to_app_editor( $allow_blocks_for_editor_to_app_editor ) {
@BhargavBhandari90
BhargavBhandari90 / convert_to_wyswing.php
Created April 3, 2024 07:17
Convert BB Discussion/Reply medium editor to WYSWING editor
<?php
// Enable WYSWING editor.
function bbp_enable_visual_editor( $r = array() ) {
$r['tinymce'] = true;
$r['media_buttons'] = true;
// Load WHYSWING.
@BhargavBhandari90
BhargavBhandari90 / show_all_notifications.php
Created March 5, 2024 06:38
BuddyBoss - Show all notifications in one API
<?php
/**
* We have to pass "is_new:0" and apply following filter.
*/
function modify_where( $where_sql, $table_prefix, $r ) {
$where_sql = str_replace( 'AND is_new = 0', '', $where_sql );