Skip to content

Instantly share code, notes, and snippets.

View willguesser's full-sized avatar

William Guesser willguesser

  • Era Conectada
  • Florianópolis
View GitHub Profile
@willguesser
willguesser / restrict_doc_creation.php
Created June 19, 2018 17:58 — forked from dcavins/restrict_doc_creation.php
Only allow certain users to create docs.
<?php
add_filter( 'bp_docs_map_meta_caps', function( $caps, $cap, $user_id, $args ) {
if ( 'bp_docs_create' === $cap ) {
// Site admins
if ( user_can( $user_id, 'bp_moderate' ) ) {
$caps = array( 'exist' );
// If this is a group and the user is a group mod or admin.
} else if ( bp_is_group() && ( bp_group_is_mod() || bp_group_is_admin() ) ) {
$caps = array( 'exist' );
} else {
@willguesser
willguesser / gist:640efa1d44660e20256814993140b2fd
Created April 25, 2018 02:50 — forked from rolandinsh/gist:5636349
wp_new_user_notification() - wordpress new user notification message on register
<?php
if ( !function_exists( 'wp_new_user_notification' ) ) {
function wp_new_user_notification( $studentID, $plaintext_pass = '' ) {
$student = new WP_User($studentID);
$student_data = get_userdata( $studentID );
$firstname = $student_data->first_name;
$student_login = stripslashes( $student_data->user_login );
// URLs
$site_url = site_url();