Skip to content

Instantly share code, notes, and snippets.

View BoweFrankema's full-sized avatar

Bowe Frankema BoweFrankema

View GitHub Profile
@BoweFrankema
BoweFrankema / widget-test.json
Created April 4, 2024 07:37
widget-test.json
{
"widget_title": "Custom Widget",
"widget_size": "full",
"widget_html": "<div class=\"items-center dol-empty-state max-w-screen-xl gap-8 px-4 py-2 mx-auto xl:gap-16 md:grid md:grid-cols-2 sm:py-16 lg:px-6\">\n <div class=\"mt-4 md:mt-0\">\n <h2 class=\"mb-4 text-xl font-extrabold tracking-tight text-gray-900 dark:text-white\">No vulnerabilities detected</h2>\n <p class=\"mb-6 font-light text-gray-500 md:text-lg dark:text-gray-400\">\n Your sites are clean. If we detect any vulnerability we will let you know immediately.\n </p>\n </div>\n</div>"
}
@BoweFrankema
BoweFrankema / test.json
Last active March 29, 2024 10:51
test.json
[{"role":"user","content":"Can you write something about our Stuart?"},{"role":"assistant","content":"Certainly! Here's a draft for the newsletter content focusing on the Site Backups feature.\n\n---\n\n**Headline:** \nSafeguard Your Digital Masterpieces: Introducing Dollie's Site Backups!\n\n**Introduction:** \nIn the digital realm, our websites are akin to towering cities, reflecting months, if not years, of craftsmanship. Just as historians protect ancient scrolls, at Dollie, we understand the significance of safeguarding your online legacy. Cast your mind back to the days of early web development; a single misstep could lead to digital disaster. No more. With Dollie's Site Backups, the assurance of a safety net is no longer a luxury\u2014it's your new reality.\n\n**Main Content:** \nNavigate through the new waves of web prowess with Dollie's cutting-edge Site Backups feature. Offering more than just a fallback, our latest update brings you the tranquility of knowing that your sites are replicated in a
@BoweFrankema
BoweFrankema / cover-photo.php
Last active March 27, 2023 23:12
Add Cover Photo functionality to BuddyPress
<?php
function setup_cover_profile_nav(){
global $bp;
$profile_link = bp_loggedin_user_domain() . $bp->profile->slug . '/';
$args = array(
'name' => 'Profile Cover',
'slug' => 'change-cover',
'parent_url' => $profile_link,
'parent_slug' => $bp->profile->slug,
'screen_function' => 'screen_change_cover',
@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 / 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 / example.php
Last active November 2, 2018 16:38
ACF FB Redirect
<?php
//Redirect on special URL format. ie: https://examplesite.com/?profile=visit
function fb_acf_profile_redirect()
{
$profile = $_GET['profile'];
//Is the profile link being requested
if ( $profile == 'visit' ) {
wp_safe_redirect( get_field('profile_redirect', 'option') );
exit;
}
@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-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 / random_login.php
Created June 1, 2017 12:55
Add random login string after login.
function jpr_generateRandomString($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
@BoweFrankema
BoweFrankema / author-role.php
Created March 31, 2017 22:27
Make user author
add_action('bp_core_activated_user', 'bp_custom_registration_role',10 , 3);
function bp_custom_registration_role($user_id, $key, $user) {
$userdata = array();
$userdata['ID'] = $user_id;
$userdata['role'] = 'author';
//only allow if user role is my_role
if (($userdata['role'] == "subscriber") or ($userdata['role'] == "contributor"))
wp_update_user($userdata);
}