Skip to content

Instantly share code, notes, and snippets.

🔌
Contributing to #BuddyPress

imath imath

🔌
Contributing to #BuddyPress
Block or report user

Report or block imath

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@imath
imath / bp-custom.php
Created Sep 13, 2019
Activate "Activités de publication" for all new page items by default. (Requires https://github.com/imath/activites-de-publication/)
View bp-custom.php
<?php
/**
* For more information about how to use the bp-custom.php file
* @see https://codex.buddypress.org/themes/bp-custom-php/
*/
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
/**
@imath
imath / bp-example-block.php
Created Jul 31, 2019
BuddyPress example block: Put this two file into a `bp-example-block` folder before dropping it into `/wp-content/plugins/`
View bp-example-block.php
<?php
/**
* Plugin Name: BP Example Block
* Plugin URI: https://buddypress.org/
* Description: Example of BuddyPress block.
* Author: The BuddyPress Community
* Author URI: https://buddypress.org/
* Version: 1.0.0
* Text Domain: buddypress
* Domain Path: /languages/
@imath
imath / bp-custom.php
Created Jul 12, 2019
Registering REST Fields for the BP REST API
View bp-custom.php
<?php
// Registers a REST field for the Activity Endpoints.
function example_register_activity_rest_field() {
bp_rest_register_field(
'activity', // Id of the BuddyPress component the REST field is about
'example_field', // Used into the REST response/request
array(
'get_callback' => 'example_get_rest_field_callback', // The function to use to get the value of the REST Field
'update_callback' => 'example_update_rest_field_callback', // The function to use to update the value of the REST Field
@imath
imath / tickets.php
Last active Aug 24, 2019
Using WP Statuses for custom Post Types.
View tickets.php
<?php
/**
* Using WP Statuses for custom Post Types.
*
* @link http://github.com/imath/wp-statuses
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
@imath
imath / wp-idea-stream-custom.php
Created Feb 24, 2017
Anonymise Idea authors in WP Idea Stream
View wp-idea-stream-custom.php
<?php
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
/**
* Référencer un Idea Meta !
*/
function uana_custom_register_metas() {
// A very simple way to add a custom field (for text field only)
wp_idea_stream_ideas_register_meta( 'anonymous', array(
@imath
imath / wp-idea-stream-custom.php
Created Feb 14, 2017
Allow editor to Manage/Moderate Ideas
View wp-idea-stream-custom.php
<?php
/**
* What is the wp-idea-stream-custom.php file ?
* @see https://github.com/imath/wp-idea-stream/wiki/wp-idea-stream-custom.php
*/
function uana_map_to_editor( $caps, $cap, $user_id, $args ) {
/**
* Role > min cap.
* editor > edit_pages
@imath
imath / wp-idea-stream-custom.php
Created Feb 2, 2017
Add an extra filter nav to filter ideas by category or only get unrated ideas (Needs the WP Idea Stream WordPress plugin)
View wp-idea-stream-custom.php
<?php
/**
* For more infos about how to use the wp-idea-stream-custom.php file
* @see https://github.com/imath/wp-idea-stream/wiki/wp-idea-stream-custom.php
*/
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
/**
@imath
imath / bp-custom.php
Created Jan 31, 2017
This is a reply to my contact form. Question was: how is it possible to include the file's owner display name in BuddyDrive loops.
View bp-custom.php
<?php
/**
* @see https://codex.buddypress.org/themes/bp-custom-php/
* to learn more about the bp-custom.php file
*/
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
/**
* Edit each fetched Buddydrive to include the file owner display name.
@imath
imath / functions.php
Created Jan 16, 2017
Add a widget area above the WP Idea Stream archive page. The full child theme is available here: https://cldup.com/yk8pyyY1p1.zip
View functions.php
<?php
/**
* 1st step: Just register a new sidebar.
*/
function twentyseventeen_child_register_sidebar() {
register_sidebar( array(
'name' => __( 'Ideas', '2017-child' ),
'description' => __( 'Above the list of ideas', '2017-child' ),
'id' => 'ideas',
View wp-idea-stream-custom.php
<?php
/**
* WP Idea Stream Custom
*
* If i'm located in WP_PLUGIN_DIR, WP Idea Stream will load me.
*/
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
You can’t perform that action at this time.