This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Register a custom post type called "book". | |
* | |
* @see get_post_type_labels() for label keys. | |
*/ | |
function wpdocs_codex_book_init() { | |
$labels = array( | |
'name' => _x( 'Books', 'Post type general name', 'textdomain' ), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Store a string into the variable which | |
// need to be Encrypted | |
$simple_string = "Welcome to GeeksforGeeks\n"; | |
// Display the original string | |
echo "Original String: " . $simple_string; | |
// Store the cipher method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get total number of weekdays in a year. | |
* | |
* @param string $day Week day. Sun, Mon, Tue,... | |
* @param string $year Year in 4 digits. | |
* @return integer Return total number of specified weekday for a year. | |
*/ | |
function get_total_weekday_in_year( $day = '', $year = '' ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add custom sub-tab on user profile. | |
*/ | |
function buddyboss_custom_user_tab() { | |
// Avoid fatal errors when plugin is not available. | |
if ( ! function_exists( 'bp_core_new_nav_item' ) || | |
! function_exists( 'bp_loggedin_user_domain' ) || | |
empty( get_current_user_id() ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add custom sub-tab on groups page. | |
*/ | |
function buddyboss_custom_user_tab() { | |
// Avoid fatal errors when plugin is not available. | |
if ( ! function_exists( 'bp_core_new_nav_item' ) || | |
! function_exists( 'bp_loggedin_user_domain' ) || | |
empty( get_current_user_id() ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Change default tab for group. | |
* | |
* @param string $default_tab Slug of default tab. | |
* @return string | |
*/ | |
function buddyboss_groups_default_extension( $default_tab ) { | |
return 'slug_of_tab'; // Last part of the URL. | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Disable email notification. | |
* | |
* @param integer $user_id User ID. | |
* @return void | |
*/ | |
function buddyboss_set_email_notifications_preference( $user_id ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function bpdev_set_email_notifications_preference( $user_id ) { | |
//I am putting some notifications to no by default and the common ones to yes to enable it. | |
//ref. https://bp-tricks.com/snippets/changing-default-buddypress-notifications-settings and BP forum | |
$settings_keys = array( | |
'notification_activity_new_mention' => 'yes', | |
'notification_activity_new_reply' => 'yes', | |
'notification_friends_friendship_request' => 'no', | |
'notification_friends_friendship_accepted' => 'no', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove tabs from user profile. | |
*/ | |
function remove_profile_nav() { | |
// Prevent fatal error if plugin is not available. | |
if ( ! function_exists( 'bp_core_remove_nav_item' ) ) { | |
return; | |
} |