Skip to content

Instantly share code, notes, and snippets.

View messaoudi-mounir's full-sized avatar

Messaoudi Mounir messaoudi-mounir

View GitHub Profile
<?php
/*
Plugin Name: Urdu Formatter - Shamil
Plugin URI: http://www.mbilalm.com/blog/
Description: This Plugin automatically detects Urdu posts, comments and posts summery (Excerpt), and If Urdu is found then it sets the proper direction, size and font of text according to Urdu. With this plugin you can carry blogging in both languages (Urdu and English). Find more detail in Settings page or visit plugin site.
Author: M Bilal M
Author URI: http://www.mbilalm.com/
Version: 0.1
*/
@messaoudi-mounir
messaoudi-mounir / ydbfs.inc.php
Created April 13, 2013 21:39
YD BuddyPress Feed Syndication fix some bugs
<?php
function bptt_init() {
// ======================================= GROUP FEATURES ==================================
// This is inspired by the external-group-blogs BP plugin
/** Group blog extension using the BuddyPress group extension API **/
@messaoudi-mounir
messaoudi-mounir / bp
Created April 17, 2013 16:01
Buddypress Activity shortcode
function bp_get_activities($atts, $content = null ){
extract(shortcode_atts(array(
'max' => '10',
'per_page' => '10'
), $atts));
$activities = '<ul class="activity-list item-list">';
if ( bp_has_activities( 'activity&per_page='. $per_page .'max='. $max ) ) :
ob_start();
@messaoudi-mounir
messaoudi-mounir / gist:5503865
Last active February 3, 2020 09:13
Buddypress Member Profile URL with User ID instead of Username
<?php
function bp_get_user_domain_with_id( $domain, $user_id, $user_nicename = false, $user_login = false ) {
if ( empty( $user_id ) )
return;
if( isset($user_nicename) )
$user_nicename = bp_core_get_username($user_id);
@messaoudi-mounir
messaoudi-mounir / buddypress-exclude-members.php
Last active December 20, 2015 00:39
This script exclude Admins users from Members directory on BuddyPress.
add_action( 'bp_legacy_theme_ajax_querystring','bprm_exclude_members',20 , 2 );
add_action( 'bp_ajax_querystring','bprm_exclude_members',20 , 2 );
function bprm_exclude_members( $qs=false, $object = false ){
global $bp;
//list of users to exclude
//comma separated ids of users whom you want to exclude
// for example '0,1,54'
@messaoudi-mounir
messaoudi-mounir / gist:6365021
Last active December 21, 2015 20:59
Remove custom image header if is activity component or is member activity page or is group activity page
add_action( 'after_setup_theme','bp_remove_custom_image_header', 100 );
function bp_remove_custom_image_header() {
if ( bp_is_user_activity() || bp_is_activity_component() || bp_is_group_home() ) {
//remove_custom_background();
remove_custom_image_header();
}
}
@messaoudi-mounir
messaoudi-mounir / buddypress-facebook-like.php
Last active December 22, 2015 01:09
Buddypress Add a Facebook Like/Unlike button to activity stream items.
/**
* bp_like_button()
*
* Outputs the Facebook 'Like/Unlike' .
*
*/
function bp_like_button( $id = '', $type = '' ) {
$activity_permalink = bp_get_activity_thread_permalink();
;
?>
@messaoudi-mounir
messaoudi-mounir / 0_reuse_code.js
Created October 26, 2013 13:35
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@messaoudi-mounir
messaoudi-mounir / exclude-members-by-roles.php
Last active December 15, 2020 12:42
Buddypress Exclude members by roles
function get_user_ids_by_role($role){
$users=array();
$founded_users = get_users( array( 'role' => $role ) );
if(!empty($founded_users)){
foreach((array)$founded_users as $user)
$users[]=$user->ID;
}
return $users;
}
@messaoudi-mounir
messaoudi-mounir / hide_comment_for_no_logggedin.php
Last active January 2, 2016 22:59
Buddypress : This code hide comments for no logged in users
/**
* Add the code to functions.php of your current theme.
* this code hide comments for no logged in users
*/
add_filter( 'bp_activity_get_comment_count' , 'bp_only_loggedin_can_see_comments', 10,1 );
function bp_only_loggedin_can_see_comments( $count ){
if ( !is_user_logged_in() )
$count = 0;