Skip to content

Instantly share code, notes, and snippets.

View BoweFrankema's full-sized avatar

Bowe Frankema BoweFrankema

View GitHub Profile
@BoweFrankema
BoweFrankema / theme-tour.php
Last active August 29, 2015 14:27 — forked from DevinWalker/theme-tour.php
Theme activation welcome message
<?php
/**
* Theme Activation Tour
*
* This class handles the pointers used in the introduction tour.
* @package Popup Demo
*
*/
class WordImpress_Theme_Tour {
@BoweFrankema
BoweFrankema / add-dashicons-to-wordpress-customizer.php
Last active March 31, 2018 02:36
Add Dashicons to your Customizer Panels. You can find the dashicon CSS classes here: https://developer.wordpress.org/resource/dashicons/#id
<?php
/**
* Enqueue the stylesheet.
* http://aristeides.com/blog/modifying-wordpress-customizer/
*/
function my_enqueue_customizer_stylesheet() {
wp_register_style( 'my-customizer-css', YOUR_PLUGIN_URL. 'assets/css/customizer.css', NULL, NULL, 'all' );
wp_enqueue_style( 'my-customizer-css' );
@BoweFrankema
BoweFrankema / bp-default-notification-settings.php
Created February 26, 2015 08:55
Default BuddyPress Notification Settings
<?php
add_action( 'bp_core_activated_user', 'bpdev_set_email_notifications_preference');
function bpdev_set_email_notifications_preference( $user_id ) {
//I am putting all the notifications to no by default
//you can set the value to 'yes' if you want that notification to be enabled.
$settings_keys = array(
'notification_activity_new_mention' => 'no',
'notification_activity_new_reply' => 'no',
@BoweFrankema
BoweFrankema / default-buddypress-avatar-settings.php
Created February 23, 2015 10:38
Default BuddyPress Avatar Settings
<?php
/**
* Change Default Avatar Size
*/
if ( !defined( 'BP_AVATAR_THUMB_WIDTH' ) ) {
define( 'BP_AVATAR_THUMB_WIDTH', 80 );
}
if ( !defined( 'BP_AVATAR_THUMB_HEIGHT' ) ) {
define( 'BP_AVATAR_THUMB_HEIGHT', 80 );
<?php
function bptricks_add_handle (){
echo '<span class="bbp-user-nicename"><span class="handle-sign">@</span>'. bp_core_get_username(bbp_get_reply_author_id(bbp_get_reply_id())) .'</span>' ;
}
add_action( 'bbp_theme_after_reply_author_details', 'bptricks_add_handle' );
?>
@BoweFrankema
BoweFrankema / bp-edd-redirect.php
Last active August 23, 2017 15:12
BuddyPress Easy Digital Downloads Page redirect
<?php
function bp_edd_redirect()
//Redirect logged in users from edd page to BuddyPress page. Make sure to change the page slug correctly.
{
if( is_user_logged_in() && is_page('purchases') )
{
global $bp;
wp_redirect( bp_loggedin_user_domain() . $bp->profile->slug . '/my-purchases/', 301 );
exit();
}
@BoweFrankema
BoweFrankema / buddypress-logged-in-user-redirect.php
Created February 20, 2015 17:03
Redirect logged in users from the homepage to the activity stream.
<?php
function cfc_bp_profile_homepage()
//Redirect logged in users from homepage to activity. This happens after login or when a user tries to go back to the homepage.
{
global $bp;
if( is_user_logged_in() && is_front_page() && !get_user_meta( $user->ID, 'last_activity', true ) )
{
wp_redirect( network_home_url( $bp->activity->root_slug ), 301 );
exit();
}
@BoweFrankema
BoweFrankema / edd-buddypress-purchase.php
Created February 20, 2015 15:43
BuddyPress Easy Digital Downloads - My Purchases Page
<?php
if ( function_exists( 'bp_is_member' ) ) {
/**
* Add EDD Purchases Page
*
*/
function edd_bp_setup_purchases(){
global $bp;
$profile_link = bp_loggedin_user_domain() . $bp->profile->slug . '/';
$args = array(
@BoweFrankema
BoweFrankema / bp-keep-me-logged-in.php
Created February 18, 2015 09:09
Keep me logged in for a longer time.
<?php
function bp_keep_me_logged_in( $expirein ) {
return 2629743; // 1 month in seconds
}
add_filter( 'auth_cookie_expiration', 'bp_keep_me_logged_in' );
?>
@BoweFrankema
BoweFrankema / bp-remember-me.php
Created February 18, 2015 09:06
Automatically check 'remember me' login checkbox.
<?php
function bp_login_checked_remember_me_back() {
add_filter( 'login_footer', 'bp_login_remember_me' );
}
add_action( 'init', 'bp_login_checked_remember_me_back' );
function bp_login_remember_me() {
echo '<script type="text/javascript">document.getElementById(\'rememberme\').checked = true</script>';
}
add_action( 'wp_footer', 'bp_login_remember_me' );