Skip to content

Instantly share code, notes, and snippets.

View pranali333's full-sized avatar
👻
Observing...

Pranali Patel pranali333

👻
Observing...
View GitHub Profile
@pranali333
pranali333 / bp_add_username_in_activity.php
Last active November 4, 2015 17:15
Usage of filter : bp_activity_new_update_content
// Use this filter in your theme's functions.php file if you want to filter the content of new activity.
// For example below code will append username to current activity item.
// define the bp_activity_new_update_content callback
function filter_bp_activity_new_update_content( $activity_content )
{
// Append additional content here...
$user_info = get_userdata(get_current_user_id());
$activity_content = 'I am user : '.$user_info->user_login." ".$activity_content;
// remove the filter
@pranali333
pranali333 / custom-script.js
Created December 7, 2016 13:35
Prevent text "Select your files" changing to "Add more files" while uploading media
<script type="text/javascript">
jQuery( 'document' ).ready( function( $ ) {
rtMediaHook.register( 'rtmedia_js_after_files_added', function() {
jQuery( ".rtmedia-uploader-div #rtmedia-uploader-form #rtMedia-upload-button" ).val( 'Select your files' );
return true;
} );
});
</script>
@pranali333
pranali333 / functions.php
Created December 28, 2016 13:51
Custom code to manage BuddyPress cover picture and user profile picture uploads to rtAmazon S3
<?php
// file: rtamazon-s3/includes/rtamazon-s3-functions.php
/**
* Set selected url structure, selected in rtAmazon settings.
*
* @since 1.4.0
*
* @param string $urls urls in content.
@pranali333
pranali333 / functions.php
Created January 16, 2017 14:28
Fetching google plus count directly from google API for rtSocial plugin
<?php
/**
* Fetch google plus count from google API.
*/
function rtmedia_wp_footer_callback(){
/* Check if user is logged-in. */
if( ! is_user_logged_in() ){
/* Get option settings of the rtSocial plugin. */
@pranali333
pranali333 / functions.php
Last active March 14, 2017 06:59
Custom code to keep media description open while uploading media using rtMedia uploader
// Check if function does not exist.
if ( ! function_exists( 'rtmedia_wp_footer_open_title_and_desc_callback' ) ) {
/**
* Add script in the wp_footer that fire just after the media is added in the rtMedia up-loader
* By default it will open the title and description box of the media
*/
function rtmedia_wp_footer_open_title_and_desc_callback() {
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
@pranali333
pranali333 / album-gallery-item.php
Created January 30, 2017 13:57
Hide the Wall Posts album from album gallery
@pranali333
pranali333 / functions.php
Created January 31, 2017 13:33
Remove action bp_activity_entry_meta from RTMediaPrivacy class under rtMedia
<?php
/**
* Remove Class Filter Without Access to Class Object
*
* In order to use the core WordPress remove_filter() on a filter added with the callback
* to a class, you either have to have access to that class object, or it has to be a call
* to a static method. This method allows you to remove filters with a callback to a class
* you don't have access to.
*
* @param string $tag Filter to remove
@pranali333
pranali333 / functions.php
Last active March 6, 2017 13:44
Restrict rtMedia uploader view for author of the custom post.
<?php
//Function to restrict rtmedia uploader view for author
function restrict_rtmedia_uploader( $allow, $section ) {
// Add Your Post Type Here
$ctp = '';
if ( $ctp == get_post()->post_type ) {
if ( get_post()->post_author == get_current_user_id() ) {
$allow = true;
@pranali333
pranali333 / functions.php
Created February 15, 2017 07:07
rtMedia gallery shortcode to list media from all albums by excluding the specific ones.
<?php
/**
* Magic begins from here
*/
function my_rtmedia_set_query_filters() {
add_filter( 'rtmedia_media_query', 'my_modify_media_query', 9, 3 );
}
add_action( 'rtmedia_set_query', 'my_rtmedia_set_query_filters', 99 );
/**
@pranali333
pranali333 / functions.php
Last active February 21, 2017 09:17
Customize album gallery template to display album description
<?php
// Fetch album description
function custom_rtmedia_get_album_desc(){
global $rtmedia_backbone;
if ( $rtmedia_backbone[ 'backbone' ] ){
echo '<%= album_desc %>';
} else {
return rtmedia_get_album_desc_custom();
}