Skip to content

Instantly share code, notes, and snippets.

View BoweFrankema's full-sized avatar

Bowe Frankema BoweFrankema

View GitHub Profile
@BoweFrankema
BoweFrankema / buddypress-translate-widgets.php
Created February 13, 2015 16:19
Translate BuddyPress Widgets
//Translate BuddyPress Widgets
function cfc_widget_title( $title ) {
if ( $title == "Members") {
$title = __('Members Translation', 'cfctranslation') ;
}
return $title;
}
add_filter ( 'widget_title' , 'cfc_widget_title', 21 );
@BoweFrankema
BoweFrankema / buddypress-username-shortcode.php
Created February 2, 2015 11:15
BuddyPress Username Shortcode
<?php
// Output BuddyPress username through a shortcode
function cfc_bp_username ( $atts=null, $content=null ) {
global $user_ID;
if ( is_user_logged_in() ) {
return bp_core_get_username( $user_ID );
} else {
return "";
}
}
@BoweFrankema
BoweFrankema / overwrite-edd-action.php
Last active August 29, 2015 14:13
Overwrite action
<?php
/*
* Remove the default final checkout price
*/
function cfc_edd_replace_final_total() {
remove_action( 'edd_purchase_form_before_submit', 'edd_checkout_final_total', 999 );
}
add_action( 'init', 'cfc_edd_replace_final_total' );
@BoweFrankema
BoweFrankema / custom-site-message.php
Created December 16, 2014 12:07
Custom Message BuddyPress Multisite Site Creation
<?php
function cf_site_creation_confirmation() { { ?>
<div class="intro-text important">
All done! We have created your new site succesfully! We also sent you an email with your site details.
</div>
<?php }}
add_action('signup_finished','cf_site_creation_confirmation');
?>
@BoweFrankema
BoweFrankema / is-wordpress-class.php
Created December 12, 2014 10:35
Add a body class when the page is NOT a BuddyPress page
<?php
/**
* Add class when it's not a BuddyPress page
*/
function cfc_base_wordpress_page( $classes )
{
if ( ! is_buddypress() ) {
$classes[] = 'wordpress-page';
}
@BoweFrankema
BoweFrankema / bp-hide-widgets.php
Last active August 29, 2015 14:10
Hide BuddyPress widgets on Multisite install
<?php
//Remove the BP widgets everywhere except the main BuddyPress site.
add_action( 'bp_include', 'firmasite_bp_include_remove_widgets', 5 ); // priority is crucial
function firmasite_bp_include_remove_widgets() {
if ( !bp_is_root_blog() && !bp_is_multiblog_mode() )
remove_all_actions( 'bp_register_widgets' );
}
?>
@BoweFrankema
BoweFrankema / xprofile-field-message.php
Created November 24, 2014 13:37
Show a message when a certain xProfile field is empty. This is useful when you add new *critical* fields or have an additional sign-up system (Social Logins etc)
<?php
// Profile Edit Message
function cf_profile_field_intro_text() { { ?>
<?php
global $bp;
$user_id = $bp->loggedin_user->id;
$profile_edit_link = bp_loggedin_user_domain() . $bp->profile->slug . 'profile/edit/group/2/';
if ( bp_get_profile_field_data( 'field=Your Relationship with CF&user_id='.$user_id) == FALSE && !bp_is_profile_edit() ) : ?>
<div id="complete-profile-message" class="intro-text important">
@BoweFrankema
BoweFrankema / bp-notification-snippet.php
Last active August 29, 2015 14:10
See full post on BP-Tricks.com for full instructions http://wp.me/p2ZyW5-Jr
<?php
function bp_tricks_member_intro_text() { { ?>
<script type='text/javascript'>
jQuery( document ).ready(function() {
// Member Directory Message
if (!jQuery.cookie('member-alert-message')) {
jQuery( "#member-welcome-message" ).show();
jQuery("#expand-hidden").click(function() {
jQuery( "#member-welcome-message" ).slideUp( "slow" );
// set the cookie for 24 hours
@BoweFrankema
BoweFrankema / photo-loop.php
Last active August 29, 2015 14:07
Simply user media loop
<?php if ( have_rtmedia () ) { ?>
<div class="widget">
<h4>Recent Photos</h4>
<div class="rtmedia-container">
<ul class="rtmedia-list rtmedia-list-media <?php echo rtmedia_media_gallery_class (); ?>">
<?php while ( have_rtmedia () ) : rtmedia (); ?>
<li class="rtmedia-list-item" id="<?php echo rtmedia_id(); ?>">
<a href ="<?php rtmedia_permalink(); ?>" title="<?php echo rtmedia_title(); ?>" class="<?php echo apply_filters( 'rtmedia_gallery_list_item_a_class', 'rtmedia-list-item-a' ); ?>">
<div class="rtmedia-item-thumbnail">
@BoweFrankema
BoweFrankema / buddypress-activity-load.js
Created September 4, 2014 20:27
Fire a jQuery function on BuddyPress Activity Stream "Load More".
jQuery('ul#activity-stream').on('DOMNodeInserted', function() {
// Your jQuery Magic here
});