Skip to content

Instantly share code, notes, and snippets.

View slaFFik's full-sized avatar
🚀

Slava Abakumov slaFFik

🚀
View GitHub Profile
@slaFFik
slaFFik / wpforms-custom-redirect.php
Last active September 17, 2021 22:16 — forked from jaredatch/functions.php
WPForms: Conditional form redirects based on field value.
<?php
/**
* WPForms: Conditional form redirects based on field value.
*
* @param string $url URL form will redirect to
* @param int $form_id Form ID
* @param array $fields Submitted form fields
* @return string
*/
function wpf_custom_redirect( $url, $form_id, $fields ) {
@slaFFik
slaFFik / ab-bp-retroactiveusers.php
Last active November 16, 2021 22:52 — forked from technosailor/ab-bp-retroactiveusers.php
Populate WordPress User Meta so that even users who have never logged in will display on the Members BP page
<?php
/*
Plugin Name: Retroactive BP User Acticity
Plugin URI: https://gist.github.com/3953927
Description: Makes all BuddyPress users visible immediately on user creation and retroactively adjust users to allow for their display before logging in.
Author: Aaron Brazell
Version: 1.0
Author URI: http://technosailor.com
License: MIT
License URI: http://opensource.org/licenses/MIT
@slaFFik
slaFFik / bp-prevent-duplicate-group-names.php
Last active February 3, 2020 11:23 — forked from shanebp/bp-prevent-duplicate-group-names.php
BuddyPress prevent duplicate Group Names
<?php
function pp_check_group_name( $group_new ) {
if ( 'group-details' == bp_get_groups_current_create_step() ) {
$args = array(
'per_page' => null,
'populate_extras' => false,
'update_meta_cache' => false
);
@slaFFik
slaFFik / block-activity-types.php
Last active February 3, 2020 11:24 — forked from BoweFrankema/block-activity-types.php
BuddyPress Activity - don't save certain activity types
<?php
//Block certain activity types from being added
function bp_activity_dont_save( $activity_object ) {
$exclude = array(
'updated_profile',
'new_member',
'new_avatar',
'friendship_created',
'joined_group'
);
<?php
// Profile Edit Message
function cf_profile_field_intro_text() {
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">
@slaFFik
slaFFik / bp-xprofile-countries-list.php
Last active April 1, 2021 14:57 — forked from shanebp/BuddyPress xprofile add countries
BuddyPress xProfile - Add Countries
<?php
/**
* If you are using BP 2.1+, this will insert a Country selectbox.
* Add the function to bp-custom.php and then visit .../wp-admin/users.php?page=bp-profile-setup
*/
function bp_add_custom_country_list() {
if ( !xprofile_get_field_id_from_name('Country') && 'bp-profile-setup' == $_GET['page'] ) {